Force Flutter navigator to reload state when popping

I have one StatefulWidget in Flutter with button, which navigates me to another StatefulWidget using Navigator.push(). On second widget I’m changing global state (some user preferences). When I get back from second widget to first, using Navigator.pop() the first widget is in old state, but I want to force it’s reload. Any idea how to do this? I have one idea but it looks ugly:

  1. pop to remove second widget (current one)
  2. pop again to remove first widget (previous one)
  3. push first widget (it should force redraw)

21 Answers
21

Leave a Comment