Getx is the most popular state management package of Flutter. One of the way you make your variables, classes or objects observable is via obs.
To make any kind of variable or object or class observable, you need to use .obs with object or variable or class.
In the picture line 4, we see we made a class obs type.
On line 5, we make a boolean obs type.
on line 6, we make a List obs.
Also see how we used it with List by making it empty.
And we see that our class name is MessageState which holds every variable.
Let’s see how to access the all the obs variables in the controller. To do that, we need to instantiate an object with it.
Here on line 19, we see we have final state = MessageState(). This will get all the obs type variables in the state object.
Now to access any of the obs variable or object you need to use dot operator with state object.
On line 25 you see that we use state.head_detail.value to access the head_detail.obs variable declared in MessageState class.