Skip to main content

avoid-unnecessary-futures

added in: 1.7.0
🛠
preset: recommended

Warns when a return type of a declaration is unnecessary wrapped into a Future.

Example

❌ Bad:

// LINT
Future<String> asyncValue() async => 'value';

class SomeClass {
// LINT
Future<int> asyncMethod() async => 1;
}

✅ Good:

String value() => 'value';

class SomeClass {
int method() => 1;
}