prefer-simpler-patterns-null-check
preset: recommended
Warns when a patterns check for non-nullability can be simplified.
Example
❌ Bad:
final object = WithField('hello');
// LINT: Prefer simpler non-null checks. Try replacing it with 'final field?'.
if (object.field case != null && final field) {}
// LINT: This null-check is fully covered by the type annotation. Try removing it.
if (object.field case != null && final String field) {}
✅ Good:
final object = WithField('hello');
if (object.field case final String field) {}
if (object.field case final field?) {}
if (object.field case != null) {}
if (object.field case != null || final field) {}