pushNamed method
Puts the route name
on top of the navigation stack.
If the route is already in the stack, it will be simply moved to the top. Otherwise the route will be mounted and added at the top. We will also initiate building the route's page if it hasn't been built before. If the route is already on top of the stack, this method will do nothing.
The method calls the Route.didPush callback for the newly activated route.
Implementation
void pushNamed(String name, {bool replace = false}) {
final route = _resolveRoute(name);
final previousRouteArgument = currentRoute;
if (route == currentRoute) {
return;
} else if (replace) {
_removeTopRoute(route);
}
if (_routeStack.contains(route)) {
_routeStack.remove(route);
} else {
add(route);
}
_routeStack.add(route);
_adjustRoutesOrder();
route.didPush(previousRouteArgument);
_adjustRoutesVisibility();
}