avoid_inverted_boolean_expressions
Severity | Quick Fix | Options |
---|---|---|
Info | ✅ | ❌ |
Details
DO avoid using inverted boolean expressions unnecessarily.
Unnecessary inverted boolean expression should be avoided since it decreases code readability.
Bad
if (!(number > 0)) {}
final text = !(number == 0) ? 'Not zero' : 'Zero';
Good
if (number <= 0) {}
final text = number != 0 ? 'Not zero' : 'Zero';