The GetX Widget
Learn to handle automatic state updates with GetX.
We'll cover the following...
Overview
The GetX widget is practically the same as GetBuilder with one key difference—it’s based on update method to refresh widgets manually. Instead, with GetX, we actively listen to state changes and refresh widgets automatically.
Let’s see how to use it. First, we create the controller to hold our variables and methods.
class Controller extends GetxController {final RxInt count = 0.obs;void incrementCount() => count.value++;}
RxInt is short for reactive integer. Basically, it’s a stream of type int. We can make any variable reactive or observable using the .obs extension. We use the .value extension to access and update the value of the stream. ...