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 generate sequence.
  • Flags supported by configure:
    • --file or -f — Path to configuration file.
    • --flutter-clean — run flutter clean && flutter pub get.
    • --clear-pod — remove ios/Pods/ and ios/Podfile.lock (if present) and run pod install on macOS.
    • --android-studio or --as — generate Android Studio run/debug configurations.
    • --vscode or --vs — generate VSCode run/debug configurations.
    • --firebase or --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 run without --flavor (use your default entrypoint as appropriate).
  • 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.

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 --flavor flag is not required when executing flutter run or flutter build commands.

← Back: IntroductionNext: Configuration →