Official CLI for the GetX framework

Related tags

Utilities test_cli
Overview
Documentation languages
pt_BR en_US - this file zh_CN

Official CLI for the GetX™ framework.

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

flutter pub global activate get_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 `get create project:my_project`
// If the name has spaces use `get create project:"my cool project"`
get create project

// To generate the chosen structure on an existing project:
get init

// To create a page:
// (Pages have controller, view, and binding)
// Note: you can use any name, ex: `get create page:login`
// Nota: use this option if the chosen structure was Getx_pattern
get create page:home

// To create a screen
// (Screens have controller, view, and binding)
// Note: you can use any name, ex: `get screen page:login`
// Nota: use this option if the chosen structure was CLEAN (by Arktekko)
get create screen:home 

// To create a new controller in a specific folder:
// Note: you don't need to reference the folder,
// Getx will search automatically for the home folder
// and add your controller there.
get create controller:dialogcontroller on home

// To create a new view in a specific folder:
// Note: you don't need to reference the folder,
// Getx will automatically search for the home folder
// and insert your view there.
get create view:dialogview on home

// To create a new provider in a specific folder:
get create provider:user on home

// To generate a localization file:
// Note: 'assets/locales' directory with your translation files in json format
get generate locales assets/locales

// 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.
get generate model on home with assets/models/user.json

//to generate the model without the provider
get generate model on home with assets/models/user.json --skipProvider

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

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

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

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

// You can also specify several packages with version numbers

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

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

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

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

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

// For help
get help

Exploring the CLI

let's explore the existing commands in the cli

Create project

  get 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

  get init

Use this command with care it will overwrite all files in the lib folder. It allows you to choose between two structures, getx_pattern and clean.

Create page

  get create page:name

this command allows you to create modules, it is recommended for users who chose to use getx_pattern.

creates the view, controller and binding files, in addition to automatically adding the route.

You can create a module within another module.

  get create page:name on other_module

When creating a new project now and use on to create a page the CLI will use children pages.

Create Screen

  get create screen:name

similar to the create page, but suitable for those who use Clean

Create controller

  get create controller:dialog on your_folder

create a controller in a specific folder.

Using with option You can now create a template file, the way you prefer.

run

  get create controller:auth with examples/authcontroller.dart on your_folder

or with url run

  get create controller:auth with 'https://raw.githubusercontent.com/jonataslaw/get_cli/master/samples_file/controller.dart.example' on your_folder

input:

@import

class @controller extends GetxController {
  final  email = ''.obs;
  final  password = ''.obs;
  void login() {
  }

}

output:

import 'package:get/get.dart';

class AuthController extends GetxController {
  final email = ''.obs;
  final password = ''.obs;
  void login() {}
}

Create view

  get create view:dialog on your_folder

create a view in a specific folder

Generate Locates

create the json language files in the assets/locales folder.

input:

pt_BR.json

{
  "buttons": {
    "login": "Entrar",
    "sign_in": "Cadastrar-se",
    "logout": "Sair",
    "sign_in_fb": "Entrar com o Facebook",
    "sign_in_google": "Entrar com o Google",
    "sign_in_apple": "Entrar com a  Apple"
  }
}

en_US.json

{
  "buttons": {
    "login": "Login",
    "sign_in": "Sign-in",
    "logout": "Logout",
    "sign_in_fb": "Sign-in with Facebook",
    "sign_in_google": "Sign-in with Google",
    "sign_in_apple": "Sign-in with Apple"
  }
}

Run :

get generate locales assets/locales

output:

abstract class AppTranslation {

  static Map<String, Map<String, String>> translations = {
    'en_US' : Locales.en_US,
    'pt_BR' : Locales.pt_BR,
  };

}
abstract class LocaleKeys {
  static const buttons_login = 'buttons_login';
  static const buttons_sign_in = 'buttons_sign_in';
  static const buttons_logout = 'buttons_logout';
  static const buttons_sign_in_fb = 'buttons_sign_in_fb';
  static const buttons_sign_in_google = 'buttons_sign_in_google';
  static const buttons_sign_in_apple = 'buttons_sign_in_apple';
}

abstract class Locales {

  static const en_US = {
   'buttons_login': 'Login',
   'buttons_sign_in': 'Sign-in',
   'buttons_logout': 'Logout',
   'buttons_sign_in_fb': 'Sign-in with Facebook',
   'buttons_sign_in_google': 'Sign-in with Google',
   'buttons_sign_in_apple': 'Sign-in with Apple',
  };
  static const pt_BR = {
   'buttons_login': 'Entrar',
   'buttons_sign_in': 'Cadastrar-se',
   'buttons_logout': 'Sair',
   'buttons_sign_in_fb': 'Entrar com o Facebook',
   'buttons_sign_in_google': 'Entrar com o Google',
   'buttons_sign_in_apple': 'Entrar com a  Apple',
  };

}

now just add the line in GetMaterialApp

    GetMaterialApp(
      ...
      translationsKeys: AppTranslation.translations,
      ...
    )

Generate model example

Create the json model file in the assets/models/user.json

input:

{
  "name": "",
  "age": 0,
  "friends": ["", ""]
}

Run :

get generate model on home with assets/models/user.json

output:

class User {
  String name;
  int age;
  List<String> friends;

  User({this.name, this.age, this.friends});

  User.fromJson(Map<String, dynamic> json) {
    name = json['name'];
    age = json['age'];
    friends = json['friends'].cast<String>();
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['name'] = this.name;
    data['age'] = this.age;
    data['friends'] = this.friends;
    return data;
  }
}

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:

get_cli:
  separator: "."

Are your imports disorganized?

To help you organize your imports a new command was created: get 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. get_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 tranlations folder
  2. Copy the keys from the file, and translate the values
  3. send your PR.

TODO:

  • Support for customModels
  • Include unit tests
  • Improve generated structure
  • Add a backup system
You might also like...

Official Git of flutter code-push made by Chimera inc. If you want to get more info or seek for biz corporation, you can contact [email protected].

中文版 Chimera Flutter Code Push Chimera is a Dart compiler developed by ourselves, which generates interpretable and executable bytecode to implement co

Oct 6, 2022

A collection of pixel-perfect iOS-styled components and properties for Flutter, following the official guidelines.

A collection of pixel-perfect iOS-styled components and properties for Flutter, following the official guidelines.

Nov 10, 2022

Auto is a Flutter automated testing framework developed for testers.

Auto is a Flutter automated testing framework developed for testers.

Auto Auto-A simpler Flutter UI automation test solution. No need to write any code Recording test scripts is very simple Mult

Oct 12, 2022

An extensible flutter-framework

dart_board An extensible flutter-framework Dart Board allows you to break your app into features and then integration cleanly and consistently. It's e

Dec 19, 2022

Rocket is a parsing framework for parsing binary data structures using efficient parsing algorithms

rocket Version 0.1.10 (BETA) Rocket is a parsing framework for parsing binary data structures using efficient parsing algorithms. Breaking change: The

Dec 5, 2021

FaaS (Function as a service) framework for writing portable Dart functions

Functions Framework for Dart This is a community-supported project, meaning there is no official level of support. The code is not covered by any SLA

Dec 26, 2022

Mustang: A framework to build Flutter applications

Mustang: A framework to build Flutter applications

Mustang A framework to build Flutter applications. Following features are available out of the box. State Management Persistence Cache File layout and

Oct 26, 2022

Official CLI for the GetX framework

Official CLI for the GetX framework

Nov 23, 2021

Official Getx CLI

Documentation languages pt_BR en_US - this file zh_CN Official CLI for the GetX™ framework. // To install: pub global activate get_cli // (to use thi

Jan 8, 2023

A basic boilerplate template for starting a Flutter GetX project. GetX, Dio, MVVM, get CLI, Localization, Pagination etc are implemented.

A basic boilerplate template for starting a Flutter GetX project. GetX, Dio, MVVM, get CLI, Localization, Pagination etc are implemented.

Flutter GetX Template (GetX, Dio, MVVM) This Flutter Template using GetX package for State management, routing and Dependency Injection (bindings). We

Jan 9, 2023

constructing... Flutter, Ganache, Truffle, Remix, Getx Pattern, Infura, GetX, Blockchain

constructing... Flutter, Ganache, Truffle, Remix, Getx Pattern, Infura, GetX, Blockchain

Dec 20, 2022

Flutter-GetX-Toturials - Getx full tutorials for flutter

Flutter-GetX-Toturials - Getx full tutorials for flutter

getx_full_tutorials A new Flutter getx tutorial. This Project Contains: Snackbar

Dec 1, 2022

Flutter getx template - A Flutter Template using GetX package for State management, routing and Dependency Injection

Flutter getx template - A Flutter Template using GetX package for State management, routing and Dependency Injection

Flutter GetX Template (GetX, Dio, MVVM) This Flutter Template using GetX package

Aug 27, 2022

Flutter GetX Template (GetX, Dio, MVVM)

Flutter GetX Template (GetX, Dio, MVVM)

Flutter GetX Template (GetX, Dio, MVVM) This Flutter Template using GetX package for State management, routing and Dependency Injection (bindings). We

Dec 18, 2022

Mountain - A Framework to create a Flutter Project follow GetX Pattern Design

Mountain - A Framework to create a Flutter Project follow GetX Pattern Design

Getting Started A Framework to create a Flutter Project follow GetX Pattern Desi

Aug 25, 2022

The ROHD Verification Framework is a hardware verification framework built upon ROHD for building testbenches.

The ROHD Verification Framework is a hardware verification framework built upon ROHD for building testbenches.

ROHD Verification Framework The ROHD Verification Framework (ROHD-VF) is a verification framework built upon the Rapid Open Hardware Development (ROHD

Dec 20, 2022

Flying Fish is full-stack Dart framework - a semi-opinionated framework for building applications exclusively using Dart and Flutter

Flying Fish is full-stack Dart framework - a semi-opinionated framework for building applications exclusively using Dart and Flutter.

Dec 27, 2022

Flutter Version Management: A simple CLI to manage Flutter SDK versions.

Flutter Version Management: A simple CLI to manage Flutter SDK versions.

fvm Flutter Version Management: A simple cli to manage Flutter SDK versions. FVM helps with the need for a consistent app builds by allowing to refere

Jan 8, 2023
Owner
Shahanul Haque Shawon
Shahanul Haque Shawon
Converts SVG icons to OTF font and generates Flutter-compatible class. Provides an API and a CLI tool.

Fontify The Fontify package provides an easy way to convert SVG icons to OpenType font and generate Flutter-compatible class that contains identifiers

Igor Kharakhordin 88 Oct 28, 2022
A cli tool to run Flutter applications and auto hot reload it when files are changed

Dashmon A minimalistic CLI tool to run Flutter applications and auto hot reload it when files are changed. It will watch changes your application code

Erick 31 Oct 6, 2022
A CLI tool to help generate dart classes from json returned from API

Json 2 Dart Command line utility Important note There is already a package called json2dart so this package will be called json2dartc ! This project w

Adib Mohsin 38 Oct 5, 2022
A CLI for syncing Dart dependency versions between pubspec.yaml and pubspec.lock files.

lockpick A CLI for syncing Dart dependency versions between pubspec.yaml and pubspec.lock files. ?? Usage # Activate lockpick pub global activate lock

Jeroen Meijer (Jay) 34 Oct 17, 2022
CLI utility to manage MC Server installations

CLI utility to manage MC server installations. Features Install required JDKs Download server files Generate start scripts (with optimized JVM flags)

Michael Rittmeister 14 Nov 18, 2022
Command-line Interface (CLI) for any_icon_maker.

makeanyicon Command-line Interface (CLI) for any_icon_maker. makeanyicon Quick Start Installation Usage License Quick Start Installation dart pub glob

MakeAnyIcon 6 Nov 4, 2022
A CLI tool to help batch renaming files.

batch_rename A CLI tool to enable batch renaming of files. Installation Clone the repo and add bin/batch_rename.exe to PATH: gh repo clone POWRFULCOW8

Diego Domínguez Melo 0 Nov 3, 2021
Simple CLI tool to produce icons for your next app.

icon_set_generator Simple CLI tool to enable easy production of icon sets for your next application. Installation Clone the repo and add bin/icon_set_

Diego Domínguez Melo 1 Nov 17, 2021
A simple shortcut, command line interface (CLI) for a lazy (a.k.a effective) Flutter developer in order to increase productivity and happiness.

f A simple shortcut, command line interface (CLI) for a lazy (a.k.a effective) Flutter developer in order to increase productivity and happiness. Inst

Salman S 27 Nov 22, 2022
🔍 👀 CLI utility to check last-visit of your CodeForces friends & much more, 🚀 powered by CodeForces API

JoJo ?? ?? CLI utility to check last-visit of your CodeForces friends & much more, ?? powered by CodeForces API Features Online Friends All Friends Pr

Tirth 5 Jul 20, 2020