Make π§±
The make
command in Forge cli allows you to create a new feature, adhering to clean architecture principles. This command generates the necessary folder structure and files for the specified feature within your Flutter project.
Usageβ
forge_cli make <feature_name>
Replace <feature_name>
with the name of the feature you want to create.
Exampleβ
To create an authentication feature, you would run:
forge_cli make authentication
Generated Folder Structureβ
When you run the make
command, Forge cli generates a folder structure that follows clean architecture principles. Hereβs an example of the folder structure created for the authentication
feature:
authentication
βββ data
βΒ Β βββ models
βΒ Β βββ authentication_model.dart
βΒ Β βββ authentication_models_export.dart
βββ domain
βΒ Β βββ entities
βΒ Β βΒ Β βββ authentication_entities_export.dart
βΒ Β βΒ Β βββ authentication_entity.dart
βΒ Β βββ repositories
βΒ Β βββ authentication_repository.dart
βββ presentation
βββ views
βΒ Β βββ authentication_screen.dart
βββ widgets
βββ example_widget.dart
Folder Breakdownβ
- data: Contains data sources, models, and repository implementations.
- datasources: Manages data retrieval from remote or local sources.
- models: Contains data models.
- repositories: Implements the repository interfaces defined in the domain layer.
- domain: Contains business logic, entities, repository interfaces, and use cases.
- entities: Defines core business objects.
- repositories: Contains repository interfaces.
- usecases: Contains business logic operations.
- presentation: Manages the user interface and state.
- bloc: Contains the BLoC (Business Logic Component) for state management.
- pages: Contains the UI pages and widgets.
Benefitsβ
- Consistency: Ensures a consistent project structure following clean architecture principles.
- Separation of Concerns: Divides the project into distinct layers, making it easier to manage and scale.
- Scalability: Facilitates the addition of new features without impacting existing code.
Last updated: May 27, 2024