pushRoute method
Puts a new route
on top of the navigation stack.
The route may also be given a name
, in which case it will be cached in
the routes map under this name (if there was already a route with the
same name, it will be overwritten).
The method calls Route.didPush for this new route after it is added.
Implementation
void pushRoute(Route route, {String? name, bool replace = false}) {
final previousRouteArgument = currentRoute;
if (name != null) {
route.name = name;
_routes[name] = route;
}
if (replace) {
_removeTopRoute(route);
}
add(route);
_routeStack.add(route);
_adjustRoutesOrder();
route.didPush(previousRouteArgument);
_adjustRoutesVisibility();
}