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

Issue

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.

Answered By – S. M. JAHANGIR

Answer Checked By – Willingham (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.