🚀 Flutter Clean Gen

A beautiful, interactive CLI tool to generate complete Flutter Clean Architecture boilerplate code with custom entities and properties.

✨ Features

  • 🎨 Beautiful, colorful terminal interface
  • 🏗️ Complete Clean Architecture structure
  • 📦 Custom entity/model generation with properties
  • 🔄 Automatic BLoC pattern setup
  • 🎯 Type-safe code generation
  • 📱 Ready-to-use UI pages

📦 Installation

dart pub global activate flutter_clean_gen

Run without installing

dart pub global activate --source path .

🎯 Usage

Simply run:

flutter_clean_gen

Follow the interactive prompts:

  1. Enter feature name: e.g., user, product, order
  2. Define properties: Format: name:type:nullable
    • Example: id:String:false
    • Example: age:int:true
  3. Confirm generation

Example Session

Enter feature name: user
Property 1: id:String:false
Property 2: name:String:false
Property 3: email:String:false
Property 4: age:int:true
Property 5: done

📁 Generated Structure

lib/features/user/
├── data/
│   ├── datasources/
│   │   ├── user_remote_data_source.dart
│   │   └── user_remote_data_source_impl.dart
│   ├── models/
│   │   └── user_model.dart
│   └── repositories/
│       └── user_repository_impl.dart
├── domain/
│   ├── entities/
│   │   └── user.dart
│   ├── repositories/
│   │   └── user_repository.dart
│   └── usecases/
│       └── user_usecases.dart
└── presentation/
    ├── bloc/
    │   ├── user_bloc.dart
    │   ├── user_event.dart
    │   └── user_state.dart
    └── pages/
        └── user_page.dart

📦 Required Dependencies

Add these to your Flutter project's pubspec.yaml:

dependencies:
  flutter_bloc: ^8.1.3
  equatable: ^2.0.5
  dartz: ^0.10.1
  http: ^1.1.0

🛠️ Next Steps After Generation

  1. Create core error classes (lib/core/error/failures.dart, exceptions.dart)
  2. Create UseCase base class (lib/core/usecases/usecase.dart)
  3. Set up dependency injection (GetIt, Injectable, etc.)
  4. Update API endpoints in the data source implementation

📄 License

MIT License

Libraries