Skip to main content

avoid-nested-futures

added in: 1.7.0

Warns when a Future type contains another Future.

Example

❌ Bad:

Future<Future<int>> function() async => ...; // LINT

FutureOr<Future<int>> function() async => ...; // LINT

FutureOr<FutureOr<int>> function() async => ...; // LINT

✅ Good:

Future<int> function() async => ...;

FutureOr<int> function() async => ...;