flutter_bunny 1.0.6-beta.5 copy "flutter_bunny: ^1.0.6-beta.5" to clipboard
flutter_bunny: ^1.0.6-beta.5 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.

Pub Version License: MIT

πŸ“š 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.5

# 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/pages
  • widget - Reusable UI components
  • model - 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:

  1. Create a custom template in the ~/.flutter_bunny/templates/ directory
  2. 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.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. 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: