Web support for Flutter
Shipping a Flutter app to the browser
The web is a separate target with real URLs and a capability layer, not a wider phone. The scaffold is web-clean out of the box.
What this feature covers
- Capability layer: One source of truth for what the current platform can do.
- Branching: kIsWeb and conditional imports on dart.library.js_interop.
- URLs: Path URL strategy, so every screen is shareable and refreshable.
- Hosting: Rewrites, cache headers and an SPA fallback from the host templates.
- Transport: Fetch-based streaming and IndexedDB persistence behind a factory.
How Flutter Agent Kit implements it
The scaffold ships a capability layer at lib/app/utils/capabilities.dart and a web-safe bootstrap that guards native-only setup behind kIsWeb. Shared code never imports dart:io, dart:html, package:js or path_provider, and conditional imports test dart.library.js_interop so they cover both the JS and the Wasm build.
Host templates for web/index.html, the manifest and firebase.json are copied at scaffold time, and a mobile-only feature is always hidden behind a capability flag with an explicit disabled state rather than a silent no-op. A green web build plus a green Wasm dry run is the acceptance gate for a web change.
Frequently asked questions
Does the kit support Wasm?
Yes. Dependencies are chosen to be Wasm-clean, and every web change is verified with a Wasm dry run in addition to the standard build, because a failed dry run names the dependency pulling in legacy Web libraries.
How does a web build get deployed?
The kit ships host templates with the SPA rewrite, revalidate-on-entry cache headers and source maps excluded, for a static hosting target such as Firebase Hosting. Path-based URLs mean unknown paths must rewrite to index.html.
Get Flutter Agent Kit
Flutter Agent Kit ships this as a ready feature skill, together with the AGENTS.md context layer and the rest of the skills. €99.99 one-time, lifetime updates, unlimited personal and commercial projects.
Browse all features included in Flutter Agent Kit.