flutter_clean_architect_gen 0.0.5
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.