Enable `unawaited_futures` lint across the Flutter repository (#193125)
Enables the `unawaited_futures` lint rule in
`analysis_options_common.yaml` across the Flutter repository.
Closes https://github.com/flutter/flutter/issues/168555
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
diff --git a/analysis_options_common.yaml b/analysis_options_common.yaml
index 79e8ce2..976834f 100644
--- a/analysis_options_common.yaml
+++ b/analysis_options_common.yaml
@@ -207,7 +207,7 @@
- type_annotate_public_apis
- type_init_formals
- type_literal_in_constant_pattern
- # - unawaited_futures # too many false positives, especially with the way AnimationController works
+ - unawaited_futures
# - unintended_html_in_doc_comment # blocked on https://github.com/dart-lang/linter/issues/5065
# - unnecessary_async # not yet tested
- unnecessary_await_in_return
diff --git a/packages/flutter/test/analysis_options.yaml b/packages/flutter/test/analysis_options.yaml
index 1a94bdd..704c216 100644
--- a/packages/flutter/test/analysis_options.yaml
+++ b/packages/flutter/test/analysis_options.yaml
@@ -15,3 +15,7 @@
only_throw_errors: false
avoid_catches_without_on_clauses: false
avoid_catching_errors: false
+ # Material and Cupertino libraries and tests in flutter/flutter are
+ # permanently frozen, so unawaited_futures cannot be resolved in
+ # packages/flutter/test/{material,cupertino}.
+ unawaited_futures: false