prefer-correct-future-return-type
Warns when a declaration that returns a Future
has an incorrect return type.
Object
, dynamic
, generic type, FutureOr
or a nullable Future
are considered incorrect and should be replaced by a Future
.
Example
❌ Bad:
dynamic function() async => ...; // LINT
Object function() async => ...; // LINT
FutureOr<int> function() async => ...; // LINT
Future<int>? function() async => ...; // LINT
T function<T>() async => ...; // LINT
✅ Good:
Future<dynamic> function() async => ...;
Future<Object> function() async => ...;
Future<int> function() async => ...;
Future<int> function() async => ...;
Future<T> function<T>() async => ...;