Search code examples
flutterflutter-getx

Using GetX, switch tabs of a tab bar from another page


So I have this scenario, where I have two pages (not siblings), where one page activity affects the tab bar of the another page. So what I want to have is that when something is updated on page one, the tab bar should switch to that specific tab automatically in that second page. I must use GetX for this.

What I tried

So I created a GetXController where I was managing the TabBarController, but Obx will only rerender the widget if that controller's value changes, but I'm not sure if updating the controller's value again and again is the way to go while updating initalIndex. Any help will be appreciated.


Solution

  • Instead of updating the value of an Rx variable you can simply call refresh() on it to trigger a rebuild of the Obx