Skip to content

🐰 A Powerful CLI tool for creating and managing Flutter applications with best practices and ⚑️ consistent architecture

License

Notifications You must be signed in to change notification settings

demola234/flutter_bunny_cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🐰 Flutter Bunny CLI

A powerful CLI tool for creating and managing Flutter applications with best practices and consistent architecture.

Pub Version License: MIT Docs

Example

πŸ“š 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
  • Consistent architecture β€” Choose Clean Architecture, MVVM, or MVC
  • Rapid development β€” Generate components quickly
  • Testing support β€” Templates for unit, widget, and integration tests
  • Project maintenance β€” Keep your project organized and up-to-date

πŸš€ Installation

Using Dart

dart pub global activate flutter_bunny 1.1.1

# Verify installation
flutter_bunny --version

Make sure the pub cache bin directory is in your PATH.


Using Homebrew (macOS)

brew tap demola234/homebrew-tap
brew install flutter_bunny

πŸ—οΈ Available Commands

Command Description
create Create a new Flutter app interactively
generate Generate screens, widgets, models, and more
analyze Run static analysis
build Run build_runner
update Update Flutter Bunny CLI
config Manage configuration settings
doctor Check Flutter project health

Run flutter_bunny help <command> for detailed usage.


πŸ› οΈ Creating a New Flutter Project

flutter_bunny create app

You'll be guided through selecting:

  • Project name and organization
  • Architecture pattern (Clean Architecture, MVVM, MVC)
  • State management (Provider, Riverpod, Bloc, etc.)
  • Features and modules to include

Example with specific options:

flutter_bunny create app --name my_awesome_app --architecture clean_architecture --state-management riverpod

✨ Generating Models

You can now generate models interactively, from JSON samples, or with specific serialization methods.

Commands

# Start an interactive session
flutter_bunny generate model --name User

# Generate a model with specific serializer
flutter_bunny generate model --name Product --serializer json_serializable

# Generate a model from a JSON string
flutter_bunny generate model --name User --json '{"id": 1, "name": "John", "email": "john@example.com"}'

# Generate in non-interactive mode
flutter_bunny generate model --name Order --interactive false

Options

Option Description
--name or -n (Required in non-interactive mode) Model name
--directory or -d Directory to create model (default: lib/models)
--serializer or -s Serialization method: freezed, json_serializable (default), manual, or equatable
--interactive or -i Use interactive mode (default: true)
--json Provide a JSON sample or path to generate the model

Interactive Mode

When enabled (--interactive true):

  • Prompt for model name
  • Choose serialization method
  • Enter JSON manually or load from file
  • Detect nested models and generate them
  • Suggest dependencies like freezed_annotation, json_serializable

Examples

Generate Model with Interactive Configuration

flutter_bunny generate model

Generate Product Model Using Freezed

flutter_bunny generate model --name Product --serializer freezed

Generate Model from JSON File

flutter_bunny generate model --name ApiResponse --json path/to/sample.json

Generate Multiple Models from Complex JSON

flutter_bunny generate model --name Order --json '{"id": 123, "items": [{"productId": 1, "quantity": 2}], "customer": {"id": 456, "name": "John Doe"}}'

Generated Output

  • Model files created in lib/models
  • Correct serialization setup
  • Imports and part files generated if needed
  • Dependency suggestions provided
  • Build runner commands shared

πŸ“‹ Project Structure Examples

Clean Architecture

lib/
β”œβ”€β”€ core/
β”‚   β”œβ”€β”€ errors/
β”‚   β”œβ”€β”€ network/
β”‚   β”œβ”€β”€ utils/
β”‚   └── theme/
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ datasources/
β”‚   β”œβ”€β”€ models/
β”‚   └── repositories/
β”œβ”€β”€ domain/
β”‚   β”œβ”€β”€ entities/
β”‚   β”œβ”€β”€ repositories/
β”‚   └── usecases/
β”œβ”€β”€ presentation/
β”‚   β”œβ”€β”€ blocs/
β”‚   β”œβ”€β”€ pages/
β”‚   └── widgets/
└── main.dart

MVVM

lib/
β”œβ”€β”€ models/
β”œβ”€β”€ services/
β”œβ”€β”€ view_models/
β”œβ”€β”€ views/
β”‚   β”œβ”€β”€ screens/
β”‚   └── widgets/
└── main.dart

MVC

lib/
β”œβ”€β”€ models/
β”œβ”€β”€ services/
β”œβ”€β”€ views/
β”‚   β”œβ”€β”€ controllers/
β”‚   β”œβ”€β”€ models/
β”‚   └── views/
└── main.dart

🧩 Supported State Management Options

  • Provider
  • Riverpod
  • Bloc/Cubit
  • GetX
  • MobX
  • Redux

πŸ§ͺ Testing Utilities

Projects are scaffolded with testing support:

# Run all tests
flutter_bunny test

# Run unit tests only
flutter_bunny test --type unit

Includes:

  • Unit Tests
  • Widget Tests
  • Integration Tests

πŸ”§ Maintenance Commands

# Analyze the project
flutter_bunny analyze

# Check project health
flutter_bunny doctor

# Update CLI
flutter_bunny update

🎨 Configuration and Custom Templates

# Show current config
flutter_bunny config show

# Set defaults (e.g., architecture)
flutter_bunny config set default_architecture clean_architecture

You can also create custom templates under ~/.flutter_bunny/templates/.


🀝 Contributing

Contributions are welcome! Please:

  1. Fork the repo
  2. Create a feature branch
  3. Submit a Pull Request

Check the CONTRIBUTING.md for details.


πŸ“„ License

Licensed under the MIT License.


πŸ“ž Support

About

🐰 A Powerful CLI tool for creating and managing Flutter applications with best practices and ⚑️ consistent architecture

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published