Skip to content

[flutter_svg] Stabilize network SVG cache keys - #13597

Merged
auto-submit[bot] merged 5 commits into
flutter:mainfrom
palmoni5:codex/upstream-svg-network-keys
Nov 19, 2026
Merged

auto-submit[bot] merged 5 commits into
flutter:mainfrom
palmoni5:codex/upstream-svg-network-keys

Conversation

@palmoni5

@palmoni5 palmoni5 commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Equivalent newly allocated HTTP header maps currently miss the compiled SVG cache. Compare headers by value, and snapshot headers in cache keys so caller mutation cannot corrupt retained entries. HTTP clients stay out of equality and hashing, as before. The const loader constructor is preserved.

Addresses the header equality bug reported in flutter/flutter#158818 (the report is closed, but this behavior remains in current main). Tests cover header order, distinct authorization values, mutation and eviction, concurrent de-duplication, and theme isolation.

Validation on Windows: flutter analyze passed; complete flutter test passed (82 passed, one existing skip); formatting and git diff --check passed. Existing golden tolerances reported small platform differences; no golden files were updated.

Merged with main (ca0a2d3) and bumped flutter_svg to 2.4.1, above the 2.4.0 entry from #13596. Analyze and the complete test suite pass after the merge (89 passed, one existing skip).

Overlap with open PRs: #12808, #13599, #13600, and #13628 conflict only in release metadata. #13598 also conflicts in loaders.dart. The current heads of #13596 and #13613 conflict in cache.dart against the main changes included here.

AI-assisted; independently checked with focused and complete tests. CLA status is left for the contributor/CLA bot to verify.

Pre-Review Checklist

@github-actions github-actions Bot added p: flutter_svg triage-engine Should be looked at in engine triage labels Nov 9, 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 introduces a stable _NetworkLoaderCacheKey class to snapshot network cache lookups in SvgNetworkLoader, ensuring header values are compared and mutable headers are snapshotted correctly. It also adds comprehensive unit tests for network cache keys. Feedback suggests caching the computed hash code in _NetworkLoaderCacheKey to optimize performance by avoiding redundant calculations during widget rebuilds.

@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 updates flutter_svg to version 2.3.3, introducing stable cache keys for network lookups via _NetworkLoaderCacheKey. It ensures that HTTP header maps are compared by value regardless of insertion order, snapshots mutable headers using unmodifiable maps, and distinguishes explicitly supplied HTTP clients using identity hashing. Additionally, a comprehensive suite of unit tests has been added to verify these caching behaviors. There are no review comments to address.

@palmoni5
palmoni5 force-pushed the codex/upstream-svg-network-keys branch from ff3226c to 106336f Compare November 11, 2026 21:23
@gaaclarke
gaaclarke self-requested a review November 16, 2026 19:24

@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.

mostly looks good

@palmoni5
palmoni5 requested a review from gaaclarke November 19, 2026 18:59
…network-keys

# Conflicts:
#	third_party/packages/flutter_svg/CHANGELOG.md
#	third_party/packages/flutter_svg/pubspec.yaml
@gaaclarke gaaclarke added the CICD Run CI/CD label Nov 19, 2026

@andywolff andywolff left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM too

@gaaclarke gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 19, 2026
@auto-submit
auto-submit Bot merged commit d771bf1 into flutter:main Nov 19, 2026
15 checks passed
@palmoni5
palmoni5 deleted the codex/upstream-svg-network-keys branch November 19, 2026 21:18
opensource-fork-sync Bot pushed a commit to cla7aye15I4nd/opensource-flutter__flutter that referenced this pull request Nov 20, 2026
…er#197056)

flutter/packages@81b7c44...898818d

2026-11-20 [email protected] [material_ui] Use correct time format for
Sinhala locale (flutter/packages#13645)
2026-11-20 [email protected] [material_ui]
Fix showModalBottomSheet safe area on display-feature sub-screens
(flutter/packages#13428)
2026-11-20 [email protected] [material_ui]
Fix M3 doc errors in the `ElevatedButton` and `FilledButton`
(flutter/packages#13685)
2026-11-19 [email protected] [video_player] Convert implementation
to Kotlin (flutter/packages#13683)
2026-11-19 [email protected] [flutter_svg] Add
SvgLoader.provideSvgInIsolate for unsendable loaders
(flutter/packages#13598)
2026-11-19 [email protected] [VPAT] Expose modal drawers with the
dialog semantics role (flutter/packages#13660)
2026-11-19 [email protected] [VPAT] Keep a11y_assessments tooltips
open while hovered (flutter/packages#13657)
2026-11-19 [email protected] [flutter_svg] Stabilize network SVG cache
keys (flutter/packages#13597)
2026-11-19 [email protected]
[image_picker_ios] Return an error instead of an empty file when an
image cannot be saved (flutter/packages#12998)
2026-11-19 [email protected] [cupertino_ui]
Fix CupertinoNavigationBarBackButton assertion debug
(flutter/packages#13397)
2026-11-19 [email protected] [go_router] Document when
GoRouterState.name and path are null (flutter/packages#13486)

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: flutter_svg triage-engine Should be looked at in engine triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants