Search code examples
flutterdartflutter-getx

Getx: what does the `.obs` function do?


Could you explain what does the .obs function do?

RxInt _questionNumber = 1.obs;

Solution

  • It makes questionNumber an observable variable. Which means that whenever the value of that variable changes, that change will be automatically reflected on all places where it's being used. It's like listening to a stream.