Search code examples
flutterpushnavigator

flutter navigator do when action after call pushReplacement in child page


I have a flutter app look like this

PAGE 1 > PAGE 2 > PAGE 3

When I change value on PAGE 2, I need to refresh data on PAGE 1 so I using Navigator.push from PAGE 1 to PAGE 2 with then action in PAGE 1. When I navigator from PAGE 2 to PAGE 3 by Navigator.pushReplacement (to escape from PAGE 3 to PAGE 1 when press back button) but when I navigator from PAGE 2 to PAGE 3 then when action are calling in PAGE 1 and when I press back button on PAGE 3 then action when are not calling

How can I still refresh data on PAGE 1 and when press back button on PAGE 3? and not call when action when navigator from PAGE 2 to PAGE 3


Solution

  • You can use any state management pattern like provider, you can easily update your data in PAGE 1 from anywhere under provider widget, have a look LINK_HERE