site-www
site-www copied to clipboard
discarded_futures should not be necessary when the parameter expects a future
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.