Documentation languages
en_US - this file zh_CN

Official CLI for Sunac Flutter Template to build Flutter Modules easily.

  // To install:
  pub global activate sunac_flutter_cli 
  // (to use this add the following to system PATH: [FlutterSDKInstallDir]\bin\cache\dart-sdk\bin
  
  flutter pub global activate sunac_flutter_cli
  
  // To create a flutter project in the current directory:
  // Note: By default it will take the folder's name as project name
  // You can name the project with `sunac create project:my_project`
  // If the name has spaces use `sunac create project:"my cool project"`
  sunac create project
  sunac create package
  sunac create plugin
  sunac create module
  
  // To generate the chosen structure on an existing project:
  sunac init
  
  // To install a package in your project (dependencies):
  sunac install camera
  
  // To install several packages from your project:
  sunac install http path camera
  
  // To install a package with specific version:
  sunac install path:1.6.4
  
  // You can also specify several packages with version numbers
  
  // To install a dev package in your project (dependencies_dev):
  sunac install flutter_launcher_icons --dev
  
  // To remove a package from your project:
  sunac remove http
  
  // To remove several packages from your project:
  sunac remove http path
  
  // To update CLI:
  sunac update
  // or `sunac upgrade`
  
  // Shows the current CLI version:
  sunac -v
  // or `sunac -version`
  
  // For help
  sunac help

Exploring the CLI

let's explore the existing commands in the cli

Create project

  sunac create project

Using to generate a new project, you can choose between Flutter and get_server, after creating the default directory, it will run a get init next command

Init

  sunac init

Use this command with care it will overwrite all files in the lib folder. flutter-getx-with-null-safety-template.

Separator file type

One day a user asked me, if it was possible to change what the final name of the file was, he found it more readable to use: my_controller_name.controller.dart, instead of the default generated by the cli: my_controller_name_controller. dart thinking about users like him we added the option for you to choose your own separator, just add this information in your pubsepc.yaml

Example:

sunac_flutter_cli:
  separator: "."

Are your imports disorganized?

To help you organize your imports a new command was created: sunac sort, in addition to organizing your imports the command will also format your dart file. thanks to dart_style. When using get sort all files are renamed, with the separator. To not rename use the --skipRename flag.

You are one of those who prefer to use relative imports instead of project imports, use the --relative option. sunac_flutter_cli will convert.

Internationalization of the cli

CLI now has an internationalization system.

to translate the cli into your language:

  1. create a new json file with your language, in the translations folder
  2. Copy the keys from the file, and translate the values
  3. send your PR.

Libraries

cli_config/cli_config
commands/commands_list
commands/impl/args_mixin
commands/impl/commands_export
commands/impl/create/create
commands/impl/help/help
commands/impl/init/flutter/init
commands/impl/init/flutter/init_pattern
commands/impl/install/install
commands/impl/install/install_pattern
commands/impl/remove/remove
commands/impl/sort/sort
commands/impl/update/update
commands/impl/version/version
commands/interface/command
common/utils/asset_fill/converter
common/utils/asset_fill/get_paths
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/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/structure
exception_handler/exception_handler
exception_handler/exceptions/cli_exception
extensions
extensions/list
functions/create/create_list_directory
functions/create/create_main
functions/create/create_single_file
functions/formatter_dart_file/formatter_dart_file
functions/path/replace_to_relative
functions/sorter_imports/sort
functions/version/check_dev_version
functions/version/version_update
generated/locales.g
models/file_model
sunac_flutter_cli