Automation with Get CLI
Learn to automate tasks using Get CLI commands.
We'll cover the following...
Overview
Get CLI automates a good chunk of tasks revolving around boilerplate. It helps us structure our project in a scalable way and provides commands to quickly generate files within that structure. Let’s see what this tool has to offer.
In this lesson, we’ll use get
to execute commands. But getx
works similarly, so feel free to use any of them.
Create project
To create a project, run the following command:
get create project
Once this command is executed, it asks us questions like project’s name, company domain, whether to add a linter, etc. Then it generates a project for us just as the default Flutter project but configured to our answers.
We can also provide the project name directly.
get create project:project_name
Replace project_name
with the desired name and the new project will be created with that name.
Initialize the project structure
Creating the default Flutter project is fine, but what if we could structure the project in an organized and scalable way? Below is just the command we need!
get init
This little command does tons of heavy lifting for us. When executed, it asks us to select either getx_pattern
or clean architecture, and accordingly, it creates a project with dedicated folders for data, views, controllers, bindings, and navigation. Inside these folders, it creates files prefilled with boilerplate. It even installs the GetX package. This minimizes the friction and lets us get to the real work immediately. ...