arch_wizard 1.0.4 copy "arch_wizard: ^1.0.4" to clipboard
arch_wizard: ^1.0.4 copied to clipboard

A powerful CLI tool to scaffold Flutter clean architecture features...


Arch Wizard πŸ§™β€β™‚οΈβœ¨ #


Effortless Flutter Feature Scaffolding with Clean Architecture #

Stop writing boilerplate and start building features. Arch Wizard is a powerful, flexible command-line tool designed to automate the creation of entire feature modules for Flutter apps, all perfectly structured according to Clean Architecture principles. Save time, reduce repetitive code, and maintain consistency across your projects and teams.


✨ Key Features #

  • Automated Scaffolding: Generate a complete feature with domain, data, and presentation layers using a single command.
  • Clean Architecture Enforcement: Keep your code modular, testable, and maintainable.
  • Supports Multiple State Management Solutions: BLoC, Riverpod, GetX, and Provider.
  • Automatic Dependency Injection Registration: Seamlessly updates your get_it service locator setup.
  • Production-Ready Templates: Includes robust error handling and architecture best practices.
  • Automatic Global Failure Classes: When creating a feature, Arch Wizard automatically creates the global Failure classes and FailureMapper files (if they don't exist) in your project’s lib/core/error/ directory.

πŸš€ Installation #

Add arch_wizard to the flutter project:

flutter pub add arch_wizard

Install Arch Wizard globally via Dart's pub tool to use it anywhere:

dart pub global activate arch_wizard

Ensure your system's PATH includes pub global executables so the arch_wizard command is recognized.


πŸ›  Usage #

Step 1: Run the Feature Creation Command #

From the root of your Flutter project, run the main command:

arch_wizard create_feature --name <feature_name> --state <state_management>
  • Replace <feature_name> with your desired feature name (e.g., login).
  • Choose your preferred state management from bloc, riverpod, getx, or provider.

Step 2: Example Commands #

# Generate a Login feature using BLoC
arch_wizard create_feature --name login --state bloc

# Generate a Product feature using Riverpod
arch_wizard create_feature --name product --state riverpod

# Generate a Profile feature using GetX
arch_wizard create_feature --name profile --state getx

# Generate a Cart feature using Provider
arch_wizard create_feature --name cart --state provider

πŸ“ Generated File Structure #

Arch Wizard generates a complete and logically separated module for your feature. Here’s a look at the architecture.

General Structure #

All generated features follow this core layout, ensuring consistency and separation of concerns.

<your_project_name>/
└── lib/
    β”œβ”€β”€ core/
    β”‚   └── error/
    β”‚       β”œβ”€β”€ failure.dart              # (Auto-generated) Base Failure classes.
    β”‚       └── failure_mapper.dart       # (Auto-generated) Maps exceptions to Failures.
    β”‚
    β”œβ”€β”€ features/
    β”‚   └── <feature_name>/
    β”‚       β”œβ”€β”€ data/
    β”‚       β”‚   β”œβ”€β”€ datasources/
    β”‚       β”‚   β”‚   └── <feature_name>_remote_datasource.dart
    β”‚       β”‚   β”œβ”€β”€ models/
    β”‚       β”‚   β”‚   └── <feature_name>_model.dart
    β”‚       β”‚   └── repositories/
    β”‚       β”‚       └── <feature_name>_repository_impl.dart
    β”‚       β”œβ”€β”€ domain/
    β”‚       β”‚   β”œβ”€β”€ entities/
    β”‚       β”‚   β”‚   └── <feature_name>_entity.dart
    β”‚       β”‚   β”œβ”€β”€ repositories/
    β”‚       β”‚   β”‚   └── <feature_name>_repository.dart
    β”‚       β”‚   └── usecases/
    β”‚       β”‚       └── <feature_name>_usecase.dart
    β”‚       └── presentation/
    β”‚           # This layer's content changes based on the chosen state management.
    β”‚           # See examples below.
    β”‚
    └── injection_container.dart              # (MODIFIED) Automatically updated with new dependencies.

State Management Variations #

The presentation layer is tailored to your chosen state management solution. Here are the specific structures generated inside lib/features/<feature_name>/presentation/.

🧱 BLoC (--state bloc)

presentation/
β”œβ”€β”€ bloc/
β”‚   β”œβ”€β”€ <feature_name>_bloc.dart
β”‚   β”œβ”€β”€ <feature_name>_event.dart
β”‚   └── <feature_name>_state.dart
β”œβ”€β”€ pages/
β”‚   └── <feature_name>_page.dart
└── widgets/
    └── <feature_name>_widget.dart

🌊 Riverpod (--state riverpod)

presentation/
β”œβ”€β”€ notifiers/
β”‚   └── <feature_name>_state_notifier.dart
β”œβ”€β”€ pages/
β”‚   └── <feature_name>_page.dart
β”œβ”€β”€ providers/
β”‚   └── <feature_name>_providers.dart
└── widgets/
    └── <feature_name>_widget.dart

πŸš€ GetX (--state getx)

presentation/
β”œβ”€β”€ bindings/
β”‚   └── <feature_name>_binding.dart
β”œβ”€β”€ controllers/
β”‚   └── <feature_name>_controller.dart
β”œβ”€β”€ pages/
β”‚   └── <feature_name>_page.dart
└── widgets/
    └── <feature_name>_widget.dart

ChangeNotifier For Provider (--state provider)

presentation/
β”œβ”€β”€ pages/
β”‚   └── <feature_name>_page.dart
β”œβ”€β”€ providers/
β”‚   └── <feature_name>_provider.dart
└── widgets/
    └── <feature_name>_widget.dart

βš™οΈ Command Options #

Option Alias Description Allowed Values Default
--name -n Name of the feature to create Any valid string (e.g., login) β€”
--state -s State management approach bloc, riverpod, getx, provider bloc

πŸ’‘ Tips for Customization #

  • Generated templates include clear comments and TODOs to guide you in customizing API calls, UI, and business logic.
  • Supports multi-layer clean architecture, so you can replace or extend any layer independently.
  • Easily integrate with your existing codebase by following the generated file and folder structure.

🀝 Contributing #

Contributions are welcome! If you have suggestions for improvements or new features, feel free to open an issue or submit a pull request.


πŸ“œ License #

Arch Wizard is open-source software licensed under the MIT License. See the LICENSE file for details.


Happy coding! πŸŽ‰ #

Build clean, scalable Flutter apps faster with Arch Wizard.

5
likes
140
points
294
downloads

Publisher

unverified uploader

Weekly Downloads

A powerful CLI tool to scaffold Flutter clean architecture features...

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

args, equatable, get_it, mason_logger

More

Packages that depend on arch_wizard