Why this matters
Reduces risk of unexpected late null errors and clarifies intent.
Avoid `!` when nullability is already proven or a safer alternative (`??`, early return) exists.
Reduces risk of unexpected late null errors and clarifies intent.
Side-by-side examples engineers can pattern-match during review.
final len = items!.length; // items may be nullfinal list = items ?? const [];
final len = list.length;value!.doSomething()final v = value ?? defaultV; v.doSomething()From the same buckets as this rule.
Check if loops use equality operators (== or !=) in termination conditions. These can lead to infinite loops if the condition is never met exactly. Instead, use relational operators like < or > for safer loop termination.