Skip to content

[unawaited_futures] Special-case future.then((_) => completer.complete[Error](...)) #57784

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

Open
ochafik opened this issue Sep 4, 2018 · 4 comments
Labels
area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. devexp-linter Issues with the analyzer's support for the linter package linter-false-positive P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@ochafik
Copy link
Contributor

ochafik commented Sep 4, 2018

This is one of the obvious cases that don't need to be awaited, which I originally intended to add to https://github.com/dart-lang/linter/blob/master/lib/src/rules/unawaited_futures.dart#L83 but was too lazy.

Turns out this is a frequent use-case for the new unawaited helper from https://github.com/dart-lang/pedantic, so would justify the extra work IMO.

@davidmorgan WDYT?

@davidmorgan
Copy link
Contributor

I don't feel strongly about it. In the one example I've seen it's actually nice to have use of futures inside an async block highlighted with 'unawaited'; it feels like this should be quite rare. But I don't have a lot of evidence for that...

@rkj
Copy link

rkj commented Sep 7, 2018

Given this advice:
https://www.dartlang.org/guides/language/effective-dart/usage#prefer-asyncawait-over-using-raw-futures
I feel like the then syntax should be changed to await, or async removed from the method annotation.

@matanlurey
Copy link
Contributor

Using future.then in an async { ... } function just seems wrong.

If it is intentional, unawaited(...) seems entirely appropriate and worth the boiler-plate.

@srawlins srawlins added the P3 A lower priority bug or feature request label Sep 22, 2022
@srawlins srawlins added the type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) label Mar 29, 2024
@srawlins
Copy link
Member

Future.whenComplete is another case. #57400

@devoncarew devoncarew added devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead. labels Nov 18, 2024
@devoncarew devoncarew transferred this issue from dart-archive/linter Nov 18, 2024
@bwilkerson bwilkerson added area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. and removed legacy-area-analyzer Use area-devexp instead. labels Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. devexp-linter Issues with the analyzer's support for the linter package linter-false-positive P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

7 participants