Compilation error after applying quick fix for prefer_is_empty
linter rule
#55250
Labels
analyzer-quick-fix
area-analyzer
Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
P2
A bug or feature request we're likely to work on
Consider this code:
The
prefer_is_empty
linter report reports a warning:Use 'isEmpty' instead of 'length' to test whether the collection is empty. Try rewriting the expression to use 'isEmpty'
. When you apply the proposed fix, e.g. by runningdart fix --apply
, the result iswhich fails to compile with
The property 'isEmpty' can't be unconditionally accessed because the receiver can be 'null'.
Expected behavior: if code compiles before
dart fix
then it should compile after.dart info
):3.3.0 (stable) (Tue Feb 13 10:25:19 2024 +0000) on "macos_arm64"
The text was updated successfully, but these errors were encountered: