Sitemap
FlutterDevs

Connect with us at support@flutterdevs.com. FlutterDevs intent to deliver Flutter apps with high quality. We’ve adopted Design First attitude which helps us deliver applications of highest quality.

Rest API Using GetX

Learn how to fetch Rest API using Getx in Flutter Application.

2 min readJun 1, 2022

--

Rest API Using GetX

Hello Everyone!! In this article, we learn about getx in Flutter. We cover many topics in this article. GetX is fast, and lightweight, and using this, we can easily manage states, and routing and can efficiently perform dependency injection.

Table Of Contents:

What is GetX?

Three Pillars of GetX

Implementation

Conclusion

GitHub Link

Read my other blogs

What is GetX?

There is many state management in flutter like Provider, GetX, Bloc, Riverpod, Mobx, etc. But GetX is not only a state management library, but instead, it is a micro-framework amalgamated with route management and dependency injection. It points to delivering a top-of-the-line development experience in an extra insubstantial but strong solution for Flutter.

Three Pillars of GetX:

there are three pillars of getx by which we can create our flutter application trouble-free. And it’s very easy to use in any flutter application.

1. State management

It has two different state management, Get-builder, and GetX/Obx. Get-builder is simple to state management and Obx is a reactive state manager.

Get Raksha Goswami’s stories in your inbox

Join Medium for free to get updates from this writer.

> State Management:- State Management is the planned approach to manage all the interplay that a user performs on a flutter application and then return those changes to UI, update databases, server requests, etc.

> Reactive State Manager:- Reactive programming is as easy as state management. Reactive programming can estrange many people because it is said to be tangled. In this, we don’t need to create StreamControllers and StreamBuilder for each variable. We don’t use code generators.

This is your count variable:

var city= 'Agra';

To make it observable, you just need to add “.obs” to the end of it:

var city = 'Agra'.obs;

And in the UI, when you want to show that value and update the screen whenever the values changes, simply do this:

Obx(() => Text("${controller.city}"));

2. Route management

GetX Route Management concept is used to navigate from one screen to another and pass data between two screens, to close the snack bar, dialog, and bottom sheets in flutter programming. This makes the navigation much simpler than the welsh way of dealing with it

initialRoute: RouteConstant.homeScreen,

3. Dependency management

It is used to handle Multiple Repositories in Flutter. As a codebase begins to fatten, in an environment where you are developing multifold applications, it is usual to have some dependencies that are shared across projects.

DataController dataController = Get.put(DataController());

Note: You can read the full blog here.

--

--

FlutterDevs
FlutterDevs

Published in FlutterDevs

Connect with us at support@flutterdevs.com. FlutterDevs intent to deliver Flutter apps with high quality. We’ve adopted Design First attitude which helps us deliver applications of highest quality.