Flavor Manager
The flavor command manages app flavors (build variants) using flutter_flavorizr. It handles flavor configuration, native platform setup (Android product flavors, iOS schemes), IDE configurations, and entry point generation.
Subcommands
flavor list-apps
Lists all apps in the workspace that have flavor configurations:
dart run monorepo_toolkit flavor list-appsflavor list
Lists all configured flavors for a specific app:
dart run monorepo_toolkit flavor list --app template_appDisplays each flavor with its app name, Android application ID, and iOS bundle ID.
flavor add
Adds a new flavor to an app:
# Basic usage
dart run monorepo_toolkit flavor add --app template_app --name qa
# With custom app name suffix and bundle ID suffix
dart run monorepo_toolkit flavor add \
--app template_app \
--name qa \
--app-name "[QA]" \
--suffix ".qa"
# Add and immediately generate native files
dart run monorepo_toolkit flavor add --app template_app --name qa --generate| Flag | Description |
|---|---|
--app / -a | The app name (required) |
--name / -n | The flavor name, e.g., qa, uat, demo (required) |
--app-name | Custom app name suffix. Defaults to [FLAVOR_NAME] |
--suffix / -s | Bundle ID suffix. Defaults to .<flavor_name> |
--generate / -g | Run flutter_flavorizr after adding |
Flavor names must start with a lowercase letter and contain only lowercase letters, numbers, and underscores.
flavor generate
Runs flutter_flavorizr to generate native platform files for all configured flavors:
dart run monorepo_toolkit flavor generate --app template_app
# Force regeneration even if inputs haven't changed
dart run monorepo_toolkit flavor generate --app template_app --force
# Check which flavors need regeneration without making changes
dart run monorepo_toolkit flavor generate --app template_app --checkThe generate command runs up to four steps:
flutter_flavorizrfor native Android/iOS flavor files and launcher icons- Native splash screen generation (if configured)
- IDE configuration generation (VSCode launch.json, JetBrains run configs)
- Flavor-based
main_<flavor>.dartentry point files
Each step can be toggled with --no-splash, --no-icons, --no-ide-configs, or --no-main-files.
flavor sync
Synchronizes flavor settings between the global flavors.yaml config and individual app configurations:
# Initialize global settings from existing app configs
dart run monorepo_toolkit flavor sync --init
# Sync global settings to all apps (add missing flavors)
dart run monorepo_toolkit flavor sync
# Sync a specific app only
dart run monorepo_toolkit flavor sync --app template_app
# Sync from app configs back to global settings
dart run monorepo_toolkit flavor sync --from-appsAndroid/iOS mapping
Each flavor maps to platform-specific identifiers:
| Platform | What it maps to | Example |
|---|---|---|
| Android | applicationId suffix in build.gradle | com.example.app.staging |
| iOS | Bundle identifier in Xcode scheme | com.example.app.staging |
The generate command creates all necessary native files: Android productFlavors blocks, iOS build configurations, and Xcode schemes.
Default flavors
When initializing with flavor sync --init, the default flavors are:
development(suffix.development)staging(suffix.staging)production(no suffix)
Workflow
- Define flavors globally in
flavors.yaml - Run
dart run monorepo_toolkit flavor sync --initto create the global config - Add new flavors with
dart run monorepo_toolkit flavor add - Generate native files with
dart run monorepo_toolkit flavor generate - Run the app with
flutter run --flavor development
Melos shortcuts
melos run flavor:list # List flavors for an app
melos run flavor:add # Add a new flavor
melos run flavor:generate # Generate native flavor files
melos run flavor:sync # Sync global and app configs