flutter_clean_architect_gen 0.0.5 copy "flutter_clean_architect_gen: ^0.0.5" to clipboard
flutter_clean_architect_gen: ^0.0.5 copied to clipboard

A CLI tool to generate Clean Architecture structure in Flutter projects.

flutter_clean_architect_gen A powerful command-line tool that automatically generates a Clean Architecture folder structure for your Flutter projects β€” with built-in support for your favorite state management (Bloc, Cubit, Riverpod, Provider, GetX). Keep your app modular, scalable, and easy to maintain with one simple command.

Features Generate new feature modules instantly Supports multiple state management options (Bloc, Cubit, Riverpod, Provider, GetX) Remembers your last chosen state management automatically Reset anytime to switch your preference Initialize a full Clean Architecture folder structure Keeps your Flutter project organized, consistent, and clean

Installation Global installation (recommended) dart pub global activate flutter_clean_architect_gen Then use the CLI anywhere: flutter_clean_architect_gen create_feature auth

Local (dev) installation flutter pub add dev:flutter_clean_architect_gen Run it locally: dart run flutter_clean_architect_gen create_feature auth

Usage Run any of the following commands inside your Flutter project πŸ‘‡ Initialize Clean Architecture structure Creates the base folder structure for your project: dart run flutter_clean_architect_gen init βœ… Generated folders: lib/ β”œβ”€β”€ core/ β”‚ β”œβ”€β”€ constants/ β”‚ β”œβ”€β”€ errors/ β”‚ β”œβ”€β”€ network/ β”‚ β”œβ”€β”€ usecases/ β”‚ β”œβ”€β”€ utils/ β”‚ └── widgets/ β”œβ”€β”€ data/ β”‚ β”œβ”€β”€ datasources/ β”‚ β”œβ”€β”€ models/ β”‚ └── repositories/ β”œβ”€β”€ domain/ β”‚ β”œβ”€β”€ entities/ β”‚ β”œβ”€β”€ repositories/ β”‚ └── usecases/ └── features/

Create a new feature module To add a new feature (for example, auth, user, or home): dart run flutter_clean_architect_gen create_feature <feature_name>

Example: dart run flutter_clean_architect_gen create_feature auth

On first run, you’ll be asked which state management you want: 🧩 Which state management do you want to use? 1️⃣ Bloc 2️⃣ Cubit 3️⃣ Riverpod 4️⃣ Provider 5️⃣ GetX

Your choice will be saved automatically, so next time it won’t ask again.

Command Flags You can skip the prompt by directly specifying the state management: dart run flutter_clean_architect_gen create_feature auth --state=bloc

Reset stored state management choice To reset your saved preference and choose again: dart run flutter_clean_architect_gen reset

This clears your .flutter_clean_architect_config file.

Command Summary Command Description dart run flutter_clean_architect_gen init Initializes the base Clean Architecture folder structure dart run flutter_clean_architect_gen create_feature <feature_name> Creates a new feature module dart run flutter_clean_architect_gen create_feature <feature_name> --state=

Example Workflow

Step 1: Initialize structure #

dart run flutter_clean_architect_gen init

Step 2: Create a new feature (asks for state management) #

dart run flutter_clean_architect_gen create_feature auth

Step 3: Add more features (uses remembered state) #

dart run flutter_clean_architect_gen create_feature home dart run flutter_clean_architect_gen create_feature user

Step 4: Reset to change state management #

dart run flutter_clean_architect_gen reset

Output Example After creating multiple features: lib/ β”œβ”€β”€ core/ β”œβ”€β”€ data/ β”œβ”€β”€ domain/ └── features/ β”œβ”€β”€ auth/ β”‚ β”œβ”€β”€ data/ β”‚ β”œβ”€β”€ domain/ β”‚ └── presentation/ β”‚ β”œβ”€β”€ bloc/ β”‚ β”œβ”€β”€ pages/ β”‚ └── widgets/ β”œβ”€β”€ home/ └── user/

Demo Here’s how it looks in your terminal $ dart run flutter_clean_architect_gen create_feature auth 🧱 Flutter Clean Architect CLI

🧩 Which state management do you want to use? 1️⃣ Bloc 2️⃣ Cubit 3️⃣ Riverpod 4️⃣ Provider 5️⃣ GetX

Created: lib/features/auth/ Added folders: data, domain, presentation/bloc, widgets, pages Feature 'auth' created successfully!

Contributing Pull requests are welcome! If you’d like to improve this CLI, fork the repo and submit your ideas πŸš€ License MIT Β© 2025 β€” Built with ❀️ by Flutter Wajahat khan for Flutter developers.

13
likes
125
points
23
downloads

Publisher

unverified uploader

Weekly Downloads

A CLI tool to generate Clean Architecture structure in Flutter projects.

Documentation

API reference

License

MIT (license)

Dependencies

ansicolor, path

More

Packages that depend on flutter_clean_architect_gen