'Propagate state between different pages
I've three different MaterialPage
. So I use Navigator.push
to go from 1 -> 2 -> 3.
Now, page 1 make an HTTP request to GET
a model that is then used in page 1, 2 and 3.
At the end of the process an action on page 3 triggers some modification of the model on the server. How can I update the tree pages on the stack to reflect these changes? In order to do that I need to make a GET
request again.
Should I pass a callback from page 1 to 3 and then go back all the way up to page 1 (and then down again...), or duplicate the HTTP request in page 3? Or something else?
I've attached a schema, in order to clarify (I hope) my explanation. Thanks in advance.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|