didPush method
Called when a new route has been pushed onto the navigator.
route
is the route that is being pushed onto the navigator.
previousRoute
is the route that was on top before the new route was pushed.
Implementation
@override
void didPush(Route<dynamic> route, Route<dynamic>? previousRoute) {
super.didPush(route, previousRoute);
// Update the topRoute to the newly pushed route.
topRoute = route;
}