-1

i'm struggling to find a solution to my issue, i hope you guys can help.

in (PAGE 1) i have Streambuilder and i'm forwarding data to (PAGE 2) through the constructor and then to (PAGE 3).

now (PAGE 1 receives stream of live data that updates whenever changes occur.

the problem here the data in (PAGE 2 & 3) don't listen to those updates.

now how can i make those data listen to updates. taking into account index is involved when passing those data.

NOTE: i'm using Getx for state management

thank you.

i can't find a way that works when index is involved

  • 3
    Please provide enough code so others can better understand or reproduce the problem. – Community Jan 21 '23 at 03:42
  • Hi, you need to provide code to get ourselves in the context of your problem, However, if you have a `StreamBuilder` that contains nested widgets, you can get the expected update in them, but navigating between pages using `Navigator`, will open each page as a sibling of the previous one in the `Navigator` tree, even if it is like that every page is child of the previous one, so you can't achieve your goal using a `StreamBuilder`. – Gwhyyy Jan 21 '23 at 05:15
  • You will need to learn and use features of a specific state manager, in your case you're using Getx, right? then you should better look to use a `GetxController` where the state and relations of those pages are, manage it from there and expose a state update using `GetBuilder`, `Obx`.. widgets – Gwhyyy Jan 21 '23 at 05:17
  • thank you for your reply, no code required here, i'm presenting a scenario , i am using Getx controller, but you cant use obx on values from listview builder, because it's based on index as i mentioned above. – user21053481 Jan 21 '23 at 07:58

1 Answers1

0

Yes, you can solve that problem, rather than using StreamBuilder you can use Rx and Obx for continuous updates.

I provide you steps to start to implement like below:

Step 1: create a controller and add any variable using the Rx keyword.

Step 2: use the Obx widget where you want to listen to continuous updates.

now all three pages have an Obx widget so when you change the value, it listens on all three widgets.

Khunt Arpit
  • 438
  • 4
  • 11
  • thank you for your answer, that would work if index is not part of the equation . the data are passed based on index from list view builder. – user21053481 Jan 21 '23 at 07:54