Open
Description
The analyzer won't allow a function annotated with @alwaysThrows
as the final statement in a case
. However, it also considers code after it to be dead. For example:
import 'package:meta/meta.dart';
@alwaysThrows
void thrower() {
throw "dang";
}
void doIt() {
switch ("foo") {
case "foo":
thrower();
case "bar":
thrower();
return null;
}
}
This produces one error and one hint:
Analyzing test.dart...
error • The last statement of the 'case' should be 'break', 'continue', 'rethrow', 'return' or 'throw' at test.dart:10:5 • case_block_not_terminated
hint • Dead code at test.dart:15:7 • dead_code
1 error and 1 hint found.