-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
discarded_futures
lint discussion
#59887
Comments
Just to keep things in one place. The current CL fixes all of the above issues. I'll read through https://gist.github.com/lrhn/0316c1c6c5102dc900d635d08ec31188 and see if there is any missing test here. I'll also address to the linter/analyzer team the following question: With the current changes, if the |
One more issue that is a duplicate from the list above #59949. |
To note:
I'd appreciate some inputs here @pq. |
My quick 2 cents:
My gut says if this route is considered valuable we could explore updating
I'm not sure either. I'd be curious, in practice, if this happens a lot. The downside to a blanket special-case is that we may miss flagging unintended behavior. I wonder if a more principled approach might be something along the lines of function-side opt outs as discussed for |
After some discussion over at #59877, #59331 and #58747, I've seen many users expecting
discarded_futures
to work similarly tounawaited_futures
but inside synchronous code.That is, inside synchronous code, if the
Future
is assigned to something that explicitly asks for aFuture
, do nothing, if not, trigger.That would solve all of these duplicates that expect the lint not to warn when using it on
FutureBuilder
from Flutter for example:discarded_futures
lint #58889discarded_futures
: Unwaited return for when Future is expected #59331Making the behaviour match
unawaited_futures
would also probably fix: #59204.I've opened https://dart-review.googlesource.com/c/sdk/+/403901 and I've made some changes to address this assignability issue, but @lrhn commented on the CL:
I'm opening this issue to track this discussion and hopefully to make that change.
// CC @lrhn @pq
The text was updated successfully, but these errors were encountered: