A Mason brick for generating Clean Architecture feature modules in Flutter projects.
This brick generates a complete feature module following Clean Architecture principles with:
- Domain Layer: Entities, repositories (interfaces), and use cases
- Data Layer: Models, data sources, and repository implementations
- Presentation Layer: BLoC state management with pages and widgets
- Tests: Unit tests for all use cases and data layer components
mason add featuremason make featureOr add from Git:
mason add feature --git-url https://github.com/tranvu1805/feature_add.git| Variable | Description | Default | Type |
|---|---|---|---|
feature_name |
The name of the feature | example_feature | string |
Note: The project_name variable is automatically extracted from your pubspec.yaml by the pre-generation hook.
- Use only alphanumeric characters and underscores for feature names
- No unicode characters, special characters, or spaces
- Examples:
user,product_catalog,order_history
lib/features/{feature_name}/
├── data/
│ ├── data_source/ # Remote data sources
│ ├── models/ # Data models
│ ├── repositories/ # Repository implementations
│ └── data.dart # Data layer barrel file
├── domain/
│ ├── entities/ # Domain entities
│ ├── repositories/ # Repository interfaces
│ ├── use_cases/ # Business logic (CRUD operations)
│ │ └── use_cases.dart # Use cases barrel file
│ └── domain.dart # Domain layer barrel file
└── presentation/
├── bloc/ # BLoC state management
├── pages/ # UI pages
│ └── pages.dart # Pages barrel file
├── widgets/ # Reusable widgets
│ └── widgets.dart # Widgets barrel file
└── presentation.dart # Presentation layer barrel file
Get{Feature}UseCase- Fetch single itemGet{Feature}sUseCase- Fetch list with paginationCreate{Feature}UseCase- Create new itemUpdate{Feature}UseCase- Update existing itemDelete{Feature}UseCase- Delete item
Your Flutter project must have:
- Clean Architecture base structure
- Core utilities (
type_definition.dart,use_case.dart,api_service.dart) - Dependencies:
equatable,flutter_bloc,fpdart,mocktail(for tests)
The brick includes a pre-generation hook that automatically extracts your project name from pubspec.yaml to ensure proper imports.
Consider using these complementary bricks for your Flutter project:
- clean_architecture - Generate core utilities and base architecture
See LICENSE file.