flutter_monorepo 1.7.0
flutter_monorepo: ^1.7.0 copied to clipboard
Bootstrap a production-ready Flutter monorepo in one command. Choose state management (GetX/Riverpod/Bloc/Cubit), HTTP client, locales, and platforms.
Flutter Monorepo #
A Dart CLI tool that bootstraps a production-ready Flutter monorepo in one command — with your choice of state management, HTTP client, locales, and platforms.
Features #
- Multi-framework support — GetX, Riverpod, Bloc, or Cubit via
--state - Multi-HTTP client — Dio, http, or Chopper via
--http - Dynamic localization — 12 built-in languages with locale-aware date/number formatters and RTL support
- Flexible platforms — any combination of Android, iOS, Web, Linux, macOS, Windows
- Full Material 3 design system — light + dark themes with 32 component themes, responsive utilities, centralized asset management
- Sealed error handling —
AppExceptionhierarchy +Result<T>(Success | Failure) throughout - Clean architecture — 4 framework-agnostic shared packages (core, ui, network, l10n) + 1 app package
- Auto version resolution — fetches latest compatible dependency versions from pub.dev at generation time
- Production linting —
strict-casts,strict-raw-types,strict-inference+ 38 lint rules - Complete documentation —
ARCHITECTURE.md+PACKAGE.mdfor every generated package - Auto git init — initializes repository with first commit (optional)
- Project metadata — auto-generated
README.md,LICENSE, andCONTRIBUTING.mdwith 11 license types via--license(default: proprietary) - Pluggable persistence —
--storagepicksget_storage,shared_prefsorhive_cebehind aKeyValueStoreinterface in core, so the backend is a one-file change - Auth scaffolding —
--authgenerates anAuthRepositorycontract, a provider implementation (custom,firebaseorsupabase), a login screen andAUTH.md - Build flavors —
--flavorgeneratesdev/staging/prodwith their own entrypoints, application ids and display names - Starter templates —
--template ecommerce|social|dashboardadds a core model and two wired screens with routes registered - CI pipelines —
--ci githubor--ci gitlabgenerates a pipeline that analyzes, checks formatting and runs every package's tests - GitHub community setup — opt-in
--githubflag generates issue templates, PR template, code of conduct, and funding placeholder - Monorepo doctor —
doctorcommand to verify structure integrity, report missing items, and auto-fix with--fix - Development workflows —
workflowcommand with step-by-step guides for building components, screens, and business logic - Test-during-development — every workflow includes a test step; test directories are pre-created so tests are written alongside code, not bolted on later
- AI agent instructions — every project gets an
AGENTS.md(the convention Codex and others read) plus.claude/skills/with 4 task skills for Claude Code, all adapting to the project as generated — state management, storage backend, and auth and flavors when configured
Before use, check the CHANGELOG to ensure you have the latest features.
Installation #
Install globally via Dart:
dart pub global activate flutter_monorepo
Make sure ~/.pub-cache/bin is in your PATH (Dart will prompt you if not).
Usage #
You can use this tool from any terminal to scaffold a complete Flutter monorepo with a single command.
Basic Usage #
To generate a monorepo with default settings (GetX + Dio + EN/AR):
flutter_monorepo my_app
This creates a my_app/ directory with a fully configured monorepo, resolves all dependencies, generates l10n files, runs dart analyze, and initializes git.
Custom Usage #
You can customize every aspect of the generated monorepo:
# Riverpod + Dio + 3 locales
flutter_monorepo my_app --state riverpod --locales en,es,fr
# Bloc + http package + web platform
flutter_monorepo my_app --state bloc --http http --platforms android,ios,web
# Cubit + Chopper + single locale + custom org + no git
flutter_monorepo my_app --state cubit --http chopper --locales en --org com.mycompany --no-git
# MIT license
flutter_monorepo my_app --license mit
# Full GitHub setup (MIT license + community files)
flutter_monorepo my_app --license mit --github
# Full example with all options
flutter_monorepo my_app \
--state riverpod \
--http dio \
--storage hive \
--auth supabase \
--template dashboard \
--flavor \
--test full \
--license mit \
--locales en,es,fr,de \
--platforms all \
--org com.mycompany \
--ci github \
--github
Doctor (Structure Check) #
After generating a project and sharing it with your team, use doctor to verify the monorepo structure is intact:
cd my_app
# Check structure — reports missing dirs/files
flutter_monorepo doctor
# Auto-fix missing items
flutter_monorepo doctor --fix
The doctor reads .flutter_monorepo.yaml, the marker written at generation time, so it knows exactly how the project was created rather than inferring it — no flags needed. Projects generated before the marker existed fall back to inspecting the tree. It checks every expected directory and file for that configuration (110+, depending on the options used) and reports what's present (✓) and what's missing (✗).
doctor --fix restores anything it has a template for. A file it cannot restore is reported and left absent on purpose: writing an empty placeholder would satisfy the next check and hide the problem.
Development Workflows #
Get step-by-step development guides right in your terminal. When run from inside a generated project, workflows auto-detect your state management framework and show tailored instructions:
cd my_app # run from inside your project for tailored output
flutter_monorepo workflow # overview + quick reference
flutter_monorepo workflow a # Component Design Flow (widget + companion state)
flutter_monorepo workflow b # Screen Design Flow (adapts to GetX/Riverpod/Bloc/Cubit)
flutter_monorepo workflow c # Business Logic Flow (core + network + framework wiring)
Each workflow includes a test step — tests are written during development, not after. The generated project comes with pre-created test directories:
packages/core/test/{states, rules, models}/ # companion state + business logic tests
packages/ui/test/widgets/ # widget render tests
packages/network/test/ # API client tests
<app>/test/screens/ # controller tests
Options #
| Option | Short | Default | Description |
|---|---|---|---|
| Project identity | |||
--org |
-o |
com.example |
Organization identifier for Android/iOS bundle ids |
--license |
proprietary |
proprietary, mit, apache-2.0, bsd-2-clause, bsd-3-clause, gpl-2.0, gpl-3.0, lgpl-2.1, mpl-2.0, unlicense, isc |
|
| Architecture | |||
--state |
-s |
getx |
State management: getx, riverpod, bloc, cubit |
--http |
dio |
HTTP client: dio, http, chopper |
|
--storage |
framework default | Backend behind core's KeyValueStore: get_storage, shared_prefs, hive (resolves hive_ce) |
|
--auth |
none |
Auth behind core's AuthRepository: none, custom (token against your own API), firebase, supabase |
|
| Reach | |||
--platforms |
-p |
android,ios |
Comma-separated, or all for every supported platform |
--locales |
-l |
en,ar |
Comma-separated locale codes; region variants such as pt_BR are supported |
--flavor |
off | Generate dev/staging/prod build flavors (Android wired; iOS needs manual Xcode steps — see FLAVORS.md) |
|
| Starting point | |||
--template |
blank |
Starter screens: blank, ecommerce, social, dashboard |
|
--test |
unit |
Test scaffolding: unit, or full (adds an integration_test suite and shared fixtures) |
|
| Repository | |||
--ci |
none |
CI pipeline: none, github (Actions), gitlab. --github implies github; an explicit --ci wins |
|
--[no-]github |
off | GitHub community files (issue/PR templates, code of conduct, funding) | |
--[no-]git |
on | Initialise a git repository with a first commit | |
| Information | |||
--help |
-h |
Show help message | |
--version |
Show version |
Every option is optional and independent. flutter_monorepo my_app with no
flags produces a working GetX + Dio project; each flag changes one decision
without affecting the others.
| Command | Description |
|---|---|
doctor |
Check structure integrity of current monorepo |
doctor --fix |
Restore missing items from templates; files with no template are reported, never stubbed |
workflow |
Show development workflow overview + quick reference |
workflow a |
Component Design Flow (widget + companion state) |
workflow b |
Screen Design Flow (adapts to GetX/Riverpod/Bloc/Cubit) |
workflow c |
Business Logic Flow (adapts wiring step per framework) |
Working with AI Agents #
Generated projects carry their own agent instructions, so an assistant follows the architecture instead of guessing at it.
| File | Read by | Contents |
|---|---|---|
AGENTS.md |
Codex and other tools following the convention | Package boundaries, Result<T> over throwing, persistence via KeyValueStore, auth via AuthRepository, localization rules, and the commands that verify a change |
.claude/skills/ |
Claude Code (discovered automatically) | Four task skills — component design, screen design, business logic, monorepo doctor — with per-framework instructions and checklists |
.claude/settings.json |
Claude Code | Pre-approves the read-only and test commands so routine work needs no prompting |
Both adapt to the project as generated: a project without --auth is never
told about an interface it does not have, and the storage guidance names the
backend actually in use.
There is one instruction file rather than one per tool. Four near-identical
configs would drift apart independently, and AGENTS.md is the convention
with real cross-tool traction.
State Management #
Each framework generates a complete, working app layer with theme switching, locale switching, persistence and routing. The persistence column is only the default — every framework works with any --storage backend, because they all go through the same KeyValueStore interface:
| Framework | Dependencies | Routing | Default --storage |
Screen Pattern |
|---|---|---|---|---|
| GetX | get | GetX pages | get_storage |
GetView + Obx |
| Riverpod | flutter_riverpod, go_router | GoRouter | shared_prefs |
ConsumerWidget + ref.watch |
| Bloc | flutter_bloc, hydrated_bloc, go_router | GoRouter | hive |
BlocBuilder |
| Cubit | flutter_bloc, hydrated_bloc, go_router | GoRouter | hive |
BlocBuilder |
HTTP Client #
All three HTTP clients generate the same ApiClient API surface — every method returns Result<T> for type-safe error handling:
| Client | Package | Interceptor Pattern | Error Mapping |
|---|---|---|---|
| Dio | dio |
Interceptor class |
DioException -> AppException |
| http | http |
BaseClient wrapper |
ClientException -> AppException |
| Chopper | chopper |
Interceptor interface (chain) |
Exception -> AppException |
Localization #
12 languages have built-in translations: en, ar, es, fr, de, pt, zh, ja, ko, hi, tr, ru
Unknown locale codes generate English placeholder values. Those ARB files carry an @@x-untranslated attribute, and the generator prints a note listing them.
flutter_monorepo my_app --locales en,es,fr,de,ja
Each generated project includes:
- ARB files per locale with
flutter gen-l10nintegration - Locale-aware
AppDateFormatter(short, medium, long, time) - Locale-aware
AppNumberFormatter(decimal, currency, compact, percent) DirectionalityBuilderwidget for RTL support
Auto Version Resolution #
When the tool runs, it queries pub.dev to fetch the latest compatible version of every dependency. It stays within the same major version as our tested templates to ensure API compatibility, and falls back to hardcoded versions if you're offline.
→ Fetching latest package versions from pub.dev...
Example: dio ^5.8.0+1 (fallback) resolves to ^5.9.2 (latest patch in major 5).
Generated Structure #
my_app/
├── my_app_app/ # Main Flutter app
│ ├── lib/
│ │ ├── main.dart # App entry point
│ │ ├── app/
│ │ │ ├── controllers/ # GetX: theme + locale controllers
│ │ │ ├── providers/ # Riverpod: theme + locale providers
│ │ │ ├── blocs/ # Bloc/Cubit: theme + locale blocs
│ │ │ ├── routes/ # Route constants
│ │ │ └── router/ # GoRouter config (Riverpod/Bloc/Cubit)
│ │ └── screens/
│ │ └── home/ # Demo home screen
│ ├── android/
│ └── ios/
├── packages/
│ ├── core/ # Business logic (framework-free)
│ │ └── lib/
│ │ ├── exceptions/ # Sealed AppException hierarchy
│ │ ├── models/ # BaseModel with equality
│ │ ├── repositories/ # Abstract repository contracts
│ │ ├── usecases/ # UseCase<T,P> base classes
│ │ ├── utils/ # Result<T> = Success | Failure
│ │ └── extensions/ # String, DateTime, List extensions
│ ├── ui/ # Design system
│ │ ├── assets/ # Icons, fonts, images
│ │ └── lib/
│ │ ├── theme/ # Material 3 light + dark (32 components)
│ │ ├── responsive/ # Breakpoints, ResponsiveBuilder
│ │ ├── assets/ # Type-safe asset constants
│ │ └── widgets/ # Reusable stateless widgets
│ ├── network/ # HTTP layer (Dio/http/Chopper)
│ │ └── lib/
│ │ ├── client/ # ApiClient returning Result<T>
│ │ └── interceptors/ # Auth + logging interceptors
│ └── l10n/ # Localization
│ └── lib/
│ ├── l10n/arb/ # ARB files per locale
│ ├── formatters/ # Date + number formatters
│ └── widgets/ # RTL DirectionalityBuilder
├── .claude/ # AI agent skills
│ ├── settings.json # Pre-approved tools
│ └── skills/
│ ├── component-design/ # Workflow A skill
│ ├── screen-design/ # Workflow B skill (adapts per framework)
│ ├── business-logic/ # Workflow C skill
│ └── monorepo-doctor/ # Structure check skill
├── pubspec.yaml # Workspace root
├── analysis_options.yaml # Strict production linting
├── ARCHITECTURE.md # Full architecture documentation
├── README.md # Project overview + getting started
├── LICENSE # License file (configurable via --license)
├── CONTRIBUTING.md # Contribution guidelines
└── .github/ # (opt-in via --github)
├── ISSUE_TEMPLATE/ # Bug report + feature request templates
├── pull_request_template.md # PR checklist
└── workflows/ci.yml # GitHub Actions CI pipeline
AI Agent Skills #
Every generated project includes .claude/skills/ — pre-configured skills for Claude Code that teach the AI agent your project's architecture and workflows:
| Skill | Trigger phrases | What it does |
|---|---|---|
component-design |
"Build a component", "Convert this Figma" | Workflow A — widget + companion state + tests |
screen-design |
"Build this screen", "Create a page" | Workflow B — controller + sections + tests |
business-logic |
"Implement this rule", "Add business logic" | Workflow C — core rules + network repo + wiring + tests |
monorepo-doctor |
"Check structure", "What's missing" | Run doctor to verify integrity |
The screen-design skill automatically adapts to your chosen state management (GetX controllers, Riverpod providers, Bloc events, or Cubit methods).
Skills are auto-discovered by Claude Code — no setup needed. Just open the project and start building.
Programmatic Usage #
You can also use this package programmatically in your Dart code:
import 'package:flutter_monorepo/flutter_monorepo.dart';
void main() async {
final config = ProjectConfig(
name: 'my_app',
org: 'com.example',
stateManagement: StateManagement.riverpod,
httpClient: HttpClient.dio,
locales: ['en', 'es', 'fr'],
platforms: ['android', 'ios', 'web'],
gitInit: true,
);
print(config.app); // my_app_app
print(config.pascal); // MyApp
print(config.primaryLocale); // en
print(config.usesGoRouter); // true
// Generate the full monorepo
final generator = Generator(config: config, rootPath: '/path/to/output');
await generator.run();
}
Example #
Check the example folder for a complete example of how to use this package programmatically and a full reference of all CLI options.
To run the example:
dart run example/main.dart
Requirements #
- Flutter SDK (stable channel)
- Dart SDK ^3.10.4
- Internet connection (for auto version resolution — falls back to bundled versions if offline)
Contributing #
Contributions are welcome! Please feel free to submit a Pull Request.
License #
This project is licensed under the MIT License - see the LICENSE file for details.
Support the Project #
If you find this package helpful, consider supporting it by Liking it on pub.dev
Connect with Me #
Feel free to reach out for questions, suggestions, or just to say hi!
- LinkedIn: LinkedIn Profile
- GitHub: GitHub Profile
Hire Me or Contact My Organization #
For freelance work or larger projects:
- Upwork Individual Profile: Individual Profile
- Upwork Agency: Agency Profile
For large scale developments or to discuss potential collaborations, please reach out via email at: im.msishamim@gmail.com
My Organization #
Increments Inc. #
Our software automates restaurants, optimizes energy, revolutionizes finance, improves healthcare, innovates education, streamlines garments, and drives paperless solutions. Increments Inc. is Bangladesh's #1 mobile app development agency.
Thank you for checking out Flutter Monorepo! I hope it saves you hours of setup time. Happy Coding!