avoid-unnecessary-conditionals
preset: recommended
Checks for unnecessary conditional expressions.
Example
❌ Bad:
bool baz() => foo ? true : false; // LINT
bool bar() => foo ? false : true; // LINT
✅ Good:
bool baz() => foo;
bool bar() => !foo;
Checks for unnecessary conditional expressions.
❌ Bad:
bool baz() => foo ? true : false; // LINT
bool bar() => foo ? false : true; // LINT
✅ Good:
bool baz() => foo;
bool bar() => !foo;