Repository navigation
Commit efedf51
authored
[vector_graphics] Don't report a handled loading error as unhandled (flutter#13315)
`_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
[^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.1 parent f2c6798 commit efedf51
4 files changed
Lines changed: 39 additions & 3 deletions
File tree
- packages/vector_graphics
- lib/src
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
382 | 382 | | |
383 | 383 | | |
384 | 384 | | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
385 | 388 | | |
386 | 389 | | |
387 | | - | |
| 390 | + | |
388 | 391 | | |
389 | 392 | | |
390 | 393 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
773 | 773 | | |
774 | 774 | | |
775 | 775 | | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
776 | 798 | | |
777 | 799 | | |
778 | 800 | | |
| |||
848 | 870 | | |
849 | 871 | | |
850 | 872 | | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
0 commit comments