lints
lints copied to clipboard
Consider `unawaited_futures` for inclusion
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
andAnimationController
methods, maybe others)
+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.
@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.
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.
Corresponding issue to discussion an annotation in pkg:meta
here: https://github.com/dart-lang/sdk/issues/46218.
https://api.dart.dev/stable/2.14.4/dart-async/unawaited.html
@pq to create a proposal for how this would work