Repository navigation
[flutter_svg] Stabilize network SVG cache keys - #13597
Conversation
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
ff3226c to
106336f
Compare
…network-keys # Conflicts: # third_party/packages/flutter_svg/CHANGELOG.md # third_party/packages/flutter_svg/pubspec.yaml
…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
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 analyzepassed; completeflutter testpassed (82 passed, one existing skip); formatting andgit diff --checkpassed. 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
[shared_preferences]///).