easy_code 0.1.0-alpha.1 easy_code: ^0.1.0-alpha.1 copied to clipboard
This package is a code generator for flutter projects.
Codescript CLI is a tool designed to streamline the process of generating Flutter project components. It provides simple commands to generate various architecture components such as views, viewmodels, repositories, bindings, and use cases, or even set up a full architecture in a matter of seconds. This enhances consistency and speeds up development in Flutter projects.
Codescript #
Features #
- Generate individual components: Easily create views, viewmodels, repositories, bindings, and use cases.
- Full architecture generation: Generate a complete architecture setup with one command.
- Fast and efficient: Automate repetitive tasks, saving time and effort.
Usage #
Once installed, you can use the codescript
commands to generate components directly from your terminal.
Commands #
-
Generate a View:
codescript view <view_name>
-
Generate a ViewModel:
codescript viewmodel <viewmodel_name>
-
Generate a Repository:
codescript repository <repository_name>
-
Generate a Binding:
codescript binding <binding_name>
-
Generate a Use Case:
codescript usecase <usecase_name>
-
Generate a Full Architecture (includes view, viewmodel, repository, binding, and use case):
codescript full <resource_name>
Example #
To generate a full architecture setup for a User
resource, run:
codescript full user
This command will be generate: #
lib/
└── app/
├── /ui
│ └── /views
│ └── user_view.dart
│ └── user_viewmodel.dart
└── data/
├── repositories/
│ └── user_repository.dart
│ └── user_repository_implementation.dart
└── di/
├── user_binding.dart
└── domain/
└── usecases/
└── user_usecase.dart
Customize Output Paths #
By default, the generated components follow a specific folder structure. You can customize the paths for each component by modifying the codescript.yaml configuration file located at the root of your project. Here’s an example configuration:
paths:
views: lib/ui/views
viewmodels: lib/ui/viewmodels
repositories: lib/data/repositories
bindings: lib/di
usecases: lib/domain/usecases