flavor property

String? flavor
final

The --flavor this entry point is built with — dev, staging.

A flavoured project cannot be run without one at all. Where a missing --dart-define merely gives you the fallback value, a missing --flavor on a project that declares product flavors is a hard failure before anything is compiled: Gradle has no such variant, and Xcode has no such scheme. So this is not a convenience — for those projects it is the difference between an entry point that launches and one that cannot.

Declared per entry point because that is how the pairing actually works: main_dev.dart goes with dev, and it is the same fact twice. To run one entry point under several flavors, declare it several times with different names, or pass flavor to the launch action. When the flavor varies by platform rather than by intent, that is flavorByPlatform, not a second declaration.

Every platform but web — supportsFlavors is true on Linux, macOS and Windows as well as Android and iOS, and web is the one that inherits the false default. Declaring one on an entry point that also runs in a browser is fine: the launch drops the flag there rather than refusing, which is what a project setting flutter: default-flavor: for its web build already expects.

Implementation

final String? flavor;