Documentation languages

RGB Mobile Custom CLI Commands.

// To install:
pub global activate rgb_cli 
// (to use this add the following to system PATH: [FlutterSDKInstallDir]\bin\cache\dart-sdk\bin

flutter pub global activate rgb_cli

// To create a page (module-aware):
// Pages generate: views, view_model, bindings and register routes.
// Usage with module flag:
rgb create page:login -m auth

// Without -m defaults to module "general":
rgb create page:home

// To create a new view model in a specific folder:
// Long form:
rgb create view_model:view_model_name on home
// Alias:
rgb create -vm:view_model_name on home

// To create a domain usecase (interface + implementation):
// Generates: lib/domain/usecase/<name>/{<name>_interface.dart,<name>_use_case.dart}
rgb create -u address
// or long form
rgb create use_case:address

// To build the app:
rgb build
// Example: rgb build -android -staging
// Options: -android (-a), -ios(-i)
// Environments: -staging (-s), -production (-p), -aab

// To generate a class model:
// Note: 'assets/models/user.json' path of your template file in json format
// Note: on  == folder output file
// Getx will automatically search for the home folder
// and insert your class model there.
rgb generate model on home with assets/models/user.json

//Note: the URL must return a json format
rgb generate model on home from "https://api.github.com/users/ibnu009"

// To install a package in your project (dependencies):
rgb install camera

// To install several packages from your project:
rgb install http path camera

// To install a package with specific version:
rgb install path:1.6.4

// To install a dev package in your project (dependencies_dev):
rgb install flutter_launcher_icons --dev

// To remove a package from your project:
rgb remove http

// To remove several packages from your project:
rgb remove http path

// To update CLI:
rgb update
// or `rgb upgrade`

// Shows the current CLI version:
rgb -v
// or `rgb -version`

// For help
rgb help

CLI Details

Below is the list of outputs each command generates, based on current implementation:

  • create page:

    • Generates Use Case under domain:
      • lib/domain/use_case/<name>/<name>_interface.dart
      • lib/domain/use_case/<name>/<name>_use_case.dart
    • Generates Presentation layer under the selected module (default module: general):
      • lib/presentation/<module>/<name>/view_model/<name>_view_model.dart
      • lib/presentation/<module>/<name>/views/<name>_view.dart
      • lib/presentation/<module>/<name>/bindings/<name>_binding.dart
    • Registers a new route in the app routes (AppPages).
  • create view_model: (alias: -vm or vm)

    • Creates a ViewModel file using the ViewModel template.
    • Output folder is derived from the on target; current implementation writes under the module's controllers/ directory.
    • If a Binding exists for the module/page, adds the dependency to it automatically.
  • create use_case: (alias: -u, uc)

    • Creates domain layer artifacts:
      • lib/domain/use_case/<name>/<name>_interface.dart
      • lib/domain/use_case/<name>/<name>_use_case.dart
  • generate model on (or: from "<url>")

    • Creates a Dart model file from JSON:
      • <target_path>/<name>_model.dart
    • Unless --skipProvider is passed, also generates a Provider with basic endpoints:
      • <target_path>/providers/<name>_provider.dart
  • build

    • Build app using build-app.sh script
    • Options: -android (-a), -ios(-i)
    • Envs: -staging (-s), -production (-p), -aab
    • Examples: rgb build -a -s | rgb build -i -p | rgb build -aab
  • init

    • Creates a minimal lib/main.dart for GetX pattern.
    • Installs Get and scaffolds an initial page (invokes create page).
    • Creates initial lib/ structure and module directories.
  • install

    • Adds dependencies (or dev_dependencies with --dev) to pubspec.yaml and runs flutter pub get.
  • remove

    • Removes dependencies from pubspec.yaml and runs flutter pub get.
  • sort --relative --skipRename

    • Sorts and formats imports across project files; optionally uses relative imports and can skip renaming based on separator rules.
  • update / upgrade

    • Updates this CLI to the latest version.
  • -v / --version

    • Shows the current CLI version.
  • help

    • Lists available commands with brief hints.

Libraries

cli_config/cli_config
commands/commands_list
commands/impl/args_mixin
commands/impl/build
commands/impl/commads_export
commands/impl/create/page/page
commands/impl/create/project/project
commands/impl/create/provider/provider
commands/impl/create/screen/screen
commands/impl/create/usecase/usecase
commands/impl/create/view/view
commands/impl/create/view_model/view_model
commands/impl/generate/locales/locales
commands/impl/generate/model/model
commands/impl/help/help
commands/impl/init/flutter/init
commands/impl/init/flutter/init_getxpattern
commands/impl/install/install
commands/impl/install/install_get
commands/impl/remove/remove
commands/impl/sort/sort
commands/impl/update/update
commands/impl/version/version
commands/interface/command
common/utils/backup/backup_utils
common/utils/json_serialize/helpers
common/utils/json_serialize/json_ast/error
common/utils/json_serialize/json_ast/json_ast
common/utils/json_serialize/json_ast/location
common/utils/json_serialize/json_ast/parse
common/utils/json_serialize/json_ast/parse_error_types
common/utils/json_serialize/json_ast/tokenize
common/utils/json_serialize/json_ast/tokenize_error_types
common/utils/json_serialize/json_ast/utils/grapheme_splitter
common/utils/json_serialize/json_ast/utils/substring
common/utils/json_serialize/model_generator
common/utils/json_serialize/sintaxe
common/utils/logger/log_utils
common/utils/pub_dev/pub_dev_api
common/utils/pubspec/pubspec_lock
common/utils/pubspec/pubspec_utils
common/utils/pubspec/yaml_to.string
common/utils/shell/shel.utils
core/generator
core/internationalization
core/locales.g
core/structure
exception_handler/exception_handler
exception_handler/exceptions/cli_exception
extensions
extensions/dart_code
extensions/list
extensions/string
functions/binding/add_dependencies
functions/binding/find_bindings
functions/create/create_list_directory
functions/create/create_main
functions/create/create_navigation
functions/create/create_single_file
functions/create/create_web
functions/exports_files/add_export
functions/find_file/find_file_by_name
functions/find_file/find_folder_by_directory
functions/formatter_dart_file/frommatter_dart_file
functions/is_url/is_url
functions/path/replace_to_relative
functions/replace_vars/replace_vars
functions/routes/arc_add_route
functions/routes/get_add_route
functions/routes/get_app_pages
functions/routes/get_support_children
functions/sorter_imports/sort
functions/version/check_dev_version
functions/version/version_update
models/file_model
rgb_cli
samples/impl/analysis_options
samples/impl/generate_locales
samples/impl/get_app_pages
samples/impl/get_binding
samples/impl/get_provider
samples/impl/get_route
samples/impl/get_usecase
samples/impl/get_view
samples/impl/get_view_model
samples/impl/getx_pattern/get_main
samples/interface/sample_interface