kflavor 1.1.4
kflavor: ^1.1.4 copied to clipboard
kflavor automates flutter multi-flavor configuration for android, iOS and web, managing firebase settings, icons, splash screens, gradle/xcode config, and IDE run/debug profiles.
kFlavor
Simplify your Flutter multi-flavor setup with a single YAML configuration. Automate build flavors, firebase, icons, and IDE configs effortlessly.
Features #
- Generate and manage Android/iOS build flavors from a single YAML file
- No need to maintain multiple messy looking
main.dartentrypoint. uses singlemain.dartentrypoint. - Automatic configuration of Gradle (Kotlin & Groovy) and Xcode projects
- Firebase integration and configuration per flavor
- Icon generation for each flavor
- Generates Android Studio and VSCode run/debug configurations
- Supports custom arguments for CLI automation
- Easy integration with CI/CD pipelines
- Eliminates the need to maintain multiple
AndroidManifest.xmlfiles. - Splash screen generation
Getting started #
- Add kflavor to your dev dependencies in
pubspec.yaml:dev_dependencies: kflavor: - Run
dart pub getorflutter pub get. - Create a
flavors.yamlfile in your project root or use the Prepare YAML tool. - Run the CLI tool:
dart run kflavor generate
For more information, see the CLI Documentation.
Usage #
Example flavors.yaml #
flavors:
dev:
id: myapp.app.dev
name: MyApp Dev
icon:
ios: assets/icon/icon_dev.png
android:
path: assets/icon/icon_android.png
background: "#E0F9FF"
firebase: firebase-dev-project-id
prod:
id: myapp.app
name: MyApp
icon:
ios: assets/icon/icon.png
android:
path: assets/icon/icon_android.png
background: "#FFFFFF"
firebase: firebase-prod-project-id
For a full, annotated example and detailed reference, see the project's example flavors.yaml: Valid YAML Configuration
Icon preparation #
kflavor includes template icons you can use as a visual guide and to ensure all flavors have consistent icon boundaries and spacing. The templates are located here: Icon Configuration
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>
Single-flavor behavior
If your flavors.yaml defines exactly one flavor, kflavor treats the project as a "no-flavor" configuration. That means you do not need to pass a --flavor to kflavor's CLI or to Flutter build/run commands — the single flavor is used as the default. If you add additional flavors later, pass the desired flavor name to the commands shown below.
Contributing #
Contributions are welcome! Please open issues or pull requests on GitHub.