Skip to content

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 run

The command will:

  1. Read flavors.yaml to find available apps and flavors
  2. Run flutter devices --machine to detect connected devices
  3. Prompt you to select an app (if multiple), flavor, and device
  4. Execute flutter run with 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-5554

Non-Interactive Mode (CI)

Pass flags directly to skip prompts:

bash
dart run monorepo_toolkit run --app template_app --flavor development --device emulator-5554

Flags

FlagDescription
--appApp name (from flavors.yaml)
--flavorFlavor name (development, staging, production)
--deviceDevice 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
      - production

Entry Points

Each flavor maps to a main_<flavor>.dart entry point:

apps/template_app/lib/
  main_development.dart
  main_staging.dart
  main_production.dart

What 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.

Built by Banua Coder