Skip to content

Even more awaits v2#184552

Merged
auto-submit[bot] merged 11 commits into
flutter:masterfrom
victorsanni:more-unawaited-error-handling
Apr 8, 2026
Merged

Even more awaits v2#184552
auto-submit[bot] merged 11 commits into
flutter:masterfrom
victorsanni:more-unawaited-error-handling

Conversation

@victorsanni

Copy link
Copy Markdown
Contributor

Part of #181513

@github-actions github-actions Bot added framework flutter/packages/flutter repository. See also f: labels. f: routes Navigator, Router, and related APIs. labels Apr 3, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds missing await keywords to several asynchronous method calls within the Flutter framework and its tests, including dispose, handleRawKeyMessage, and route handling methods. The reviewer suggests using await instead of unawaited for reassembleApplication calls in test files to ensure the reassembly process is fully completed before the test continues, which would also permit the removal of the dart:async imports.

Comment thread packages/flutter/test/widgets/reassemble_test.dart
);
debugDisableShadows = false;
tester.binding.reassembleApplication();
unawaited(tester.binding.reassembleApplication());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider using await here instead of unawaited to ensure the reassemble process completes before the test continues. This is consistent with the intent of this PR and improves test reliability.

    await tester.binding.reassembleApplication();
References
  1. The Flutter style guide emphasizes optimizing for readability. Using await in tests is generally more readable and predictable than unawaited followed by pump when dealing with futures that have side effects. (link)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using await causes test failures.

);
debugDisableShadows = false;
tester.binding.reassembleApplication();
unawaited(tester.binding.reassembleApplication());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider using await here instead of unawaited to ensure the reassemble process completes before the test continues.

    await tester.binding.reassembleApplication();
References
  1. The Flutter style guide emphasizes optimizing for readability. Using await in tests is generally more readable and predictable than unawaited followed by pump when dealing with futures that have side effects. (link)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using await causes test failures.

// We need the runTest to setup the fake async in the test binding.
await binding.runTest(() async {
binding.reassembleApplication();
unawaited(binding.reassembleApplication());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider using await here instead of unawaited. Awaiting reassembleApplication ensures that all asynchronous work triggered by the reassemble is finished before calling pump.

          await binding.reassembleApplication();
References
  1. The Flutter style guide emphasizes optimizing for readability. Using await in tests is generally more readable and predictable than unawaited followed by pump when dealing with futures that have side effects. (link)

@victorsanni victorsanni added the CICD Run CI/CD label Apr 3, 2026
@github-actions github-actions Bot removed the CICD Run CI/CD label Apr 3, 2026
@victorsanni victorsanni added the CICD Run CI/CD label Apr 3, 2026
@github-actions github-actions Bot removed the CICD Run CI/CD label Apr 3, 2026
@victorsanni victorsanni added the CICD Run CI/CD label Apr 3, 2026
@victorsanni victorsanni requested a review from dkwingsmt April 3, 2026 20:23
final ControllerT controller = await createNewViewController(id);
if (!mounted) {
controller.dispose();
await controller.dispose();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might not be desirable because _createNewUiKitView's returned future is not used. I suggest process its error within _createNewUiKitView. Maybe wrap the full body within a big try and report error at the end. (Then maybe unawaited it?)

await tester.pumpWidget(const TestWidgetsApp(home: Text('Hello World')));
await tester.pump();
tester.binding.reassembleApplication();
unawaited(tester.binding.reassembleApplication());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that all usages of reassembleApplication must be unawaited in unit tests. If you're confident that this is the correct pattern, I think we should add a new method to the tester binding that performs unawaited(tester.binding.reassembleApplication()) and document its usage.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In some cases using unawaited causes test failures so I ignored instead. Should I just mark this function as awaitNotRequired?

@dkwingsmt dkwingsmt Apr 4, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am confused too. It seems to me that unawaited is equivalent to awaitNotRequired. Do you have an idea?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually the test failures weren't caused by the unawaited but by importing dart:async. I don't understand why.

It seems to me that unawaited is equivalent to awaitNotRequired. Do you have an idea?

I think if all the callsites of a function should be unawaited it's best to just apply the annotation. But for reassembleApplication there are some callsites where it is awaited?

);
debugDisableShadows = false;
tester.binding.reassembleApplication();
unawaited(tester.binding.reassembleApplication());

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using await causes test failures.

);
debugDisableShadows = false;
tester.binding.reassembleApplication();
unawaited(tester.binding.reassembleApplication());

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using await causes test failures.

final TestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.ensureInitialized();
// We need the runTest to setup the fake async in the test binding.
await binding.runTest(() async {
// ignore: unawaited_futures

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unawaited here causes failures so I replaced with ignore.

@github-actions github-actions Bot removed the CICD Run CI/CD label Apr 6, 2026
@victorsanni victorsanni requested a review from dkwingsmt April 6, 2026 21:44
@victorsanni victorsanni added the CICD Run CI/CD label Apr 6, 2026
@github-actions github-actions Bot removed the CICD Run CI/CD label Apr 7, 2026
@victorsanni victorsanni added the CICD Run CI/CD label Apr 7, 2026
dkwingsmt
dkwingsmt previously approved these changes Apr 8, 2026
@dkwingsmt dkwingsmt added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 8, 2026
@auto-submit auto-submit Bot added this pull request to the merge queue Apr 8, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Apr 8, 2026
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Apr 8, 2026
@dkwingsmt dkwingsmt added autosubmit Merge PR when tree becomes green via auto submit App CICD Run CI/CD labels Apr 8, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Apr 8, 2026
@auto-submit

auto-submit Bot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

auto label is removed for flutter/flutter/184552, Failed to enqueue flutter/flutter/184552 with HTTP 400: GraphQL mutate failed.

@Piinks Piinks mentioned this pull request Apr 8, 2026
4 tasks
@victorsanni victorsanni added autosubmit Merge PR when tree becomes green via auto submit App and removed CICD Run CI/CD labels Apr 8, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Apr 8, 2026
@auto-submit

auto-submit Bot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

auto label is removed for flutter/flutter/184552, Failed to enqueue flutter/flutter/184552 with HTTP 400: GraphQL mutate failed.

@Piinks Piinks added autosubmit Merge PR when tree becomes green via auto submit App CICD Run CI/CD labels Apr 8, 2026
@fluttergithubbot

Copy link
Copy Markdown
Contributor

An existing Git SHA, aae2c3f7b8bda6b579d996d576f6ad06c77c2d5d, was detected, and no actions were taken.

To re-trigger presubmits after closing or re-opeing a PR, or pushing a HEAD commit (i.e. with --force) that already was pushed before, push a blank commit (git commit --allow-empty -m "Trigger Build") or rebase to continue.

@github-actions github-actions Bot removed the CICD Run CI/CD label Apr 8, 2026
@eyebrowsoffire eyebrowsoffire added the CICD Run CI/CD label Apr 8, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Apr 8, 2026
@auto-submit

auto-submit Bot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

auto label is removed for flutter/flutter/184552, Failed to enqueue flutter/flutter/184552 with HTTP 400: GraphQL mutate failed.

@eyebrowsoffire

Copy link
Copy Markdown
Contributor

Sorry about the opaque error message here. I pulled from our logs and here is the error:

Pull request New changes require approval from someone other than dkwingsmt because they were the last pusher.

The next version of cocoon will have these messages inline in the failure message that autosubmit posts when it fails to enqueue the PR.

@eyebrowsoffire eyebrowsoffire added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 8, 2026
@auto-submit auto-submit Bot added this pull request to the merge queue Apr 8, 2026
Merged via the queue into flutter:master with commit a443575 Apr 8, 2026
83 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Apr 8, 2026
@victorsanni victorsanni deleted the more-unawaited-error-handling branch April 9, 2026 05:02
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 9, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Apr 9, 2026
flutter/flutter@05e0ae0...81c87ea

2026-04-09 [email protected] Remove last material dependency from cupertino tests (flutter/flutter#184781)
2026-04-09 [email protected] Roll Skia from 7c46cb639dba to 4d0f5389e131 (7 revisions) (flutter/flutter#184812)
2026-04-09 [email protected] Make `windowing_test` follow repo analyzer rules (flutter/flutter#184752)
2026-04-09 [email protected] Improve documentation of `frictionFactor` function (flutter/flutter#184509)
2026-04-09 [email protected] Roll Skia from d2b0bd12576a to 7c46cb639dba (1 revision) (flutter/flutter#184796)
2026-04-09 [email protected] Roll Fuchsia GN SDK from JLBh4Z9PKsjIJcqDU... to SEfYx3xgueX3aFAY3... (flutter/flutter#184797)
2026-04-09 [email protected] Fixed freeze flow (flutter/flutter#184793)
2026-04-09 [email protected] Roll pub packages (flutter/flutter#184795)
2026-04-09 [email protected] Roll Skia from e9ed4fc9f154 to d2b0bd12576a (36 revisions) (flutter/flutter#184791)
2026-04-08 [email protected] [Android] Allow sensitive content to gracefully fail when unregistering host before registering (flutter/flutter#184789)
2026-04-08 [email protected] Refactor: remove material from autocomplete_test, scrollable_restoration_test, semantics_tester_generate_test_semantics_expression_for_current_semantics_tree_test (flutter/flutter#184615)
2026-04-08 [email protected] Warn about the use of TestSemantics (flutter/flutter#184369)
2026-04-08 [email protected] Change freeze flow to pull_request_target (flutter/flutter#184785)
2026-04-08 [email protected] Update to the beta dart version for 3.44 branch cut.  (flutter/flutter#184770)
2026-04-08 [email protected] [Dot shorthands] Migrate examples/api/test (flutter/flutter#183966)
2026-04-08 [email protected] [fuchsia] Give AOT runners the ability to copy FFI callback thunks. (flutter/flutter#184696)
2026-04-08 [email protected] Add await or ignore lint to invokeMethod callsites (flutter/flutter#182870)
2026-04-08 [email protected] Correctly handle failure to read /proc/self/exe link (flutter/flutter#184700)
2026-04-08 [email protected] Roll Skia from e264d870a380 to e9ed4fc9f154 (11 revisions) (flutter/flutter#184713)
2026-04-08 [email protected] Roll Packages from 5299279 to 0e0a032 (5 revisions) (flutter/flutter#184720)
2026-04-08 [email protected] Roll pub packages (flutter/flutter#184772)
2026-04-08 [email protected] Roll Fuchsia Linux SDK from 1rcChbOv4nSTVkUxs... to pDXMXRIjEHTw7B0sk... (flutter/flutter#184722)
2026-04-08 [email protected] Remove navigator_utils cross-imports from cupertino tests (flutter/flutter#184282)
2026-04-08 [email protected] Even more awaits v2 (flutter/flutter#184552)
2026-04-08 [email protected] Allow personal skills to be gitignored (flutter/flutter#184727)
2026-04-08 [email protected] [ci] mac_arm64 build_test re-enable shard 1 presubmit (flutter/flutter#184751)
2026-04-08 [email protected] Fix repo check on code freeze (flutter/flutter#184771)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
mbcorona pushed a commit to mbcorona/flutter that referenced this pull request Apr 15, 2026
Part of flutter#181513

---------

Co-authored-by: Tong Mu <[email protected]>
Co-authored-by: Kate Lovett <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD f: routes Navigator, Router, and related APIs. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants