Reputation: 7965
I have two pages: page A has a "search" function, page B has a "select language" function. I navigate from page A to page B to select my language. Then I want to pop back from page B to page A with the new chosen language and perform the search automatically for that language.
I pass my chosen language from Page B to A by using SharedPrefs (which is working fine). So all I need is when I return to Page A, for the search function to get automatically triggered.
Is that possible in Flutter?
I tried using initState
but that only works once when the widget is first built. I also tried didUpdateWidget
but nothing happened.
Upvotes: 2
Views: 1890
Reputation: 267444
Use this when navigating to PageB
from PageA
Navigator.push(context, MaterialPageRoute(builder:(_) => PageB())).then((value) {
// you have come back to the pageA, now perform your logic
callThisMethod();
});
Upvotes: 7