Create Flutter Monorepo Workspace

Monorepo gives you ability to manage (apps with common packages) independently within the same repository.
xflutter_cli create --template=workspace
make sure that `melos` package activated in your device before create the workspace.
dart pub global activate melos
(core) packages contains all shared components you want to share between apps

Create App inside workspace:

to create another application inside workspace, run create app command in workspace root directory:
xflutter_cli create

Create Package inside workspace:

to create another package inside workspace, run create package command in workspace root directory:
xflutter_cli create --template=package

Result:

  • flutter_monorepo_workspace
    • apps
      • customer_app
        • android
        • assets
        • ios
        • lib
          • common
          • main.dart
        • analysis_options.yaml
        • build.yaml
        • flutter_launcher_icons.yaml
        • flutter_native_splash.yaml
        • pubspec.yaml
    • packages
      • core
        • lib
          • src
            • data
            • di
            • environments
            • events
            • extensions
            • storage
            • ui
            • utilities
            • viewmodels
          • core.dart
        • pubspec.yaml
    • melos.yaml
    • pubspec.yaml
    • xflutter_cli.yaml

Usage:

Name
Type
Description
Allowed Values
Format
nameoptionworkspace name-snack case
packageoptionfirst application package name-snack case
architectureoptionspecify first application architecturelayers, modules
default-valuesflaginitialize with default values like colors-