Tree-Shaking Native Code and Assets with Link Hooks
summary
Demonstrates shrinking a Flutter app to only bytes actually used by combining the @RecordUse annotation with build hooks and new link hooks plus the data assets experiment. A live demo (Idle Pirate) shows removing unused sounds and images, resizing icons, and cross‑package translation pruning, dropping an example app from ~40 MB to ~17 MB and slimming a native audio library from 652 KB to 428 KB. The mechanism runs at AOT/link time and the demo successfully produces smaller bundles.
AI-written summary · about
chapters (14)
- 0:00Introduction to tree shaking
- 1:23What is tree shaking?
- 2:28Icon tree shaking in Flutter
- 4:14Generalizing tree shaking
- 6:40Introducing link hooks
- 7:22Demo setup: Idle Pirate game
- 9:29Tree shaking sounds
- 14:29Tree shaking images
- 17:38Resizing and filtering images
- 19:44Tree shaking translations
- 23:19Cross-package tree shaking
- 26:31User-defined configuration
- 28:18Tree shaking native libraries
- 31:32Summary and Q&A
