linter
linter copied to clipboard
discarded_futures lint giving false positives
Describe the issue
discarded_futures giving false positives when the future is used as a class argument.
To Reproduce
Future<int> f(){
return Future.value(1);
}
Arg g(){
return Arg(f()); // Shows Error here
}
Future<void> h() async {
await g().arg; // but the future is awaited here
}
class Arg{
Arg(this.arg);
Future<int> arg;
}
But this is fine
Future<int> f(){
return Future.value(1);
}
Future<int> g(){
return f();
}
Future<void> h() async {
await g();
}
Expected behavior The lint should only happen if the future value is not awaited, returned, or passed as an argument.