flavor_cli 0.0.1
flavor_cli: ^0.0.1 copied to clipboard
Production-grade Flutter flavor automation CLI
example/README.md
🍹 Flavor CLI Example #
This directory contains a demonstration of a Flutter project fully configured using flavor_cli. It serves as both a reference implementation and a playground to test CLI commands.
🚀 Quick Start #
To set up and run this example on a connected device, follow these steps:
1. Initialize Flavor CLI #
Bootstrap the project configuration:
dart run flavor_cli init
2. Run the App #
Use the flavor_cli wrapper to launch a specific environment:
# Run the development flavor
dart run flavor_cli run dev
# Run the production flavor
dart run flavor_cli run prod
📂 Project Structure #
This example demonstrates the "Separate Mains" pattern:
lib/main/: Contains entry points for each flavor (main_dev.dart,main_stage.dart,main_prod.dart).lib/app_config.dart: A type-safe configuration class generated by the CLI. Edit this to add environment-specific variables like API keys or base URLs.lib/firebase_options_*.dart: Flavor-specific Firebase configurations generated via thefirebasecommand..flavor_cli.json: The manifest file that tracks your current flavor setup.
✨ Key Features Demonstrated #
- Multi-Flavor Firebase: Seamlessly switches between Firebase projects based on the active flavor.
- Unique App IDs:
co.flavor.com.dev,co.flavor.com.stage, andco.flavor.comcan all be installed on the same device simultaneously. - Type-Safe Config: Access flavor-specific data via
AppConfig.urlanywhere in your code. - Automated iOS Config: Check
ios/Flutter/for the automatically generated.xcconfigfiles.
For more details on how to use flavor_cli in your own projects, check out the Main README.