Skip to content

Fixes future warning for awaiting Future returns in async bodies inside try blocks#182301

Merged
auto-submit[bot] merged 4 commits intoflutter:masterfrom
FMorschel:await
Feb 27, 2026
Merged

Fixes future warning for awaiting Future returns in async bodies inside try blocks#182301
auto-submit[bot] merged 4 commits intoflutter:masterfrom
FMorschel:await

Conversation

@FMorschel
Copy link
Contributor

This is merely an analyzer change to avoid the bug explained at:

This will allow the development of a warning about these situations so we can avoid this bug in the future.

Pre-launch Checklist

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@github-actions github-actions bot added engine flutter/engine related. See also e: labels. platform-web Web applications specifically labels Feb 12, 2026
@stuartmorgan-g
Copy link
Contributor

test-exempt: unblocks future analyzer update

Copy link
Contributor

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

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 await keywords to return statements within try blocks in async functions. Specifically, it modifies instantiateImageCodecWithSize in painting.dart and fetchImage in canvaskit/image.dart. These changes ensure that if a returned Future completes with an error, it is correctly handled by the surrounding try-catch or try-finally blocks, preventing potential resource leaks or unhandled exceptions.

@FMorschel
Copy link
Contributor Author

It has been two weeks since this was opened. When will this be assigned to a reviewer, @stuartmorgan-g? Do I need to do anything else?

@stuartmorgan-g
Copy link
Contributor

When will this be assigned to a reviewer, @stuartmorgan-g?

I don't run any of the flutter/flutter PR triages, so I'm not sure why that question is directed to me.

@FMorschel
Copy link
Contributor Author

I'm not sure why that question is directed to me.

Sorry! I wasn't aware. I only asked you because you gave this PR the test exemption.

In that case, I'll wait a bit longer, and if nobody answers, I'll ask over on Discord.

Copy link
Contributor

@mdebbar mdebbar left a comment

Choose a reason for hiding this comment

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

Thank you!

@flutter-zl flutter-zl assigned flutter-zl and unassigned flutter-zl Feb 24, 2026
@flutter-zl flutter-zl self-requested a review February 24, 2026 17:44
Copy link
Contributor

@flutter-zl flutter-zl left a comment

Choose a reason for hiding this comment

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

LGTM

@FMorschel
Copy link
Contributor Author

Thanks @mdebbar and @flutter-zl! Any ideas on when this will land on master? Do I need to do anything else here? Thanks!

@flutter-zl
Copy link
Contributor

Thanks @mdebbar and @flutter-zl! Any ideas on when this will land on master? Do I need to do anything else here? Thanks!

You can click the "Merge when ready" button. All checks have passed.

@FMorschel
Copy link
Contributor Author

image

Would it be here? I don't have that.

@mdebbar mdebbar added the autosubmit Merge PR when tree becomes green via auto submit App label Feb 26, 2026
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Feb 26, 2026
@auto-submit
Copy link
Contributor

auto-submit bot commented Feb 26, 2026

autosubmit label was removed for flutter/flutter/182301, because The base commit of the PR is older than 7 days and can not be merged. Please merge the latest changes from the main into this branch and resubmit the PR.

@mdebbar mdebbar added the autosubmit Merge PR when tree becomes green via auto submit App label Feb 26, 2026
@FMorschel
Copy link
Contributor Author

Thanks a lot!

@mdebbar
Copy link
Contributor

mdebbar commented Feb 26, 2026

@FMorschel please don't use the "Merge when ready" button, even if you have it. The right way to submit PRs is to add the autosubmit label.

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Feb 26, 2026
@auto-submit
Copy link
Contributor

auto-submit bot commented Feb 26, 2026

autosubmit label was removed for flutter/flutter/182301, because - The status or check suite Linux tool_integration_tests_3_7 has failed. Please fix the issues identified (or deflake) before re-applying this label.

  • The status or check suite Linux docs_test has failed. Please fix the issues identified (or deflake) before re-applying this label.

@flutter-dashboard
Copy link

CI had a failure that stopped further tests from running. We need to investigate to determine the root cause.

SHA at time of execution: 8984475.

Possible causes:

  • Configuration Changes: The .ci.yaml file might have been modified between the creation of this pull request and the start of this test run. This can lead to ci yaml validation errors.
  • Infrastructure Issues: Problems with the CI environment itself (e.g., quota) could have caused the failure.

A blank commit, or merging to head, will be required to resume running CI for this PR.

Error Details:

GitHub Error: You have exceeded a secondary rate limit. Please wait a few minutes before you try again. For more on scraping GitHub and how it may affect your rights, please review our Terms of Service (https://docs.github.com/en/site-policy/github-terms/github-terms-of-service) If you reach out to GitHub Support for help, please include the request ID B1DC:1CEB51:75A993:1FDE577:69A0BE43.

Stack trace:

#0      GitHub.handleStatusCode (package:github/src/common/github.dart:486:5)
#1      GitHub.request (package:github/src/common/github.dart:422:7)
<asynchronous suspension>
#2      GitHub.requestJson (package:github/src/common/github.dart:323:22)
<asynchronous suspension>
#3      RetryOptions.retry (package:retry/retry.dart:131:16)
<asynchronous suspension>
#4      LuciBuildService.scheduleTryBuilds (package:cocoon_service/src/service/luci_build_service.dart:271:26)
<asynchronous suspension>
#5      Scheduler._runCiTestingStage (package:cocoon_service/src/service/scheduler.dart:1337:9)
<asynchronous suspension>
#6      Scheduler.proceedToCiTestingStage (package:cocoon_service/src/service/scheduler.dart:1388:7)
<asynchronous suspension>
#7      Scheduler._closeSuccessfulEngineBuildStage (package:cocoon_service/src/service/scheduler.dart:1203:5)
<asynchronous suspension>
#8      Scheduler.processCheckRunCompleted (package:cocoon_service/src/service/scheduler.dart:1149:11)
<asynchronous suspension>
#9      PresubmitLuciSubscription.post (package:cocoon_service/src/request_handlers/presubmit_luci_subscription.dart:148:9)
<asynchronous suspension>
#10     RequestHandler.service (package:cocoon_service/src/request_handling/request_handler.dart:45:20)
<asynchronous suspension>
#11     SubscriptionHandler.service (package:cocoon_service/src/request_handling/subscription_handler.dart:140:5)
<asynchronous suspension>
#12     createServer.<anonymous closure> (package:cocoon_service/server.dart:413:7)
<asynchronous suspension>

@mdebbar mdebbar added the autosubmit Merge PR when tree becomes green via auto submit App label Feb 27, 2026
@auto-submit auto-submit bot added this pull request to the merge queue Feb 27, 2026
Merged via the queue into flutter:master with commit b31c97c Feb 27, 2026
183 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Feb 27, 2026
@FMorschel FMorschel deleted the await branch February 27, 2026 18:51
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 28, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 28, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 1, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 1, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 2, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 2, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 2, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 2, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 2, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 2, 2026
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Mar 2, 2026
Roll Flutter from 1141b2bdce66 to 46fb7210422d (38 revisions)

flutter/flutter@1141b2b...46fb721

2026-03-02 [email protected] [rules] Fix a few issues in the full-length rules file (flutter/flutter#182725)
2026-03-02 [email protected] Roll Dart SDK from 8063f5f5ac60 to e86dbe9aa742 (1 revision) (flutter/flutter#183120)
2026-03-02 [email protected] [web] Roll Chrome to 145 (flutter/flutter#182860)
2026-03-02 [email protected] Roll Skia from 61c0e71760f5 to e180358b7a7a (1 revision) (flutter/flutter#183118)
2026-03-02 [email protected] Roll Packages from a27d7c5 to faa4e22 (4 revisions) (flutter/flutter#183117)
2026-03-02 [email protected] Add information to issue triage page (flutter/flutter#182145)
2026-03-02 [email protected] Roll Skia from cc8ce92481f2 to 61c0e71760f5 (2 revisions) (flutter/flutter#183103)
2026-03-02 [email protected] Roll Skia from 4cf3cd27b620 to cc8ce92481f2 (1 revision) (flutter/flutter#183100)
2026-03-02 [email protected] Roll Fuchsia Linux SDK from zN2ZV9QD0LD8acUFF... to 0dCDM2oORHwDf_pyb... (flutter/flutter#183101)
2026-03-01 [email protected] Update fl_texture_gl.h (flutter/flutter#182999)
2026-03-01 [email protected] Roll Skia from be1362b5ca4e to 4cf3cd27b620 (1 revision) (flutter/flutter#183096)
2026-03-01 [email protected] Roll Skia from b9210eb7005f to be1362b5ca4e (1 revision) (flutter/flutter#183092)
2026-03-01 [email protected] Timeout when waiting for the correct sized frame from Flutter. (flutter/flutter#182971)
2026-03-01 [email protected] Roll Skia from 28172a4e03af to b9210eb7005f (1 revision) (flutter/flutter#183088)
2026-03-01 [email protected] Roll Fuchsia Linux SDK from D7IYacJUCpvc_1iU_... to zN2ZV9QD0LD8acUFF... (flutter/flutter#183076)
2026-02-28 [email protected] Roll Dart SDK from cdf45eaf995e to 8063f5f5ac60 (1 revision) (flutter/flutter#183064)
2026-02-28 [email protected] Roll Dart SDK from 54451fcdbcf9 to cdf45eaf995e (1 revision) (flutter/flutter#183057)
2026-02-28 [email protected] Roll Skia from c8bcc27f5319 to 28172a4e03af (3 revisions) (flutter/flutter#183056)
2026-02-28 [email protected] Roll Dart SDK from 148d91b8a603 to 54451fcdbcf9 (2 revisions) (flutter/flutter#183051)
2026-02-28 [email protected] [A11y] in calendar date picker, remove SemanticsService.sendAnnouncement usage for android.  (flutter/flutter#182918)
2026-02-28 [email protected] Add desktop review teams (flutter/flutter#182972)
2026-02-28 [email protected] [framework] Fix Text.semanticsIdentifier being absorbed by ancestor nodes (flutter/flutter#181795)
2026-02-28 [email protected] Roll Skia from b150186d3e23 to c8bcc27f5319 (5 revisions) (flutter/flutter#183032)
2026-02-28 [email protected] [Impeller] For Android hardware buffers on Vulkan, use an alpha value of 1 if the buffer format always has opaque alpha (flutter/flutter#182974)
2026-02-27 [email protected] Adds float32 output to `Image.toByteData()` in float32 Image (flutter/flutter#182847)
2026-02-27 [email protected] Roll Dart SDK from 1cdb7dfd913e to 148d91b8a603 (1 revision) (flutter/flutter#183025)
2026-02-27 [email protected] Roll Fuchsia Linux SDK from G1GwOdVt5bM7GjMSY... to D7IYacJUCpvc_1iU_... (flutter/flutter#183021)
2026-02-27 [email protected] When impellerc fails with a long shader compilation error, truncate it and output to a file (flutter/flutter#182786)
2026-02-27 [email protected] Add missing mutation-safe delegate iteration and use idomatic syntax (flutter/flutter#183018)
2026-02-27 [email protected] Exclude arm64 if any dependencies do and print warning when using Xcode 26 (flutter/flutter#182913)
2026-02-27 [email protected] Ignore unawaited_futures lint in dev/automated_tests (flutter/flutter#182922)
2026-02-27 [email protected] licenses_cpp: pre-land changes for perfetto update (flutter/flutter#182965)
2026-02-27 [email protected] Re-add extended attribute removed by SwiftPM (flutter/flutter#183011)
2026-02-27 [email protected] Fixes future warning for `await`ing `Future` returns in `async` bodies inside `try` blocks (flutter/flutter#182301)
2026-02-27 [email protected] Roll Skia from ed220c490eea to b150186d3e23 (2 revisions) (flutter/flutter#183014)
2026-02-27 [email protected] Fix issue where web embedder is synthesizing key up events too eagerly (flutter/flutter#180692)
2026-02-27 [email protected] chore: Don't unconditionally check tools/gn formatting (flutter/flutter#182973)
2026-02-27 [email protected] Roll Packages from e1d0169 to a27d7c5 (8 revisions) (flutter/flutter#183009)

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
...
xxxOVALxxx pushed a commit to xxxOVALxxx/flutter that referenced this pull request Mar 10, 2026
…s inside `try` blocks (flutter#182301)

<!--
Thanks for filing a pull request!
Reviewers are typically assigned within a week of filing a request.
To learn more about code review, see our documentation on Tree Hygiene:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
-->

This is merely an `analyzer` change to avoid the bug explained at:

- dart-lang/sdk#62555.

This will allow the development of a warning about these situations so
we can avoid this bug in the future.

## 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.
- [ ] 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].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

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

Labels

engine flutter/engine related. See also e: labels. platform-web Web applications specifically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants