Skip to main content

avoid-unnecessary-conditionals

added in: 1.6.0
🛠

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;