Skip to content
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 should not be necessary when the parameter expects a future #6111

Open
1 task
bsz0206 opened this issue Sep 26, 2024 · 0 comments
Open
1 task
Labels
from.page-issue Reported in a reader-filed concern

Comments

@bsz0206
Copy link

bsz0206 commented Sep 26, 2024

Page URL

https://dart.dev/tools/linter-rules/discarded_futures.html

Page source

https://github.com/dart-lang/site-www/tree/main/src/content/tools/linter-rules/individual-rules.md

Describe the problem

In the following example:
FutureBuilder(
future: AFutureFunctionCall(),
builder: (context, snapshot) { ... }
)
where lints have discarded_futures: true
Error:
Asynchronous function invoked in a non-'async' function. Try converting the enclosing function to be 'async' and then 'await' the future.

and then we have to use
FutureBuilder(
// ignore: discarded_futures
future: AFutureFunctionCall(),

while this is not really expected. The original error does not seem to be right.

Expected fix

The warning is not wrong

Additional context

No response

I would like to fix this problem.

  • I will try and fix this problem on dart.dev.
@bsz0206 bsz0206 added the from.page-issue Reported in a reader-filed concern label Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
from.page-issue Reported in a reader-filed concern
Projects
None yet
Development

No branches or pull requests

1 participant