Skip to content

[vector_graphics] Don't report a handled loading error as unhandled - #13315

Merged
auto-submit[bot] merged 1 commit into
flutter:mainfrom
mtallenca:fix/vector-graphics-unhandled-load-error
Oct 19, 2026
Merged

auto-submit[bot] merged 1 commit into
flutter:mainfrom
mtallenca:fix/vector-graphics-unhandled-load-error

Conversation

@mtallenca

Copy link
Copy Markdown
Contributor

_VectorGraphicWidgetState._loadPicture registers result.whenComplete(...) to clear _pendingPictures, and drops the future that whenComplete returns. That future completes with result's error and nothing listens to it, so every asynchronous loading failure — an asset whose fetch fails on web when the network drops, for instance — is reported to the zone as unhandled, even though _loadAssetBytes catches the same error and errorBuilder shows it. Crash reporters record these as fatal.

The dropped future is now .ignore()d. result itself is unchanged, so _loadAssetBytes still sees the error and shows errorBuilder as before.

The existing can handle errors from bytes loader test didn't catch this because its loader throws synchronously, before whenComplete is reached. The new test uses a loader whose loadBytes is async; it fails without the fix with the UnimplementedError reported by the test framework.

Fixes flutter/flutter#194705.

Pre-Review Checklist

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2

_loadPicture's whenComplete returns a future carrying the load's error that
nothing listens to, so an asynchronous loading failure (an asset that fails
to load, for instance) is reported to the zone as unhandled even though
_loadAssetBytes catches it and errorBuilder shows it.
@github-actions github-actions Bot added p: vector_graphics triage-engine Should be looked at in engine triage labels Oct 19, 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 addresses an issue where asynchronous loading failures in VectorGraphic were reported as unhandled exceptions. The fix applies .ignore() to the future returned by result.whenComplete in vector_graphics.dart. The changes also include a new widget test to verify asynchronous error handling, a mock AsyncThrowingBytesLoader, and a version bump to 1.2.4 in pubspec.yaml and CHANGELOG.md. There are no review comments, and I have no feedback to provide.

@gaaclarke gaaclarke added the CICD Run CI/CD label Oct 19, 2026
@gaaclarke
gaaclarke requested a review from b-luk October 19, 2026 20:03
@b-luk

b-luk commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Thanks, @mtallenca. Sending to @gaaclarke for second review.

@b-luk
b-luk requested a review from gaaclarke October 19, 2026 21:32

@gaaclarke gaaclarke left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm!

@gaaclarke gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 19, 2026
@auto-submit
auto-submit Bot merged commit efedf51 into flutter:main Oct 19, 2026
13 checks passed
bkonyi pushed a commit to bkonyi/flutter that referenced this pull request Oct 20, 2026
flutter/packages@10a178c...618afba

2026-10-20 [email protected] [pigeon] add version checking for
objective_c and jni dependencies (flutter/packages#13283)
2026-10-19 [email protected] [go_router_builder] Adopt
shared analyzer helpers from source_helper: ^1.4.0
(flutter/packages#13337)
2026-10-19 [email protected] [pigeon] fix instance manager test flake
(flutter/packages#13303)
2026-10-19 [email protected] [vector_graphics] Don't report a handled
loading error as unhandled (flutter/packages#13315)
2026-10-19 [email protected] [file_selector_macos] Drop deprecated
allowedFileTypes code path (flutter/packages#13302)
2026-10-19 [email protected] [shared_preferences_android] Update
androidx.datastore:datastore to 1.2.1 (flutter/packages#13334)
2026-10-19 [email protected] [in_app_purchase_storekit] Suppress
StoreKit 1 deprecation warnings (flutter/packages#13301)
2026-10-19 [email protected] [camera_avfoundation] Fix Swift analyzer
issue _captureSessionQueue (flutter/packages#13332)
2026-10-19 [email protected] [material_ui]
Unskip web tests that pass on CanvasKit and Skwasm: color_scheme_test,
elevated_button_test, filled_button_test, icon_button_test
(flutter/packages#13327)
2026-10-19 [email protected] [in_app_purchase_android] Update
to Play Billing Library 9.1.0 (flutter/packages#12781)
2026-10-19 [email protected] [webview_flutter_wkwebview] Require iOS 15
/ macOS 12 and drop deprecated SecTrustGetCertificateAtIndex code path
(flutter/packages#13294)

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

To file a bug in Flutter:
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
suryaKommana2662 pushed a commit to suryaKommana2662/flutter that referenced this pull request Oct 29, 2026
flutter/packages@10a178c...618afba

2026-10-20 [email protected] [pigeon] add version checking for
objective_c and jni dependencies (flutter/packages#13283)
2026-10-19 [email protected] [go_router_builder] Adopt
shared analyzer helpers from source_helper: ^1.4.0
(flutter/packages#13337)
2026-10-19 [email protected] [pigeon] fix instance manager test flake
(flutter/packages#13303)
2026-10-19 [email protected] [vector_graphics] Don't report a handled
loading error as unhandled (flutter/packages#13315)
2026-10-19 [email protected] [file_selector_macos] Drop deprecated
allowedFileTypes code path (flutter/packages#13302)
2026-10-19 [email protected] [shared_preferences_android] Update
androidx.datastore:datastore to 1.2.1 (flutter/packages#13334)
2026-10-19 [email protected] [in_app_purchase_storekit] Suppress
StoreKit 1 deprecation warnings (flutter/packages#13301)
2026-10-19 [email protected] [camera_avfoundation] Fix Swift analyzer
issue _captureSessionQueue (flutter/packages#13332)
2026-10-19 [email protected] [material_ui]
Unskip web tests that pass on CanvasKit and Skwasm: color_scheme_test,
elevated_button_test, filled_button_test, icon_button_test
(flutter/packages#13327)
2026-10-19 [email protected] [in_app_purchase_android] Update
to Play Billing Library 9.1.0 (flutter/packages#12781)
2026-10-19 [email protected] [webview_flutter_wkwebview] Require iOS 15
/ macOS 12 and drop deprecated SecTrustGetCertificateAtIndex code path
(flutter/packages#13294)

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

To file a bug in Flutter:
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App CICD Run CI/CD p: vector_graphics triage-engine Should be looked at in engine triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[vector_graphics] A failed asynchronous load is reported as unhandled even when errorBuilder handles it

3 participants