🕸️ Deep Dive · Advanced

Flutter web Wasm: deferred loading for smaller first paint

Wasm unlocks near-native graphics on the web — and a new packaging discipline. Flutter 3.47 adds experimental deferred loading for Wasm builds so you can split a large app into lazy modules.

Diagram: Wasm Deferred Loading

Build commands

flutter build web --release --wasm
# experimental deferred modules (main channel flag in 3.47 era)
flutter build web --release --wasm --enable-wasm-deferred-loading

Prerequisites

  • Migrate off dart:html to package:web and modern JS interop.
  • Update packages that still assume dart2js-only interop.

Splitting strategy

  1. Keep login/shell in the main module.
  2. Defer heavy feature screens (admin, editors, maps).
  3. Measure time to interactive, not just download size.

Pitfalls

  • Deferred libraries must not be required during first frame.
  • Wasm + canvas/Skottie-heavy UIs still need careful asset budgets.
  • Not every browser/flag combination is equal — test Chrome, Safari, Firefox.
#Flutter#Web#Wasm#Performance