Repository navigation
Closed
Labels
a.faqRelates to the FAQ section of Flutter.devRelates to the FAQ section of Flutter.deva.rn.release-notesRelates to Flutter release notes found on docs.flutter.devRelates to Flutter release notes found on docs.flutter.devd.new-featureAdds new Flutter contentAdds new Flutter contentdev.deploymentRelates to deploying Flutter app section of Flutter.devRelates to deploying Flutter app section of Flutter.deve1-hoursEffort: < 8 hrsEffort: < 8 hrsfrom.teamReported by Dash docs team memberReported by Dash docs team memberp1-highMajor but not urgent concern: Resolve in months. Update each month.Major but not urgent concern: Resolve in months. Update each month.target.webTarget apps on the web platformTarget apps on the web platform
Description
Note
Target Release: Flutter 3.50 (Q4 2026 Stable)
All implementation phases for flutter build web --web-content-hash (Umbrella: flutter/flutter#149031) have landed for Flutter 3.50:
- Phase 1 (Hashed entrypoints
main.dart.<hash>.{js,wasm,mjs}): flutter/flutter#190153, flutter/flutter#192663 - Phase 2 (Hashed physical assets under
build/web/assets/**+AssetManagerlookup): flutter/flutter#191919 - Phase 3 (
build/web/precache_manifest.jsonBOM): flutter/flutter#192953 - Phase 2.5 (100%
build/web/assets/**immutability including manifests,NOTICES, andshaders/**via_flutter.buildConfig.extraAssets, plus public--[no-]web-content-hashCLI flag): flutter/flutter#193040, flutter/flutter#193614
Page URL
- https://docs.flutter.dev/deployment/web
- https://docs.flutter.dev/platform-integration/web/faq
- https://docs.flutter.dev/platform-integration/web/initialization
Problem
With flutter build web --web-content-hash shipping in Flutter 3.50 (flutter/flutter#149031), the Flutter Web deployment and FAQ pages need to be updated (cc @parlough @sfshaza2):
- Outdated FAQ statement:
sites/docs/src/content/platform-integration/web/faq.md#L180-L181still states "Flutter doesn't currently support appending build IDs to resources automatically" and only shows the unhashedmax-age=0, must-revalidatefirebase.jsonrule (L197-L229). - Missing
--web-content-hash,Cache-Control, Overlay Deployment, andprecache_manifest.jsonguidance:sites/docs/src/content/deployment/web.mddoes not yet document--web-content-hash, splitCache-Controlrules for hashed vs. unhashed files, overlay deployments across releases, or custom service worker integration viaprecache_manifest.json.
Detailed page breakdown & affected targets (AI-assisted)
Proposed Content
1. sites/docs/src/content/platform-integration/web/faq.md (https://docs.flutter.dev/platform-integration/web/faq)
- Replace
L180-L181("Flutter doesn't currently support appending build IDs to resources automatically") with guidance on runningflutter build web --web-content-hash, which automatically embeds 8-character truncated SHA-256 content hashes into compiled entrypoints (main.dart.<hash>.js,.wasm,.mjs), JS source maps (main.dart.<hash>.js.map,main.dart.<hash>.mjs.mapwhen--source-mapsis enabled), and 100% of files underbuild/web/assets/**(includingAssetManifest.<hash>.bin,FontManifest.<hash>.json,NOTICES.<hash>, andshaders/**, with transparent runtime resolution inAssetManagerand_flutter.buildConfig.extraAssets). - Under
### How do I configure my cache headers?(L183-L236), add thefirebase.jsonconfiguration for--web-content-hashbuilds (matching the CLI tip inpackages/flutter_tools/lib/src/commands/build_web.dart) that pairsmax-age=0, must-revalidateon bootstrap files withpublic, max-age=31536000, immutableon hashed entrypoints andassets/**:
{
"hosting": {
"public": "build/web",
"ignore": ["**/*.map"],
"headers": [
{
"source": "**",
"headers": [
{
"key": "Cache-Control",
"value": "max-age=0, must-revalidate"
}
]
},
{
"source": "assets/**",
"headers": [
{
"key": "Cache-Control",
"value": "public, max-age=31536000, immutable"
}
]
},
{
"source": "main.dart.*.+(js|wasm|mjs)",
"headers": [
{
"key": "Cache-Control",
"value": "public, max-age=31536000, immutable"
}
]
},
{
"source": "404.html",
"headers": [
{
"key": "Cache-Control",
"value": "max-age=0, must-revalidate"
}
]
}
],
"rewrites": [
{
"source": "!(/assets/**|/canvaskit/**|/icons/**|/main.dart.*)",
"destination": "/index.html"
}
]
}
}2. sites/docs/src/content/deployment/web.md (https://docs.flutter.dev/deployment/web)
Add a Web content hashing (--web-content-hash) section (with a :::version-note for Flutter 3.50+) covering:
- Hashed vs. Unhashed Build Outputs:
- Immutable (
public, max-age=31536000, immutable):main.dart.<hash>.js,main.dart.<hash>.wasm,main.dart.<hash>.mjs,main.dart.<hash>.js.mapandmain.dart.<hash>.mjs.map(if--source-mapsis enabled and deployed), and all files underassets/**(includingassets/AssetManifest.<hash>.bin,assets/AssetManifest.bin.<hash>.json,assets/FontManifest.<hash>.json,assets/NOTICES.<hash>, andassets/shaders/**). - Revalidate on Every Load (
max-age=0, must-revalidateorno-cache):index.html,flutter_bootstrap.js,flutter.js,manifest.json,version.json,404.html,canvaskit/**(when built with--no-web-resources-cdn), andmain.dart.wasm.map(when built with--source-maps, since.wasmbinaries embed an unhashedsourceMappingURLsection).
- Immutable (
- Overlay Deployments (Zero-Downtime Rollouts for Active Tabs):
- When deploying a new release
N, an already-open browser tab running releaseN-1may lazily fetch an image, font, or asset with releaseN-1's content hash. - To prevent mid-session
404errors during rollout, retain at least the previous release's (N-1) hashed entrypoints andassets/**files alongside the new release's (N) hashed files in your CDN/storage bucket (or prune old hashes after a 24–72 hour grace window) while atomically updatingindex.htmlandflutter_bootstrap.js.
- When deploying a new release
- Custom Service Workers (
build/web/precache_manifest.json):- When
--web-content-hashis enabled,flutter build webgeneratesbuild/web/precache_manifest.json({"version": 1, "entries": [{"url": "...", "hash": "<8-char-sha256>", "size": ..., "urlHashed": true|false}]}) for consumption by custom PWA service workers or Workbox (whererevisioncan be set toentry.urlHashed ? null : entry.hash).
- When
- Current Limitations:
--web-content-hashdoes not yet support deferred imports (deferred as) in either JavaScript (dart2js) or WebAssembly (dart2wasm/--enable-wasm-deferred-loading) builds (flutter/flutter#191917).
3. sites/docs/src/content/platform-integration/web/initialization.md (https://docs.flutter.dev/platform-integration/web/initialization)
- Note under
## Write a custom bootstrap script(L83-L103) that--web-content-hashinjects the hashed entrypoint filenames (mainJsPath,jsSupportRuntimePath,mainWasmPath) andextraAssets(assetManifest,fontManifest,AssetManifest.bin,NOTICES,shaders/**) into{{flutter_build_config}}. Customweb/index.htmlorweb/flutter_bootstrap.jsfiles must use{{flutter_build_config}}with_flutter.loader.load()rather than hardcoding"main.dart.js"or calling the deprecatedloadEntrypointAPI.
Reacted by Christian Uldall Pedersen and Parmakova
Metadata
Metadata
Assignees
Labels
a.faqRelates to the FAQ section of Flutter.devRelates to the FAQ section of Flutter.deva.rn.release-notesRelates to Flutter release notes found on docs.flutter.devRelates to Flutter release notes found on docs.flutter.devd.new-featureAdds new Flutter contentAdds new Flutter contentdev.deploymentRelates to deploying Flutter app section of Flutter.devRelates to deploying Flutter app section of Flutter.deve1-hoursEffort: < 8 hrsEffort: < 8 hrsfrom.teamReported by Dash docs team memberReported by Dash docs team memberp1-highMajor but not urgent concern: Resolve in months. Update each month.Major but not urgent concern: Resolve in months. Update each month.target.webTarget apps on the web platformTarget apps on the web platform
Activity
chore(web): add TODO tracking flutter/website#13825 before stable pro…
uldall commentedon Aug 28, 2026
It would also be helpful to add documentation on how to handle new releases.
IMHO the issue that needs handling is the following:
index.html(andflutter_bootstrap.js) which referencesmain.dart.<hash>.js.main.dart.<hash>.js, but the file no longer exists because the hash has changed in the new release.This problem also exists in a related manner even without the hash as files might have been updated between two releases, and now Client A will be downloading a "frankenstein" application that is a mixture of two releases.
I believe this can potentially be solved by using
--base-hrefand storing all previous releases of the application next to the new release. In this way index.html of Version X will only reference files in for example base/version-X/and things should work fine. If I have understood things correctly, this however beats the purpose of the hash being added to files.Is the solution to blend all releases of the Flutter application into a single folder on the web server? I.e. such that main.dart.hash A.js exists next to main.dart.hash B.js?
[-][HOLD - Q4 Release] Add caching and Cache-Control header guidance to Web Deployment documentation[/-][+][deployment/web] Add --web-content-hash, Cache-Control, Overlay Deployment, and precache_manifest.json guidance for Flutter 3.50[/+][web] Update Flutter 3.50 web caching, Wasm, and viewport-fit docs (f…