Skip to main content

flutter_clean_arch_generator 1.0.1 copy "flutter_clean_arch_generator: ^1.0.1" to clipboard
flutter_clean_arch_generator: ^1.0.1 copied to clipboard

A Dart CLI tool that generates Flutter projects and features following the Clean Architecture pattern.

Flutter Clean Architecture Generator #

A Dart CLI tool that generates Flutter projects and features following the Clean Architecture pattern. This tool scaffolds production-ready Flutter apps with proper separation of concerns, dependency injection, routing, and best practices.

Installation #

dart pub global activate flutter_clean_arch_generator

Or add it to your pubspec.yaml:

dev_dependencies:
  flutter_clean_arch_generator: ^1.0.0

CLI Usage #

The CLI executable is clean_arch_gen.

Initialize a new project #

clean_arch_gen init --name my_app --path ./projects --base-url https://api.example.com --api-version api

Options:

  • -n, --name - Project name (default: my_app)
  • -p, --path - Output path (default: current directory)
  • --base-url - Base API URL (default: https://api.example.com)
  • --api-version - API version prefix (default: api)

Generate a new feature #

clean_arch_gen feature --name user --project ./projects/my_app

Options:

  • -n, --name - Feature name (required)
  • -p, --project - Project path (default: current directory)

Generated Project Structure #

lib/
├── core/
│   ├── config/
│   │   ├── app_config.dart
│   │   ├── global.dart
│   │   └── injection.dart
│   ├── error/
│   │   └── failure.dart
│   ├── navigation/
│   │   └── app_router.dart
│   └── network/
│       └── dio_client.dart
├── features/
│   ├── splash/
│   │   ├── data/
│   │   │   ├── datasources/
│   │   │   ├── models/
│   │   │   └── repositories/
│   │   ├── domain/
│   │   │   ├── entities/
│   │   │   ├── repositories/
│   │   │   └── usecases/
│   │   └── presentation/
│   │       ├── bloc/
│   │       └── pages/
│   └── home/
│       └── presentation/
│           └── pages/
├── shared/
│   ├── constants/
│   │   ├── string/
│   │   └── types/
│   ├── helper/
│   ├── services/
│   ├── theme/
│   └── widgets/
└── main.dart

Generated Feature Structure #

When you generate a new feature, the following layers are created:

features/
└── <feature_name>/
    ├── domain/
    │   ├── entities/<feature_name>.dart
    │   ├── repositories/<feature_name>_repository.dart
    │   └── usecases/<usecase_name>_usecase.dart
    ├── data/
    │   ├── datasources/
    │   │   ├── <feature_name>_remote_data_source.dart
    │   │   └── <feature_name>_local_data_source.dart
    │   ├── models/<feature_name>_model.dart
    │   └── repositories/<feature_name>_repository_impl.dart
    └── presentation/
        ├── bloc/
        │   ├── <feature_name>_bloc.dart
        │   ├── <feature_name>_event.dart
        │   └── <feature_name>_state.dart
        ├── pages/<feature_name>_page.dart
        └── widgets/

Key Features #

  • Clean Architecture - Proper separation of domain, data, and presentation layers
  • BLoC Pattern - State management using flutter_bloc
  • Dependency Injection - GetIt setup out of the box
  • Dio Client - Configured HTTP client with interceptors
  • Dartz Either - Functional error handling
  • Go Router - Type-safe routing
  • Shared Utilities - Theme, helpers, constants, and widgets

Dependencies #

The generated project includes:

  • flutter_bloc - State management
  • equatable - Value comparison
  • get_it - Dependency injection
  • dio - HTTP networking
  • dartz - Functional programming (Either)
  • go_router - Navigation
  • shared_preferences - Local storage
  • flutter_screenutil - Responsive UI

Contributing #

Contributions are welcome! Please feel free to submit a Pull Request.

5
likes
0
points
170
downloads

Publisher

unverified uploader

Weekly Downloads

A Dart CLI tool that generates Flutter projects and features following the Clean Architecture pattern.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

args, path, yaml

More

Packages that depend on flutter_clean_arch_generator