Skip to content

unawaited_futures doesn't detect unawaited futures in non-async functions #58711

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

Closed
DetachHead opened this issue Apr 17, 2022 · 1 comment
Closed
Labels
devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead.

Comments

@DetachHead
Copy link

Describe the issue
if a Future is not awaited within a non-async function, the unawaited_futures warning is not triggered

To Reproduce

Future<void> foo() => throw UnimplementedError();

void syncFunction() {
  foo(); //no warning
}

Future<void> asyncFunction() async {
  foo(); //warning: `Future` results in `async` function bodies must be `await`ed or marked `unawaited` using `dart:async`
}

Expected behavior
warning when not awaiting a Future even when the function is not async, as it's just as likely to be a mistake either way

@pq
Copy link
Member

pq commented Apr 19, 2022

This has come up a bunch.

See also: #58512

@devoncarew devoncarew added devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead. labels Nov 19, 2024
@devoncarew devoncarew transferred this issue from dart-archive/linter Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead.
Projects
None yet
Development

No branches or pull requests

3 participants