Product flavors on Windows and Linux in Flutter 3.47
Dev/staging/prod builds were a mobile-only story for a long time. Flutter 3.47 brings flavors to Windows and Linux.
pubspec assets per flavor
flutter:
assets:
- path: assets/flavor_a/images
flavors:
- flavor_a
- path: assets/flavor_b/images
flavors:
- flavor_b
Build
flutter build windows --flavor flavor_a
flutter build linux --flavor flavor_a
Why desktop teams care
- Separate app IDs and icons for internal vs store builds.
- Different API base URLs without string hacks in Dart.
- CI matrix can produce side-by-side installers.
Pitfalls
- Pair flavors with
dart-defineor compile-time env — flavors alone do not inject secrets. - Remember desktop packaging (MSIX, deb/rpm, AppImage) still has its own identity rules.