-
Notifications
You must be signed in to change notification settings - Fork 1.7k
update discarded_futures lint rule to not trigger when a widget expect a futur #59455
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
Comments
The If you expected another behavior (likely, since the name suggests a different behavior), then this is not the lint for you. |
let me rephrase. |
The The lint is for people who buy in to the idea that all async operations should happen in You may not agree with that sentiment. I don't, so I don't use that lint. You can write perfectly good programs where you call asynchronous functions in non- If you only rarely do something that triggers the lint, and want to keep that code as is, it's easy to add an If you do it often, the lint stops being useful for you. The cost outweighs the benefits. And that's fine. I'm not sure I would call your case it a "false positive", as much as code where the underlying assumption of the lint just doesn't apply. It's not a false positive under the assumption that all asynchronous-function-calling functions should be If you want the lint to accept your code, it's because you want a different lint. (I'm quite willing to discuss the design of the lint, how it only applies to function calls and not other ways to create a future, and whether it was a good idea to begin with, but given the specified design, I think it's working as intended here. It may just not be a lint for you. And the name is misleading.) |
How can I make the code provided valid and without the lint to complain (no ignore)? I'm missing something. If it's not possible and the https://dart.dev/tools/linter-rules/avoid_void_async |
I am not familiar with |
btw
|
Steps to reproduce
in the following code:
I get the following warning:
but
future
is expecting aFuture<List<DirectoryTree>>?
so this warning doesn't make sense in that case.I will not await the futur.
So
discarded_futures
lint rule should be updated to allow this use case.Expected results
see up
Actual results
see up
Code sample
Code sample
[Paste your code here]
Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[Paste your logs here]
Flutter Doctor output
Doctor output
The text was updated successfully, but these errors were encountered: