GetX CLI
A command-line interface (CLI) tool for simplifying GetX project development. It helps you quickly generate project structures, screens, components, services, models, and repositories, accelerating your Flutter development workflow with GetX.
โจ Features
- Initialize GetX Project: Quickly set up a complete GetX project structure.
- Create Multiple Files: Easily create Screen, Component, Service, Model, and Repository files.
- Customizable Paths: Choose the file creation path freely and organize your code by modules.
- Modular Creation: Use the
module:name
format to specify the module and file name, e.g.,screen:my_screen
.
๐ Installation
dart pub global activate getx_cli
๐ป Usage
Initialize GetX Project
getx init
This will create a new GetX project in the current directory with the following directory structure:
lib
โโโ app
โ โโโ themes
โ โ โโโ light_theme.dart
โ โ โโโ dark_theme.dart
โ โโโ app_translations.dart
โ โโโ app_constants.dart
โ โโโ app_utils.dart
โโโ core
โ โโโ services
โ โ โโโ ... (service files)
โ โโโ utils
โ โ โโโ date_utils.dart
โ โ โโโ string_utils.dart
โ โโโ extensions
โ โ โโโ string_extensions.dart
โ โ โโโ datetime_extensions.dart
โ โโโ helpers
โ โโโ http_helper.dart
โโโ data
โ โโโ models
โ โ โโโ ... (model files)
โ โโโ repositories
โ โโโ ... (repository files)
โโโ routes
โ โโโ app_pages.dart
โ โโโ app_routes.dart
โ โโโ bindings
โ โ โโโ app_binding.dart
โ โโโ ... (other module route files, e.g., auth_routes.dart, home_routes.dart)
โโโ ui
โโโ controllers
โ โโโ ... (controller files)
โโโ screens
โ โโโ ... (screen files)
โโโ widgets
โโโ ... (component files)
Create Files
You can use the following command to create different GetX files:
getx create <module>:<name>
Where:
<module>
is the module name, optional values include:screen
: Create a Screen file, the default path islib/ui/screens
.component
: Create a Component file, the default path islib/ui/widgets
.service
: Create a Service file, the default path islib/core/services
.model
: Create a Model file, the default path islib/data/models
.repository
: Create a Repository file, the default path islib/data/repositories
.
<name>
is the file name, e.g.,my_screen
,my_button
.
Examples:
getx create screen:my
getx create component:my_button
getx create screen:auth:login
๐ License
MIT License
ๆๅทฒ็ปๅฐๆๆไธญๆๅญ็ฌฆๆฟๆขๆไบ่ฑๆ๏ผๅนถๅฏนๆ ผๅผ่ฟ่กไบๅพฎ่ฐใ ็ฐๅจ่ฟไธช README.md
ๆไปถๅบ่ฏฅ่ฝๅคๆปก่ถณ pub.dev ็ๅๅธ่ฆๆฑไบใ