Closed
Description
Dartanalyzer doesn't detect any error/warning for the following code. However, there will be a run-time error: type 'String' is not a subtype of type 'FutureOr<List>'
It is hard to pick up this kind of errors by eyes.
IMO, it is better to allow
Future.catchError()
to return another type likeFuture.then<R>()
does. But, it is OK as long as dartanlyser can pick up the errors for us.
import "dart:async";
void main() {
foo()
.catchError((ex) {
return "error";
});
}
Future<List> foo() async {
throw "error";
}
Dart SDK: 2.1