Flutter web (renderers, SEO, performance, when not to use it)
flutterflutter-webcanvaskitskwasmwasmseoperformancepwa
Flutter can compile an app to the web, which several of Justin's projects use (tldr's web app, the SMC site, Forge). It draws everything into a canvas instead of producing HTML, which explains both its strengths (pixel-identical UI shared with mobile) and its weaknesses (SEO, browser conventions, payload size). Research snapshot from March 2026 plus field experience.
Renderers
- The HTML renderer was deprecated in 2025. The remaining options are CanvasKit (Skia
compiled to WebAssembly, ~1.5 to 2 MB download, works with the default JS build) and
Skwasm (
flutter build web --wasm), which draws on a separate thread and is roughly 2 to 3 times faster for graphics. - As of March 2026 the Wasm build was stable (since 3.24) but not recommended for production: the research reported poor iOS support (every iOS browser is WebKit, which lagged on the WasmGC features Flutter's Wasm output needs) and Firefox/Safari bugs. Stay on the JS build and re-check current browser support before switching.
- Multi-threaded Wasm needs cross-origin isolation headers:
Cross-Origin-Opener-Policy: same-originandCross-Origin-Embedder-Policy: credentialless(orrequire-corp). Those headers also restrict cross-origin resources, so test images and embeds afterward. - CanvasKit and cross-origin images: images are decoded into the canvas, so they need CORS. Redirecting the browser to a pre-signed object-storage URL on a bucket without CORS breaks image display; stream images through your own API, which carries CORS headers (see Linode (Akamai) Object Storage).
Limits to accept up front
- No real SEO: content is pixels on a canvas, not DOM text.
- Browser conventions break: Ctrl+F in-page search, Ctrl+P printing, native text selection, some scrolling behavior; iOS web text input positioning is quirky.
- Large first load compared to an HTML site.
- Best for: dashboards, admin panels, internal tools, PWAs, companion web apps for a mobile app. Poor fit: SEO-dependent marketing sites, content-heavy blogs, e-commerce.
- If a marketing site is already in Flutter, the community advice is to optimize rather than rebuild. But for a small single-target site, a rewrite can pay: Hunsley Hills Salon replaced a ~4,500-line Flutter web app with a vanilla-JS SPA and gained real DOM, SEO-able text and file-copy deploys (see A production vanilla-JS single-page app (no framework, no build)).
SEO and first-load mitigations
- Add the viewport meta tag (
width=device-width, initial-scale=1.0); the SMC site was missing it. - Open Graph and Twitter Card tags, JSON-LD
LocalBusinessdata,robots.txt,sitemap.xml, and a<noscript>block containing real business text for crawlers. - Path URLs instead of
#/(usePathUrlStrategy()/url_strategy); these need a server SPA fallback rule (Apache vhost gotchas (icons alias, manifests, SPA fallback, redirects)). - Prerendering for bots (Prerender.io had a free tier of 250 pages/month) via nginx user-agent detection.
- A branded HTML/CSS splash in
index.htmlthat shows instantly, instead of a white screen while CanvasKit loads. - Bundle fonts as assets and set
GoogleFonts.config.allowRuntimeFetching = falseto avoid a flash of unstyled text and a runtime dependency. - Deferred imports for heavy pages:
import 'page.dart' deferred as page;(reported ~40% faster initial render). - WebP images (60 to 80% smaller), gzip or Brotli on the server (~70% payload reduction),
one-year immutable caching for hashed
.js/.css/.wasm,no-cacheforindex.html.
Rendering performance
- Shadows combined with animation are very expensive on the web (25 to 30 fps on laptops, single digits on weak devices).
- Prefer
ImageFilteredoverBackdropFilterfor blur and bound it withClipRRect. - Never animate the
Opacitywidget directly; useFadeTransitionorAnimatedOpacity. RepaintBoundaryaround animated sections next to static content, but not everywhere.flutter_animatedelays were reported to force 60 fps re-renders even when idle.- Hover effects on every interactive element (
MouseRegionplus implicit animations;FocusableActionDetectorcombines hover, focus and keyboard).
Accessibility
semanticLabelon images,tooltipon everyIconButton,Semanticswrappers on custom controls, 48x48 touch targets.Text.richinstead ofRichText, becauseRichTextignores the user's text scaling.
Measured fixes on tldrnerd.com (2026-06-12)
The TLDR web app's Apache vhost (behind nginx) originally served the Flutter build with no
compression and no wasm MIME type. What changed, with numbers:
- AddOutputFilterByType DEFLATE for JS, CSS, HTML, JSON, wasm: main.dart.js 8.1 MB to 2.4 MB,
canvaskit.wasm 7.2 MB to 2.9 MB; a cold load went from about 15.3 MB to 5.4 MB.
- AddType application/wasm .wasm: CanvasKit had no Content-Type at all, which blocks the
browser's streaming wasm compilation.
- Cache-Control: no-cache on the entry points (index.html, flutter_bootstrap.js,
flutter_service_worker.js, version.json, manifest.json) so a deploy takes effect on the next
load; the rest revalidates by ETag.
- Do not dynamically gzip the APK (application/vnd.android.package-archive) served from the
same vhost: on-the-fly compression breaks HTTP Range requests, and the in-app updater relies on
resumable (206) downloads.
- ServerName https://tldrnerd.com plus UseCanonicalName On in the vhost: behind nginx's TLS
termination, Apache's mod_dir trailing-slash 301 otherwise pointed at http://, briefly sending a
reset token in cleartext on old-style links.
- A branded splash in web/index.html (removed on the flutter-first-frame event) replaced the
blank white page during the bundle download, which mattered most for password-reset links opened
cold from email.
- Pages reached from email do not need Flutter at all. /password_reset/ and /verify_email/
became static index.html pages in web/ subdirectories that POST JSON to the API. Apache's -d
rewrite condition serves them before the SPA fallback, and the mailed URLs include the trailing
slash to skip a 301. They load instantly instead of after 5 MB of CanvasKit.
- Emoji: the CanvasKit chromium variant strips emoji font support; use canvasKitVariant: "full"
and load Noto Color Emoji with loadFontFromList().
Never leave a black screen
A Flutter web app that throws during startup shows nothing at all, and users report "it's just a black screen." Defend every layer:
- Wrap each startup step in
main()in try/catch sorunAppalways runs, even if a service fails to initialize. - Set
ErrorWidget.builderto a readable error panel with a way back, and log throughPlatformDispatcher.onError. - Give
web/index.htmlits own boot screen (dark background plus spinner) and remove it on theflutter-first-frameevent. If it is still up after about 12 s, show Reload and Clear cache & reload; the second unregisters service workers and clears CacheStorage but keeps localStorage (so sign-ins survive). - A stale cached build is a likely cause of black-screen reports that will not reproduce. Example: Forge v1.13.1 (2026-10-24).
Strict tracking protection hangs Flutter web
By default, Flutter web loads CanvasKit (canvaskit.js/.wasm) from www.gstatic.com and Roboto
from fonts.gstatic.com. Strict tracking protection in Firefox, Fenix and GeckoView browsers
blocks gstatic (the Disconnect "tracking content" list), so the app spins on its splash screen
forever. Self-hosting needs both canvasKitBaseUrl: "canvaskit/" in flutter_bootstrap.js and
bundled fonts with a self-hosted fontFallbackBaseUrl; with only CanvasKit self-hosted the app
boots with blank labels. Found with tldrnerd.com in Tokay (post #1851); see
Building an Android browser on GeckoView (Tokay).
Deploy gotchas on this server
- Apache's global
/icons/alias hijacks Flutter'sicons/directory; add a scoped alias (Apache vhost gotchas (icons alias, manifests, SPA fallback, redirects)). - When replacing a Flutter web app with something else, ship a self-unregistering
flutter_service_worker.js, or returning visitors keep the cached old app (Deploy scripts with rsync (patterns and traps)).
See also
- Flutter app architecture, state management and packages (2026 survey)
- Modern professional web design conventions (2026 snapshot)
- Apache vhost gotchas (icons alias, manifests, SPA fallback, redirects)
- Linode (Akamai) Object Storage
Linked from
- Apache vhost gotchas (icons alias, manifests, SPA fallback, redirects)
- Designing a construction or utility contractor website
- Flutter / Flame canvas rendering performance facts
- Flutter app architecture, state management and packages (2026 survey)
- flutter_quill rich-text editor gotchas (markdown, IME, spell check, fonts)
- go_router navigation patterns and opening your own links in-app
- just_audio in Flutter, gotchas and patterns
- Modern professional web design conventions (2026 snapshot)
- Open Graph link previews (SPAs, private posts, private-storage media)
- Serving a phone-friendly Flutter web app from the same URL
- Streaming public-domain music from the Internet Archive