Run App
Run a Flutter app from your monorepo with interactive flavor and device selection.
Usage
Interactive Mode
bash
melos run run:app
# or
dart run monorepo_toolkit runThe command will:
- Read
flavors.yamlto find available apps and flavors - Run
flutter devices --machineto detect connected devices - Prompt you to select an app (if multiple), flavor, and device
- Execute
flutter runwith the correct flags
📱 Available apps:
1. template_app
Select app [1]: 1
🎨 Available flavors:
1. development
2. staging
3. production
Select flavor [1]: 1
📲 Connected devices:
1. iPhone 15 Pro (ios) - 1A2B3C4D
2. Pixel 7 (android) - emulator-5554
Select device [1]: 2
🚀 Running: flutter run --flavor development --target lib/main_development.dart -d emulator-5554Non-Interactive Mode (CI)
Pass flags directly to skip prompts:
bash
dart run monorepo_toolkit run --app template_app --flavor development --device emulator-5554Flags
| Flag | Description |
|---|---|
--app | App name (from flavors.yaml) |
--flavor | Flavor name (development, staging, production) |
--device | Device ID (from flutter devices) |
When a flag is provided, its corresponding prompt is skipped. If only one option exists (e.g., single app or single device), it's auto-selected.
Configuration
The command reads from flavors.yaml at the workspace root:
yaml
apps:
template_app:
android_app_id: com.example.template_app
ios_bundle_id: com.example.templateApp
flavors:
- development
- staging
- productionEntry Points
Each flavor maps to a main_<flavor>.dart entry point:
apps/template_app/lib/
main_development.dart
main_staging.dart
main_production.dartWhat It Runs
The generated flutter run command:
bash
flutter run \
--flavor <flavor> \
--target lib/main_<flavor>.dart \
--device-id <device_id>The process inherits your terminal's stdin/stdout/stderr, so hot reload (r), hot restart (R), and all other Flutter CLI controls work normally.