Get CLI — Powerful GetX Tool for Project Management
A Tool from Getx helps to set up the project, page, and views quickly with Flutter.
Hi everyone, my name is Shirsh and in this article, I’ll discuss the get CLI tool. If you’re using the getX package, so get CLI is one of the powerful tools that you can use. with this lot of things we can easily manage it.
We spend a lot of time creating pages controllers providers and binding them together every single day — so much that we keep repeating it day after day if this is what you’re experiencing stick around because I’m going to show you how to increase your productivity like a pro.
Let’s get started with the get CLI package, which lets you create a whole flutter infrastructure for an app very easily. basically, as normal when we start a new project also when we set any module for any functionality, it takes so much time to setup controller,view, bindings. so for that get CLI provided as the solution.
To learn about the get CLI we’re gonna create a brand new project, so let’s do that first by installing the git CLI, so let’s fire up a terminal and run the command.
flutter pub global activate get_cli
As you can see in the above image, once you run this command it’s gonna install all the dependencies libraries globally. Therefore, maybe you can put it in a path variable once it’s activated globally.
So that next time you can run easily any get CLI command all right.
So let’s move ahead and create our first project. So let’s write the command. First, open any folder where you want to create a project. Then call this command,
get create project:todo
so, my path is not set up properly, so firstly I set my path, if your path is properly set you can skip the path set command.
here “todo” is my project name. now I will set my project domain.
Note: if you face any problem like. after setting the company domain unable to create project,then you can downgrade to the get_cli version. (in the 1.8.1 version i am facing this problem)
First, uninstall your current version (1.8.1)
flutter pub global deactivate get_cli
After that install version 1.6.0
flutter pub global activate get_cli 1.6.0
but, if able to get the project setup option, you can skip this procedure.
okay, now start a project setup procedure, according to over requirement, so let’s start to set up that
· swift language, then,
· kotlin language then,
· I choose null safety then,
· I choose Dart Recommended,
By doing this, you will be able to build the command for yourself inside Flutter create, so it makes it simpler at least with all the options, it doesn’t have a GUI, but it works like that.
You’re going to have the option to select the architecture of your project, such as clean or getX.
Based on each of these patterns, a folder will be created for every single feature, as well as all the controllers, views, and models, if you want to keep it that way. So I am picking the getX pattern, and it says it will overwrite, so I am going ahead.
So, our project setup is completed, now you can open it into VS code or any other IDE like I choose Android Studio(I like that because I am switched from android native developer to Flutter 😃)
As soon as you go inside the lib folder, you’ll find that all the routes have been set up for you so that you can begin immediately, once you see the main file, all the pages are set up within the initial directory. Now you just need to run the application and everything will be set up with the bindings, controllers, and views.
In addition, get_cli provides the option of adding additional modules or pages inside your existing application.
So let’s create another module in over application, so that get_CLI also has an option for that, let’s see that like I want to create a Registration module as well so,
get create page:Registration
Not only module but also with as well Route also set properly.
We learn how the project setup also how a new module setup, but what about if we want to add a single page or we can say single file inside any folder means if we want any another controller or any view inside any predefined module.
So, get_CLI also offers an option for that, for example, I am creating inside of the home module. let’s see that command
for view creating:-
get create view:success on home
for controller creating:-
get create controller:success on home
Now let’s see another well-defined functionality of get_CLI,get_CLI offer an option for creating a model file for an existing JSON file. for example, if we have a demo file, let’s see this example file here.
so, get_CLI also offers a solution for that, we don’t need to use any other third-party library or website for that.
let’s see its example:-
first, I call generate model command as well as after it defines its name.
get generate model from “https://tools.learningcontainer.com/sample-json.json"
as you see another folder is created that is providers. basically, this file helps us to call these APIs.
all things are properly set up here(in some cases it’s not effective like many APIs we pass header and different way)
so get_CLI offer so many well options, where we don’t need to write so much boilerplate code again and again.
Also, get CLI to offer many other options as well like installing and uninstalling many packages at one time. you just have to focus on writing business logic and getting the data from the server to handle.
let’s conclude to see what many other things that get_CLI help us. let’s call its command.
With this tool, your development can accelerate like crazy since you’ll only need to fill out the details of your projects to get them running. You are now free to focus on the core logic and design of your code since you can get CLI to easily manage other things.
So that’s all the information that helps us for managing projects by get CLI, that I want to describe in short. I took it from many websites as some research if you find out any wrong info or miscorrected, please point out or comment below.