flutter_structure_maker 1.0.2
flutter_structure_maker: ^1.0.2 copied to clipboard
A simple CLI tool to generate folder structure for Flutter projects automatically.
Flutter Structure Maker 🚀 #
A command-line tool to quickly generate organized folder structures for Flutter projects. Save time and maintain consistency across your Flutter applications with pre-defined architectural patterns.
Features #
✨ Multiple Architecture Patterns
- Basic structure for simple projects
- MVC (Model-View-Controller) pattern
- GetX architecture pattern
- BLoC (Business Logic Component) pattern
- Cubit pattern
- Provider pattern
🎯 Quick Setup
- Generate folder structure with a single command
- Auto-creates
main.dartwith pattern-specific boilerplate if it doesn't exist - Supports recursive directory creation
📦 Lightweight
- Minimal dependencies (only
argspackage) - Fast execution
- Easy to use
Installation #
Add this to your pubspec.yaml:
dependencies:
args: ^2.0.0
Or install globally:
dart pub global activate flutter_structure_maker
Usage #
Basic Usage #
Navigate to your Flutter project root and run:
dart run flutter_structure_maker
This creates a basic folder structure:
lib/
├── controllers/
├── views/
├── models/
├── services/
└── utils/
With Patterns #
MVC Pattern:
dart run flutter_structure_maker --pattern mvc
# or
dart run flutter_structure_maker -p mvc
Creates:
lib/
├── controllers/
├── views/
└── models/
GetX Pattern:
dart run flutter_structure_maker --pattern getx
Creates:
lib/
└── app/
├── modules/
├── routes/
├── controllers/
├── services/
└── widgets/
BLoC Pattern:
dart run flutter_structure_maker --pattern bloc
Creates:
lib/
├── blocs/
├── models/
├── repositories/
├── screens/
├── widgets/
├── services/
└── utils/
Cubit Pattern:
dart run flutter_structure_maker --pattern cubit
Creates:
lib/
├── cubits/
├── models/
├── repositories/
├── screens/
├── widgets/
├── services/
└── utils/
Provider Pattern:
dart run flutter_structure_maker --pattern provider
Creates:
lib/
├── providers/
├── models/
├── screens/
├── widgets/
├── services/
└── utils/
Command-Line Options #
| Option | Alias | Description | Default |
|---|---|---|---|
--pattern |
-p |
Architecture pattern (basic, mvc, getx, bloc, cubit, provider) | basic |
--help |
-h |
Show usage information | - |
Examples #
# Show help
dart run flutter_structure_maker --help
dart run flutter_structure_maker -h
# Create MVC structure
dart run flutter_structure_maker -p mvc
# Create GetX structure
dart run flutter_structure_maker -p getx
# Create BLoC structure
dart run flutter_structure_maker -p bloc
# Create Cubit structure
dart run flutter_structure_maker -p cubit
# Create Provider structure
dart run flutter_structure_maker -p provider
Supported Patterns #
Basic #
General-purpose structure suitable for most Flutter projects:
controllers/- Business logic and state managementviews/- UI screens and pagesmodels/- Data models and entitiesservices/- API calls, database operationsutils/- Helper functions and constants
MVC (Model-View-Controller) #
Classic architectural pattern for Flutter:
controllers/- Application logicviews/- UI componentsmodels/- Data structures
GetX #
Optimized for GetX state management:
app/modules/- Feature modulesapp/routes/- Navigation routingapp/controllers/- GetX controllersapp/services/- API and data servicesapp/widgets/- Reusable widgets
BLoC (Business Logic Component) #
Using flutter_bloc package:
blocs/- BLoC classes for state managementmodels/- Data modelsrepositories/- Data layerscreens/- UI screenswidgets/- Reusable widgetsservices/- External servicesutils/- Utilities and helpers
Cubit #
Simplified version of BLoC:
cubits/- Cubit classes for state managementmodels/- Data modelsrepositories/- Data layerscreens/- UI screenswidgets/- Reusable widgetsservices/- External servicesutils/- Utilities and helpers
Provider #
Using provider package for state management:
providers/- Provider classesmodels/- Data modelsscreens/- UI screenswidgets/- Reusable widgetsservices/- External servicesutils/- Utilities and helpers
What Gets Generated #
Each pattern generates:
- Folder structure - Organized directories based on the chosen pattern
- main.dart file - Pattern-specific boilerplate code (only if the file doesn't exist)
The generated main.dart includes:
- Proper imports for the selected pattern (GetX, BLoC, Provider, etc.)
- Basic app structure
- Example home screen
- Pattern-specific setup (MaterialApp, GetMaterialApp, MultiProvider, etc.)
Requirements #
environment:
sdk: ">=2.12.0 <4.0.0"
dependencies:
args: ^2.0.0
For pattern-specific dependencies, add to your pubspec.yaml:
GetX:
dependencies:
get: ^4.6.0
BLoC/Cubit:
dependencies:
flutter_bloc: ^8.0.0
Provider:
dependencies:
provider: ^6.0.0
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.
Author #
Created with ❤️ for the Flutter community
Changelog #
See CHANGELOG.md for version history.
Support #
- 🐛 Found a bug? Open an issue
- 💡 Have a feature request? Start a discussion
- ⭐ Like this package? Give it a star on GitHub
Tips #
- Run this tool at the root of your Flutter project (where
pubspec.yamlis located) - The tool will not overwrite an existing
main.dartfile - All folders are created recursively, so parent directories are created automatically
- Choose the pattern that matches your project's state management approach