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 is lib/ui/screens.
    • component: Create a Component file, the default path is lib/ui/widgets.
    • service: Create a Service file, the default path is lib/core/services.
    • model: Create a Model file, the default path is lib/data/models.
    • repository: Create a Repository file, the default path is lib/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 ็š„ๅ‘ๅธƒ่ฆๆฑ‚ไบ†ใ€‚