fast_clean_generator 1.1.0 copy "fast_clean_generator: ^1.1.0" to clipboard
fast_clean_generator: ^1.1.0 copied to clipboard

A powerful code generator for Clean Architecture in Flutter projects

🚀 Fast Clean Generator #

A powerful, interactive CLI tool designed to accelerate Flutter development by generating boilerplate code following Clean Architecture principles and GetX state management.

Dart CI Pub Version License: MIT


✨ Features #

  • 🚀 New: Project Initialization: Instantly scaffold a full Clean Architecture base (init command).
  • 🏗️ Complete Layer Generation: Automatically creates Domain, Data, and Presentation layers.
  • 🧠 Recursive Class Generation: Automatically generates nested Entities and Models from a single complex JSON.
  • 🎮 Smart GetX Integration:
    • Generates Plural Controllers for list management.
    • Generates Singular Controllers for item details and editing.
    • Automatic Binding registration and dependency injection.
  • 📦 CRUD Support: Choose which operations you need (List, Get, Add, Update, Delete).
  • 📝 JSON to Model: Converts your JSON schema into robust Entities and Models with fromJson/toJson.
  • 🛣️ Smart Routing: Automatically updates your application routes and pages.
  • 💻 Interactive CLI: Friendly prompts to guide you through the process.
  • Safe Generation: Protects your custom code by not overwriting existing core files.

📦 Installation #

To use fast_clean_generator globally on your machine, run:

dart pub global activate fast_clean_generator

🚀 Getting Started #

1. Initialize Your Project #

Before generating features, set up the standard Clean Architecture folders and core files:

# Navigate to your Flutter project root
fcg init

This command creates the core structure, essential base classes (BaseUseCase, Failure, etc.), and adds required dependencies (get, dartz, equatable) to your pubspec.yaml.

2. Generate a Feature #

Once initialized, you can start generating full-stack modules:

fcg generate

🛠️ Interactive Prompts #

The tool will ask you for:

  • JSON Input: Path to a .json file or a raw JSON string representing your data model.
  • Feature Name: The name of the module (e.g., booking, profile).
  • Root Class: The main class name in PascalCase (e.g., Booking, User).
  • CRUD Selection: Which operations you want to implement.
  • Component Selection: Fine-tune which files (Entities, UseCases, Controllers, etc.) should be generated.

📂 Generated Structure #

The tool generates a clean, scalable folder structure:

lib/features/your_feature/
├── data/
│   ├── data_sources/    # Remote API implementations
│   ├── models/          # JSON serialization logic
│   └── repositories/    # Repository implementations
├── domain/
│   ├── entities/        # Business logic models (Equatable)
│   ├── repositories/    # Abstract interfaces
│   └── usecases/        # Single-responsibility logic units
├── presentation/
│   ├── bindings/        # GetX Dependency Injection
│   ├── controllers/     # Plural & Singular controllers
│   ├── pages/           # List, Add, Edit & Detail screens
│   └── widgets/         # Feature-specific forms & dialogs
└── routes/              # Local feature routes

📋 Example JSON Schema #

Save this as model.json to test the generator:

{
  "id": 1,
  "title": "Clean Architecture",
  "is_completed": false,
  "priority": "high",
  "created_at": "2023-12-31"
}

✅ Quality Assurance #

This project is built with stability in mind:

  • Linting: Strictly follows Dart's recommended analysis options.
  • Testing: 45+ Unit and Integration tests covering naming logic, recursive JSON parsing, and incremental code generation.
  • CI/CD: Automated GitHub Actions to verify every commit.

🤝 Contributing #

Contributions are welcome! If you find a bug or have a feature request, please open an issue or submit a pull request on GitHub.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📄 License #

This project is licensed under the MIT License - see the LICENSE file for details.


☕ Support #

If you find this tool helpful, consider giving it a ⭐ on GitHub!

Developed with ❤️ by Saeid Parvizi

4
likes
160
points
109
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A powerful code generator for Clean Architecture in Flutter projects

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

args, json_annotation, path

More

Packages that depend on fast_clean_generator