easy_init_cli 1.2.6
easy_init_cli: ^1.2.6 copied to clipboard
A CLI tool to create flutter project and initialize project with boilerplate code
Easy Init CLI #
π Overview #
Easy Init CLI is a powerful command-line tool designed to streamline the initialization of Flutter projects. It automatically sets up your project with a well-structured, scalable, and testable architecture, saving you time on boilerplate setup.
Currently, it supports TDD + Clean Architecture, a robust pattern favoured by many professional Flutter developers for its separation of concerns and testability.
β¨ Key Features #
- Automated Project Setup: Instantly generate a complete project structure.
- Clean Architecture: Follows industry-standard TDD + Clean Architecture principles.
- Feature Generation: Easily add new features (like Authentication) with a single command.
- Dependency Management: Automatically adds necessary dependencies and dev-dependencies.
- Customizable: Generated code is a starting point you can tailor to your needs.
π¦ Installation #
Install the package globally from the command line:
dart pub global activate easy_init_cli
π οΈ Usage Guide #
1. Create a New Project #
Generate a new Flutter project with a custom organization domain:
easy create project
Follow the prompts to enter your project name and organization domain (e.g., com.example).
2. Initialize Architecture #
Navigate to your project directory:
cd <your_project_name>
Initialize the project structure:
easy init
You will be prompted to select an architecture. Currently, TDD + Clean Architecture is the supported pattern.
3. Create a Feature #
Generate a new feature module following Clean Architecture principles:
easy create feature
Or specify the feature name directly:
easy create feature:<feature_name>
Note: If you name your feature
authorauthentication, the CLI will automatically include authentication-related screen files.
4. Run Build Runner #
Simplify running the build_runner for code generation:
easy build
5. Update CLI #
Keep your CLI up to date with the latest features and fixes:
easy update
ποΈ Architecture #
TDD + Clean Architecture #
This architecture separates the code into three main layers: Data, Domain, and Presentation, ensuring independence and testability.
Project Structure
lib/
βββ app.dart # Main application widget
βββ app_runner.dart # Application runner configuration
βββ main.dart # Application entry point
βββ common/ # Reusable components, utilities, and shared logic across features
β βββ widgets/ # Common UI components
βββ core/ # Core functionalities, infrastructure, and cross-cutting concerns
β βββ api_endpoints/ # API endpoint definitions
β βββ base_usecase/ # Base use case definitions
β βββ config/ # Application configuration
β βββ dependency_injection/ # Dependency injection setup
β βββ extensions/ # Dart extensions
β βββ failures/ # Custom failure classes for error handling
β βββ network/ # Network client and handling
β βββ routes/ # Application routing definitions
β βββ services/ # Core services
β βββ theme/ # Application theme and colors
βββ features/ # Feature-specific modules, each following clean architecture
βββ <feature_name>/
βββ data/ # Data layer (repositories implementation, data sources, models)
β βββ data_sources/ # Remote and local data sources
β βββ models/ # Data transfer objects (DTOs)
β βββ repositories_impl/# Repository implementations
βββ domain/ # Domain layer (entities, repository interfaces, use cases)
β βββ entities/ # Core business entities
β βββ repositories/ # Repository interfaces
β βββ usecases/ # Business logic (use cases)
βββ presentation/ # Presentation layer (UI, blocs, widgets)
βββ blocs/ # BLoC for state management
βββ screens/ # Screens/Pages
βββ widgets/ # UI components specific to the feature
For a deep dive into this architecture, we recommend Reso Coder's Flutter Clean Architecture Course.
Note: A "Number Trivia" feature is generated by default to demonstrate the architecture's flow. You can use this as a reference or remove it when you start building your core features.
π€ Contributing #
Contributions are welcome! If you find a bug or have a feature request, please open an issue.
- Fork the repository.
- Create your feature branch (
git checkout -b feature/my-feature). - Commit your changes (
git commit -m 'Add some feature'). - Push to the branch (
git push origin feature/my-feature). - Open a Pull Request.
π License #
This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.