Usage & CLI
Basic CLI
You can run the default (generate) workflow with:
dart run kflavor generate
Or use the new subcommand form to be explicit and to place flags after the subcommand:
dart run kflavor generate --file flavors.yaml dart run kflavor configure --flutter-clean --android-studio
Subcommands and flags
generate
- Runs the full generation workflow: Firebase setup, Android/iOS updates, icons, and optional build-runner steps.
- Accepts the same common flags as the root parser (for convenience):
--file/-f--configure-android-studio/--cas--configure-vscode/--cvs.
configure
- Use this subcommand to run environment maintenance and IDE generation tasks without performing the whole
generatesequence. - Flags supported by
configure:--fileor-f— Path to configuration file.--flutter-clean— runflutter clean && flutter pub get.--clear-pod— removeios/Pods/andios/Podfile.lock(if present) and runpod installon macOS.--android-studioor--as— generate Android Studio run/debug configurations.--vscodeor--vs— generate VSCode run/debug configurations.--firebaseor--fb— run firebase configuration (flutterfire configure).
Examples
# Full generate workflow (same as running without a subcommand) dart run kflavor generate --file flavors.yaml # Configure only: run cleanup and regenerate IDE configs dart run kflavor configure --flutter-clean --clear-pod --android-studio
Generate IDE Configurations
To Auto-generate IDE Run/Debug config, use the following flags or subcommands:
- Android Studio:
dart run kflavor configure --android-studio # or dart run kflavor configure --as
- VSCode:
dart run kflavor configure --vscode # or dart run kflavor configure --vs
Manually run/build/archive from terminal (per flavor)
Below are common terminal commands and patterns for running, building, and archiving your app for a specific flavor. Replace <flavor> with your flavor name.
-
Flutter (run on device/emulator):
flutter run --flavor <flavor>
- If you have a single-flavor project, you can often run
flutter runwithout--flavor(use your default entrypoint as appropriate).
- If you have a single-flavor project, you can often run
-
Flutter (build Android APK / AAB):
flutter build apk --flavor <flavor> flutter build appbundle --flavor <flavor>
-
Flutter (build iOS / create an .ipa):
flutter build ipa --flavor <flavor>
- Alternatively archive with Xcode:
- Open
ios/Runner.xcworkspace, select the scheme for your flavor and Archive via Xcode's Product → Archive.
- Open
- Alternatively archive with Xcode:
Single-Flavor / Default Configuration
If your configuration defines only a single flavor, or if you rely solely on global configurations without specific flavor overrides, kflavor treats the project as a standard, non-flavored Flutter application. In this scenario, the
--flavorflag is not required when executingflutter runorflutter buildcommands.