Flutter MVVM Start Kit
A powerful CLI tool to scaffold Flutter projects with MVVM (Model-View-ViewModel) architecture using Riverpod for state management. Speed up your Flutter development by generating boilerplate code with a single command.
✨ Features
- 🚀 Quick Project Setup: Create a new Flutter project with pre-configured MVVM folder structure
- 🎯 Code Generation: Generate View, ViewModel, and Provider files automatically
- 📁 Organized Structure: Creates a clean, scalable folder structure following best practices
- 🔄 Riverpod Integration: Uses flutter_riverpod for efficient state management
- ⚡ Time Saver: Eliminate repetitive boilerplate code writing
📦 Installation
Activate the package globally:
dart pub global activate flutter_mvvm_startkit
Make sure your PATH includes the Dart pub global bin directory.
🚀 Usage
Create a New Flutter MVVM Project
flutter_mvvm_startkit create my_awesome_app
This will:
- Create a new Flutter project named
my_awesome_app - Set up the following folder structure:
lib/ ├── view/ ├── data/ │ ├── models/ │ └── repositories/ ├── providers/ ├── utils/ └── widgets/
Generate a New MVVM View
Navigate to your Flutter project directory and run:
flutter_mvvm_startkit generate view home
This will create:
lib/view/home/home_view.dart- The UI widgetlib/view/home/home_viewmodel.dart- The business logic and statelib/providers/home_provider.dart- The Riverpod provider
The generated files are ready to use with proper imports and basic implementation!
📋 Generated Code Structure
View
A ConsumerWidget that watches the ViewModel state and responds to user interactions.
ViewModel
A StateNotifier that manages the state and contains business logic.
Provider
A StateNotifierProvider that connects the View and ViewModel.
🛠️ Requirements
- Dart SDK: >=3.0.0 <4.0.0
- Flutter SDK (for using generated projects)
🤝 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.
🐛 Issues
Found a bug or have a feature request? Please open an issue.
💡 Example
After generating a view named "profile", you'll get:
// profile_view.dart
class ProfileView extends ConsumerWidget {
// Pre-configured with Riverpod integration
}
// profile_viewmodel.dart
class ProfileViewModel extends StateNotifier<ProfileState> {
// State management ready to use
}
// profile_provider.dart
final profileViewModelProvider = StateNotifierProvider...
Just import and use in your app!
Libraries
- flutter_mvvm_startkit
- Flutter MVVM Start Kit - A CLI tool to scaffold Flutter projects with MVVM architecture.