Search code examples
androidfluttermobilenavigationnavigator

Flutter refresh first page after multiple navigations


my question is how to perform the following action in flutter:

I have a page with lists of groups (Page A) then I am pushing to group detail (Page B) and from Page B I am pushing to another screen to edit detail (Page C). What I want to achieve is that when I will pop back to Page A it will contain refreshed list with updated detail of specific groups. How can I achieve this?

WHAT I TRIED:

I know that when I am pushing from page A to page B and popping back from B is performing refresh (I can achieve this with then callback when going from A to B) ... but this approach is not working when going from A->B->C and then popping to A.


Solution

  • Why don't you try to use Flutter Route Observer, simply you can check if you pop back to page A then you fetch the updated list of groups.

    For more info you can check this link Route Observer Class

    Inside the didPopNext() method you can write code that will get executed when you pop to this page