Create ⚒️
The create
command in Forge cli is used to generate a new Flutter project with a clean architecture folder structure. This command sets up the initial project structure, including necessary directories and files, to help developers get started quickly while following best practices in software architecture.
Usage
forge_cli create <project_name>
Replace <project_name>
with the name of the new Flutter project you want to create.
Example
To create a new Flutter project named example
, you would run:
forge_cli create my_app
Generated Folder Structure 🗂️
When you run the create
command, Forge cli generates a folder structure that follows clean architecture principles. Here’s an example of the folder structure created for a new project:
├── core
│ ├── annotations
│ │ └── http_annotations.dart
│ ├── bootstrap
│ │ └── bootstrap.dart
│ ├── constants
│ │ └── app_const.dart
│ ├── environment
│ │ └── environment.dart
│ ├── exceptions
│ │ └── exceptions.dart
│ ├── failureToMessage
│ │ └── map_failure_to_message.dart
│ ├── failures
│ │ └── failures.dart
│ ├── gen
│ │ └── injection.dart
│ ├─ ─ hive
│ │ └── open_box.dart
│ ├── network
│ │ ├── http_client.dart
│ │ └── network.dart
│ └── router
│ └── router.dart
├── features
└── main.dart
Folder Breakdown
- core: Contains core utilities, constants, and shared resources.
- features: Contains individual features, each following its own clean architecture structure.
Installed Packages
The create
command also installs several packages to help you get started with clean architecture in Flutter. These packages include:
dependencies
flutter_bloc
http
connectivity_plus
dartz
freezed_annotation
injectable
get_it
path_provider
hive
go_router
flutter_dotenv
flutter_svg
dev dependencies
freezed
injectable_generator
build_runner
flutter_gen_runner
These packages are essential for state management, dependency injection, API communication, and code generation.
Next Steps
after creating a new project with the create
command, you can:
- Use the make command to add new features.
- Prepare your repository abstract class.
- Use the build command to generate necessary code for your features.
For more detailed information on these steps, refer to the other sections of this documentation.
Last updated: May 27, 2024