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

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, 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.5-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/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

๐ŸŽจ 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 #

Adding Dependencies #

# Add common dependencies
flutter_bunny add package http dio shared_preferences

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: