Automation with Get CLI
Explore the use of Get CLI to automate Flutter project creation and structuring with GetX. Learn to generate projects, pages, views, controllers, and models quickly with prefilled boilerplate, enabling efficient development of scalable apps using clean architecture or GetX patterns.
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:
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.
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!
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. ...