Closed
Description
Describe the issue
Currently, the unnecessary_breaks
lint only reports for break
statements that appear after a case
clause. If the break
statement appears at the end of a default
clause, no lint is reported.
To Reproduce
main(List<String> args) {
switch (args.length) {
case 1:
print('1 arg');
default:
print('${args.length} args');
break; // No lint reported
}
}
Expected behavior
A lint should be reported at the line marked No lint reported
above.
Additional context
Note that in the above example, if default:
is changed to case _:
, the lint works properly.