Ship only the assets each platform needs
One flutter: assets list used to mean every platform received every file. From 3.41 you can filter:
flutter:
assets:
- path: assets/logo.png
- path: assets/web_worker.js
platforms: [web]
- path: assets/desktop_icon.png
platforms: [windows, linux, macos]
Why this is not optional for multi-platform apps
- Mobile users should not download desktop help PDFs or web workers.
- Store size metrics and download friction improve immediately.
- CI can assert platform asset matrices in tests.
Practical split
| Asset type | Platforms |
|---|---|
| Shared branding | all |
| Web workers / wasm helpers | web |
| High-res print templates | desktop |
| iOS/Android notification sounds | android, ios |
Pitfalls
- Conditional
rootBundle.loadof a missing platform asset throws — guard with a platform check. - This is packaging filtering, not runtime theming.