In a Flutter app,
- I'm getting a list of objects on page A
- I go to page B to edit an object
- I return to page A but my edits from the previous step are not visible (data is not reloaded)
I'm using Go Router .go method to navigate between routes. When I return to page A, I need to reload it by calling initState but since it's already in the element tree, initState won't be called. What's the best way to force a route to refresh on return. I assume it's a common case for apps.
I'm using ShellRoutes with Go Router and this particular scenario happened within a ShellRoute. I run the following sequence:
- context.go('objects_list')
- context.go('object_details)
- Make edits to the object
- context.go('objects_list')
When I return to 'objects_list' route from 'objects_details', it won't refresh and still shows the old data. I need a way to force it to refresh. I have used .replace instead of .go method but since it replaces at the top navigator, it won't work.