![]() |
In this article, we will learn about how to set up or file structure of our flutter project using get_cli. You might be aware of the GetX state management. If not let us explain to you all the things so that you are familiar with these terms. State Management is to manage the things between 2 or more screens or in a complete app. It helps to create heavy applications and sustain data on every screen. GetX is one of the state management tools, dependency manager, and navigation manager that we are using in Flutter. Previously it was limited to state management only. A command line interface (CLI) is a text-based interface where you can input commands that interact with a computer’s operating system. Let’s learn how to add get_cli in the Flutter project and maintain app structure, dependency and many more. In the time of automation, you should not create the UI structure manually when you can do it through a single command. Step By Step ImplementationStep 1: Install the get_cli on your deviceYou can install the CLI in your system Dart
Step 2: Create a flutter projectCreate a flutter using the command Dart
or you can create a project from get_cli Dart
If you have existing project you can use following command Dart
Step 3: Create a page using commandCreate a page that will contain controller, view, and binding with page name that you provide Dart
It will create a folder like this It will have view file where you will create a UI like textfiled, text, column, row. Controllers will contain API calls and navigation and data where you will set the data. Bindings are classes where we can declare our dependencies and then ‘bind’ them to the routes. From below command you can manage the app from cli like as now you have access to get command. Let’s understand how to handle different things 1. To generate model fileDart
Here assets/models/user.json is kind of data for which you want to create model file. 2. Add the packageDart
Here http is package name you want to add in your project. 3. To remove the packageThis is to remove the package from app Dart
4. To generate localizations fileDart
assets/locales is path name where we have to create locales file name 5. To install the dev dependencyDart
6. To update the get_cliTo update the get cli. Dart
You have successfully learnt basics of get_cli from the above command. Hope you have understood all the things. |
Reffered: https://www.geeksforgeeks.org
Dart |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 9 |