Flutter Blog Cheng Lin May 6, 2024

Best Practices for Optimizing Flutter Web Loading Speed

Article Summary

Cheng Lin from Google's Flutter team tackles the elephant in the room: Flutter web apps are slow to load. Here's how to fix it.

Flutter web apps face loading speed challenges that can kill user experience before it even starts. Cheng Lin, a Product Manager working with Google's Flutter team, breaks down practical optimization strategies covering everything from rendering engines to caching mechanisms.

Key Takeaways

Critical Insight

Flutter web performance requires balancing technical optimizations (Wasm, lazy loading, modern image formats) with perception tricks (splash screens, preloading) to make apps feel fast.

The article reveals why CanvasKit's 1.5 MB size might not be your biggest problem, and what experimental feature could change everything.

About This Article

Problem

CanvasKit, Flutter web's default renderer, adds 1.5 MB to your app size and slows down startup. All widgets have to wait for the full file to load before they become interactive.

Solution

Cheng Lin suggests switching to WebAssembly rendering mode instead. This removes the dart:html dependency and uses the web package with dart2wasm, which starts up faster than JavaScript.

Impact

Browsers cache Wasm modules as compiled native code, so they load at speeds comparable to native binaries. There's no need for reparsing, recompilation, or the JIT processing that JavaScript requires.