Every Time the Page Appears on Screen?

In other words: every time the page has the focus.

That encompasses three scenarios:

When we first open it; When we come back to it after opening another page; When we put the app in the background while the page was on screen, and then bring the app back to the foreground;

Native mobile developers acknowledge this as using the onResume or viewDidAppear callback, but in Flutter, there wasn't a dead-simple way to accomplish the same.

Your first impulse will tell you to use the build method, but that’s a terrible idea because it runs anytime your widget needs to rebuild, and that happens quite a lot.

Then, after spending some time at Google or StackOverflow, RouteObserver along with RouteAware widgets will pop at you. It's a way to register your widget to be notified whenever we push and pop back to its Route . Problems? It won't effortlessly work if you use nested Navigator s. Think about it: if you use, for example, a bottom navigation structure, there are two ways in which your page can appear on screen:

If we push or pop back to its Route ; If we push or pop back to its “parent widget’s Route “ (the page holding the bottom navigation menu);

To cover the second case, we would have to do all the RouteAware set up on the parent widget as well and find a way to propagate the event down the tree. If it sounded like a lot of work, that's because it is! Also, it wouldn't cover the scenario in which we put the app in the background and then bring it to the foreground again, as the pushed route's remained the same.

Thankfully, some guys at Google (apparently not from the core Flutter team) provided us a package that gets us closer to what we want.