Summary
Part of umbrella issue #149031.
Support content-hashing static assets (images, fonts, JSON configs, shaders) placed under assets/ when building Flutter Web with --web-content-hash.
Scope & Requirements
- Compute SHA-256 content hashes for asset files during
flutter build web --web-content-hash.
- Rename physical files in
build/web/assets/ to include content hashes (e.g. assets/images/dash.a1b2c3d4.png).
- Update the target path mappings in
AssetManifest.bin / AssetManifest.json and FontManifest.json.
- Keep asset lookup keys in user Dart code unchanged (
rootBundle.load('assets/images/dash.png')).
- Enable long-term
Cache-Control: max-age=31536000, immutable caching on all static assets under assets/.
Summary
Part of umbrella issue #149031.
Support content-hashing static assets (images, fonts, JSON configs, shaders) placed under
assets/when building Flutter Web with--web-content-hash.Scope & Requirements
flutter build web --web-content-hash.build/web/assets/to include content hashes (e.g.assets/images/dash.a1b2c3d4.png).AssetManifest.bin/AssetManifest.jsonandFontManifest.json.rootBundle.load('assets/images/dash.png')).Cache-Control: max-age=31536000, immutablecaching on all static assets underassets/.