generate_structure 1.0.1
generate_structure: ^1.0.1 copied to clipboard
A CLI tool to generate folder structures (MVVM, MVC, MVP, Clean Architecture, Feature-based) for Flutter projects.
🏗 generate_structure #
🛠️ A Dart CLI tool to generate clean folder structures for your Flutter projects — in seconds.
Say goodbye to repeating the same folders every time you start a new screen or feature. Just run one command and get your project or screen structure ready with your favorite architecture style.
✨ Features #
-
Scaffold Flutter app or feature folder structure instantly
-
Supports the following architectures:
- ✅ MVVM (Model-View-ViewModel)
- ✅ MVC (Model-View-Controller)
- ✅ MVP (Model-View-Presenter)
- ✅ Clean Architecture
- ✅ Feature-based (simple modular)
-
Interactive prompts:
- Choose between whole app structure or single feature
- Choose structure type
- Auto handle duplicates
🚀 Installation #
Install globally using Dart:
dart pub global activate generate_structure
Ensure global executables are in your PATH:
Mac/Linux:
bash
Copy
Edit
export PATH="$PATH":"$HOME/.pub-cache/bin"
Windows (PowerShell):
powershell
Copy
Edit
$env:PATH += ";$env:USERPROFILE\AppData\Local\Pub\Cache\bin"
⚙️ Usage
Just run:
bash
Copy
Edit
generate_structure
And follow the interactive steps:
Select: Whole Application or Single Feature
Choose: Structure Type (MVVM, MVC, etc.)
(If Feature) Enter: Feature name (e.g. auth, profile)
📁 Example Output by Structure
🔷 MVVM (feature: auth)
kotlin
Copy
Edit
lib/
├── core/
│ ├── utils/
│ └── services/
├── features/
│ └── auth/
│ ├── data/
│ │ ├── models/
│ │ └── repo/
│ └── presentation/
│ ├── cubit/
│ └── view/
│ └── widgets/
🔶 MVC (feature: profile)
sql
Copy
Edit
lib/
├── core/
├── features/
│ └── profile/
│ ├── model/
│ ├── view/
│ └── controller/
🟢 MVP (feature: home)
arduino
Copy
Edit
lib/
├── core/
├── features/
│ └── home/
│ ├── model/
│ ├── view/
│ └── presenter/
⚪ Clean Architecture (feature: orders)
kotlin
Copy
Edit
lib/
├── core/
├── features/
│ └── orders/
│ ├── data/
│ │ ├── datasources/
│ │ └── repositories/
│ ├── domain/
│ │ ├── entities/
│ │ ├── repositories/
│ │ └── usecases/
│ └── presentation/
│ ├── cubit/
│ └── views/
🔸 Feature-Based Simple (feature: cart)
kotlin
Copy
Edit
lib/
├── features/
│ └── cart/
│ ├── data/
│ ├── view/
│ └── logic/
🔄 Updating the Tool
To update to the latest version:
bash
Copy
Edit
dart pub global activate generate_structure
📤 Publishing This Package (for contributors)
To publish this CLI package on pub.dev:
1. Add LICENSE File (e.g., MIT License)
2. Add Metadata to pubspec.yaml:
yaml
Copy
Edit
executables:
generate_structure: generate_structure
3. Run:
bash
Copy
Edit
dart pub publish --dry-run
dart pub publish
🤝 Contributing
Pull requests are welcome!