flutter_archkit 0.0.3
flutter_archkit: ^0.0.3 copied to clipboard
An automated Flutter architecture generator (Clean, MVVM, MVC with Bloc, Cubit, Riverpod, Provider, GetX), feature module generator, and multi-flavor CLI configuration tool.
Flutter ArchKit #
A comprehensive Flutter Architecture CLI generator and multi-flavor configuration tool. flutter_archkit automates scaffolding Flutter projects with Clean, MVVM, or MVC architecture, state management (Bloc, Cubit, Riverpod, Provider, GetX), modular feature generators, and multi-flavor environment configurations.
Features #
- 🏗️ Interactive Project Generator (
archkit create): Scaffolds complete Flutter apps with interactive CLI prompts for Architecture, State Management, Organization ID, and Target Platforms. - ⚡ Feature Module Generator (
archkit feature <name>/archkit -f <name>): Instantly generates feature modules (auth,profile,home, etc.) matching your project's architecture. - 🔄 Smart Metadata Auto-Detection: Stores selected settings in
.metadataso feature generation works without requiring command flags. - 📂 Modular Template Engine: Clean templates for Clean Architecture (data, domain, presentation, di), MVVM (models, services, viewmodels, views), and MVC (models, controllers, views).
- 🤖 Android Flavor Setup: Automatically configures
productFlavorsandapplicationIdinandroid/app/flavor.gradle.ktsand links withbuild.gradle.kts. - 🍎 iOS Flavor Setup: Generates flavor
.xcconfigfiles, CocoaPods target dependencies (#include? Pods-Runner), shared.xcschemeschemes, patchesInfo.plist, updates Xcodeproject.pbxprojbuild configurations, and setsIPHONEOS_DEPLOYMENT_TARGET = 16.0. - ⚙️ Dart ServerConfig: Generates strongly-typed
lib/core/config/server_config.dartruntime environment configurations. - 💻 IDE Support: Automatically writes
.vscode/launch.jsonfor VS Code and.run/<flavor>.run.xmlrun configurations for Android Studio / IntelliJ IDEA.
Installation #
Activate flutter_archkit globally via Pub:
dart pub global activate flutter_archkit
Or add it to your project pubspec.yaml under dev_dependencies:
dev_dependencies:
flutter_archkit: ^0.0.3
Usage Guide #
1. Creating a New Flutter Project (archkit create) #
Run the interactive project creation wizard:
archkit create my_app
Interactive Prompts:
- Select Architecture:
Clean|MVVM|MVC - Select State Management:
Bloc|Cubit|Riverpod|Provider|GetX - Organization Identifier: e.g.,
com.example - Platforms:
Android,iOS,Web,Windows,macOS,Linux
Or pass parameters via command flags:
archkit create my_app --org com.example --architecture Clean --state-management Bloc --platforms android,ios
2. Scaffolding a Feature Module (archkit feature <name> / archkit -f <name>) #
Inside any project created with archkit, run:
archkit feature auth
or use the shortcut:
archkit -f auth
archkit auto-detects your project's architecture and state management from .metadata and generates the feature module matching your established code structure!
3. Multi-Flavor Setup (setup_flavor) #
Generate a sample flavor.yaml automatically:
dart run flutter_archkit:setup_flavor --init
Or create flavor.yaml manually in your project root:
flavors:
dev:
app:
name: "Example Dev"
baseUrl: "https://dev-api.example.com"
android:
applicationId: "com.example.app.dev"
ios:
bundleId: "com.example.app.dev"
prod:
app:
name: "Example"
baseUrl: "https://api.example.com"
android:
applicationId: "com.example.app"
ios:
bundleId: "com.example.app"
Validate your configuration:
dart run flutter_archkit:setup_flavor --validate
Execute the multi-flavor code generator:
dart run flutter_archkit:setup_flavor
Generated Architecture Layouts #
Clean Architecture (lib/features/auth/) #
lib/features/auth/
├── data/
│ ├── data_sources/
│ │ ├── auth_remote_datasource.dart
│ │ └── auth_remote_datasource_impl.dart
│ ├── models/
│ │ └── auth_model.dart
│ └── repositories/
│ └── auth_repository_impl.dart
├── di/
│ ├── auth_di.dart
│ └── auth_di.config.dart
├── domain/
│ ├── repositories/
│ │ └── auth_repository.dart
│ └── usecases/
│ └── auth_usecase.dart
└── presentation/
├── bloc/ (or cubit / riverpod / provider / controllers)
│ ├── auth_bloc.dart
│ ├── auth_event.dart
│ └── auth_state.dart
└── page/
└── auth_page.dart
MVVM Architecture (lib/) #
lib/
├── models/auth_model.dart
├── services/auth_service.dart
├── viewmodels/auth_provider.dart (or auth_viewmodel.dart / auth_bloc.dart / auth_controller.dart)
└── views/auth_view.dart
MVC Architecture (lib/) #
lib/
├── models/auth_model.dart
├── controllers/auth_controller.dart
└── views/auth_view.dart
License #
This project is licensed under the MIT License - see the LICENSE file for details.