Closed
Description
Consider this code:
RenderBox? rb = c.findRenderObject() as RenderBox;
return rb?.size ?? Size.zero;
findRenderObject
returns RenderObject?
, so clearly rb
could be null here, but the compiler is giving a warning:
warning: The receiver can't be null, so the null-aware operator '?.' is unnecessary. (invalid_null_aware_operator at [flutter_folio] lib_utils\context_utils.dart:9)
Compiler seems to think the cast will always succeed, even if the source is a nullable.
Nullable or not, it should not be making this assumption?