If you use Getx to do localization, you need to use Translations class. Actually before we use the Translation class, we need to return loaded json in format. Loaded json has to return in the above format. Then we may pass it to Message(languages:languages) Let’s take a look at the Message class. The Messages class…
Category: Flutter Getx
How to handle api response in Getx Flutter
Here we will learn how to handle api response in Getx for http request. In a nicely structured app project, handling api request is the most important since, it let’s you know the response object, error type, json object, status code like that. At the end it’s more about how you return json response from…
What is locale in Flutter
If you have multiple language support in your app, you need to work with locale. Locale could be confusing for beginners. An identifier used to select a user’s language and formatting preferences. It means you can save user’s language code and country code. In general in app, we set a default language code and country…
Flutter Custom Snackbar
Here, we will see how to create a custom snackbar using Getx. To achieve this result we will use Get.snackbar(). If you see If you see snackbar() function you will notice that you can do tons of things with it. So to create a custom snackbar we will customize it. First we will create a…
Difference between Get.offNamedUntil() and Get.offAllNamed()
Get.offAllNamed() removes all the previous routes and goes to the new routes. But if you want better control, then you should be using Get.offNamedUntil. By using Get.offNamedUntil() you can control upto which routes to remove from the stack. See the above code, it will take you to a new route name AppIntroductionScreen. OffNamedUntil will remove…
Flutter Timer App With Getx
Learn how to build a timer app using Getx. Create a controller and declare variables like below In the Controller we declared Timer object _timer, and remainSeconds for checking on the remaining seconds and then a time variable. This time variable would be reactive. It means we Timer object’s return value would be saved time…
Flutter Get Tap Position ( X & Y Coordinates)
In Flutter if you wanna get the x and y position or get tap position, you may use GestureDetector widget. It provides onTapDown property which takes a function. This could be used for Gaming tap position
Flutter Getx LocalizationController | Set Locale
Setting local happens using Locale() constructor. It takes language code and country code. Locale is used the change the language on button click or onPressed events. Flutter framework recognizes different language using language code and country code. If you have many languages, then you should save those languages and related info in List. In the…
How to Dispose Remove or Close Getx Controller
In general Getx controllers should be removed or disposed automatically. But if you wanna force to be removed there are a few ways, you can try. 1. Inside Build Method If you want the controllers to be removed forcefully automatically, then you can inject the controller inside the build method of your class. If you…
Flutter Getx Radio Buttons | Toggle Selection | State Management
Learn how to use manage state with getx for flutter radio buttons. Radio buttons and getx state management. You will also learn how to select or toggle the buttons. Entry point main.dart Controller Below is the controller that maintains the state of the radio buttons import ‘package:get/get.dart’;class ButtonController extends GetxController{ String _orderType = ‘home_delivery’; String…