Flutter GO_Router pop named and rebuild Widget

190 Views Asked by At

My example stack in GoRouter:

Page1 -> Page2 -> Page3 -> Page4

In Page4 is a Button do navigate to Page2 ...

If I try context.goNamed('page2') the Widget Page2 (a form filled with user inputs) is not rebuild (data still in state) ... how can I navigate to page2 with force rebuild the widget (initState etc.)?

1

There are 1 best solutions below

2
On

Try this ;

context.replace('location');
context.replaceNamed('location');
context.pushReplacement('location');
context.pushReplacementNamed('location');