πŸš€ Flutter Feature CLI

Generate Flutter feature architecture in seconds.

A lightweight CLI tool that scaffolds feature modules using popular architectural patterns such as Partial Clean Architecture, Clean Architecture, MVC, and MVVM.


✨ Features

  • Generate complete feature structures instantly

  • Supports multiple architecture templates:

    • Partial Clean Architecture
    • Clean Architecture
    • MVC
    • MVVM
  • Configurable output path via pubspec.yaml

  • Supports command-level path overrides

  • Auto-generates barrel exports (index.dart)

  • Reduces repetitive boilerplate code

  • Accepts snake_case, kebab-case, or camelCase feature names β€” normalized consistently either way

  • Never overwrites existing generated files unless --force is passed

  • Fully tested and production-ready


πŸ“¦ Installation

Add the package to your Flutter project:

dev_dependencies:
  flutter_feature_cli: ^1.1.1

Install dependencies:

flutter pub get

βš™οΈ Configuration (Optional)

Configure a default feature generation path in your project's pubspec.yaml.

flutter_feature_cli:
  path: lib/src/features

If omitted, the package falls back to:

lib/features

πŸš€ Create a Feature

Generate a feature using the default template (partial_clean):

dart run flutter_feature_cli create authentication

πŸ— Templates

Partial Clean Architecture (Default)

dart run flutter_feature_cli create authentication

Generated structure:

authentication/
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ data_sources/
β”‚   β”œβ”€β”€ entities/
β”‚   └── repository/
β”‚
β”œβ”€β”€ presentation/
β”‚   β”œβ”€β”€ view_models/
β”‚   └── widgets/
β”‚
└── index.dart

Clean Architecture

dart run flutter_feature_cli create authentication \
  --template clean_architecture

or

dart run flutter_feature_cli create authentication \
  -t clean_architecture

Generated structure:

authentication/
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ data_sources/
β”‚   β”œβ”€β”€ models/
β”‚   └── repositories/
β”‚
β”œβ”€β”€ domain/
β”‚   β”œβ”€β”€ entities/
β”‚   β”œβ”€β”€ repositories/
β”‚   └── use_cases/
β”‚
β”œβ”€β”€ presentation/
β”‚   β”œβ”€β”€ pages/
β”‚   β”œβ”€β”€ view_models/
β”‚   └── widgets/
β”‚
└── index.dart

MVC

dart run flutter_feature_cli create authentication \
  -t mvc

Generated structure:

authentication/
β”œβ”€β”€ models/
β”œβ”€β”€ controllers/
β”œβ”€β”€ views/
β”œβ”€β”€ widgets/
└── index.dart

MVVM

dart run flutter_feature_cli create authentication \
  -t mvvm

Generated structure:

authentication/
β”œβ”€β”€ models/
β”œβ”€β”€ view_models/
β”œβ”€β”€ views/
β”œβ”€β”€ widgets/
└── index.dart

🎯 Custom Output Path

Override the configured path directly from the command:

dart run flutter_feature_cli create authentication \
  --path lib/src/features

or

dart run flutter_feature_cli create authentication \
  -p lib/src/features

You can combine both options:

dart run flutter_feature_cli create authentication \
  -t clean_architecture \
  -p lib/src/features

The command-line path always takes precedence over the path configured in pubspec.yaml.


πŸ›‘ Overwrite Protection

By default, create never overwrites a file that already exists β€” safe to re-run on a feature you've already started editing:

dart run flutter_feature_cli create authentication
⚠️  Skipped (already exists): lib/features/authentication/data/repository/authentication_repository.dart

Pass --force (or -f) to explicitly overwrite existing generated files:

dart run flutter_feature_cli create authentication --force

πŸ’» Commands

Generate a feature:

dart run flutter_feature_cli create <feature_name>

Generate a feature using a specific template:

dart run flutter_feature_cli create <feature_name> \
  --template <template>

Generate a feature in a custom location:

dart run flutter_feature_cli create <feature_name> \
  --path <path>

Overwrite existing generated files:

dart run flutter_feature_cli create <feature_name> \
  --force

Available templates:

partial_clean
clean_architecture
mvc
mvvm

πŸ›£ Roadmap

  • Custom templates via pubspec.yaml
  • Entity generation
  • CRUD scaffolding
  • Project setup command
  • Bulk feature generation
  • Architecture validation
  • Feature merge utilities

🀝 Contributing

Contributions, issues, and feature requests are welcome.


πŸ“„ License

MIT License

Copyright (c) 2026 Hasan Shaikh - HasneticLabs

Libraries

flutter_feature_cli
Flutter Feature CLI.