Closed
Description
This code:
enum Enum { a, b }
String test(Enum x, String s) {
switch (x) {
case Enum.a:
if (s != null)
return 'a';
return 'b';
case Enum.b:
if (s != null)
return 'c';
return 'd';
}
return null;
}
void main() {
print(test(Enum.a, ''));
}
This .analysis_options
file:
linter:
rules:
- invariant_booleans
...results in this error:
$ dartanalyzer test.dart
Analyzing [test.dart]...
[lint] Conditions should not unconditionally evaluate to "TRUE" or to "FALSE" verify: s != null. (test.dart, line 11, col 11)
1 lint found.