flutter_bunny 1.0.6-beta.4
flutter_bunny: ^1.0.6-beta.4 copied to clipboard
A CLI tool for creating and managing Flutter applications with best practices
π° Flutter Bunny CLI (Beta) #
A powerful CLI tool for creating and managing Flutter applications with best practices and consistent architecture.
π Overview #
Flutter Bunny is an opinionated CLI tool that helps you create, manage, and maintain Flutter applications with a focus on:
- Best practices - Follow Flutter community best practices for code organization and patterns
- Consistent architecture - Choose from popular architecture patterns (Clean Architecture, MVVM, MVC)
- Rapid development - Generate common components with a single command
- Testing - Built-in testing templates and utilities
- Project maintenance - Tools to keep your project organized and up-to-date
Beta Installation #
dart pub global activate flutter_bunny 1.0.6-beta.4
# Verify installation
flutter_bunny --version
Make sure the pub cache bin directory is in your PATH.
ποΈ Commands #
Creating a New Flutter Project #
# Create a new Flutter application interactively
flutter_bunny create app
# Create with specific options
flutter_bunny create app --name my_awesome_app --architecture clean_architecture --state-management riverpod
During creation, you'll be guided through selecting:
- Project name and organization
- Architecture pattern (Clean Architecture, MVVM, MVC)
- State management solution (Provider, Riverpod, Bloc, GetX, etc.)
- Core features and modules to include
Generating Components #
Generate various application components with best practices baked in:
# Generate a new screen
flutter_bunny generate screen --name HomeScreen
# Generate a stateful widget
flutter_bunny generate widget --name CustomButton --stateful
# Generate a data model with JSON serialization
flutter_bunny generate model --name User --fields "id:int,name:String,email:String,createdAt:DateTime" --json
The generate command supports the following component types:
screen
- Application screens/pageswidget
- Reusable UI componentsmodel
- Data models with optional JSON serialization
Updating the CLI #
# Update to the latest version
flutter_bunny update
π Project Structure #
Projects created with Flutter Bunny follow a consistent structure based on your chosen architecture:
Clean Architecture Structure #
lib/
βββ core/
β βββ errors/
β βββ network/
β βββ utils/
β βββ theme/
βββ data/
β βββ datasources/
β βββ models/
β βββ repositories/
βββ domain/
β βββ entities/
β βββ repositories/
β βββ usecases/
βββ presentation/
β βββ blocs/
β βββ pages/
β βββ widgets/
βββ main.dart
MVVM Architecture Structure #
lib/
βββ models/
βββ services/
βββ view_models/
βββ views/
β βββ screens/
β βββ widgets/
βββ main.dart
MVC Architecture Structure #
lib/
βββ models/
βββ services/
βββ views/
β βββ controllers/
β βββ models/
β βββ views/
βββ main.dart
π¨ Customization #
Configuration #
Flutter Bunny uses a configuration file to store your preferences. You can edit this file directly or use the command-line options to override settings.
# View current configuration
flutter_bunny config show
# Set a configuration value
flutter_bunny config set default_architecture clean_architecture
Templates #
Templates used by Flutter Bunny can be customized to match your team's specific requirements:
- Create a custom template in the
~/.flutter_bunny/templates/
directory - Use your custom template with the
--template
flag:
flutter_bunny create app --template custom_template
π§ͺ Testing #
Projects created with Flutter Bunny are set up with comprehensive testing utilities:
- Unit Tests - For business logic, models, and utilities
- Widget Tests - For UI components
- Integration Tests - For feature workflows
Run tests using the built-in commands:
# Run all tests
flutter_bunny test
# Run specific tests
flutter_bunny test --type unit
π Architecture Options #
Flutter Bunny supports multiple architecture patterns:
Clean Architecture #
Separates your application into layers with clear responsibilities:
- Presentation Layer - UI components, pages and state management
- Domain Layer - Business logic, entities and use cases
- Data Layer - Data sources, repositories and models
MVVM (Model-View-ViewModel) #
Separates UI logic from business logic:
- Model - Data and business logic
- View - UI components with minimal logic
- ViewModel - Mediator between Model and View
MVC (Model-View-Controller) #
Classic pattern for separating concerns:
- Model - Data and business logic
- View - UI components
- Controller - Handles user input and updates models/views
π§© State Management Options #
Flutter Bunny supports multiple state management solutions:
- Provider - Simple and flexible state management
- Riverpod - Evolution of Provider with improved patterns
- Bloc/Cubit - Predictable state management with events and states
- GetX - Lightweight state management with utilities
- MobX - Reactive state management
- Redux - Predictable state container
π§ Common Tasks #
Analyzing Code #
# Run static analysis
flutter_bunny analyze
Running Doctor #
# Check for issues
flutter_bunny doctor
π€ Contributing #
Contributions are welcome! Please read our contributing guidelines first.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
π License #
Flutter Bunny is available under the MIT license. See the LICENSE file for more info.
π Support #
If you encounter any issues or have questions:
- Open an issue
- Check documentation