lints icon indicating copy to clipboard operation
lints copied to clipboard

Consider `unawaited_futures` for inclusion

Open mit-mit opened this issue 3 years ago • 6 comments

We had initially selected unawaited_futures for inclusion in core lints, however ran into some issues that need resolving first, including:

  • [ ] https://github.com/dart-lang/linter/issues/2513, Method-side opt-out for unawaited_futures
  • [x] https://github.com/dart-lang/linter/issues/2522, Move unawaited to package:meta
  • [ ] Enable the lint in the flutter codebase for dogfooding (opting out some Navigator and AnimationController methods, maybe others)

mit-mit avatar May 12 '21 10:05 mit-mit

+1 on adding a method side opt out for unawaited_futures. We see a very large # of calls to unawaited in g3 (about 10% of all calls to awaited). Likely a small # of method side opt outs can reduce this # significantly.

jacob314 avatar Jun 02 '21 18:06 jacob314

@goderbauer: do any Flutter APIs spring to mind that you'd want to tag as unwaitable? it'd be handy to have some concrete examples to drive the discussion.

pq avatar Jun 02 '21 18:06 pq

The Future-returning APIs on AnimationController and Navigator are the most common examples, things like AnimationController.forward() / AnimationController.reverse() and Navigator.push() as well as its similarly named friends.

goderbauer avatar Jun 02 '21 18:06 goderbauer

Corresponding issue to discussion an annotation in pkg:meta here: https://github.com/dart-lang/sdk/issues/46218.

pq avatar Jun 02 '21 19:06 pq

https://api.dart.dev/stable/2.14.4/dart-async/unawaited.html

natebosch avatar Nov 05 '21 15:11 natebosch

@pq to create a proposal for how this would work

mit-mit avatar Jan 11 '22 19:01 mit-mit