setupRoutes method
Pushes given routes
to _pages
stack
after match validation and deciding initial index
Implementation
void setupRoutes(List<PageRouteInfo>? routes) {
final routesToPush = _resolveRoutes(routes);
if (_routeData.hasPendingChildren) {
final preMatchedRoute = _routeData.pendingChildren.last;
final correspondingRouteIndex = routesToPush.indexWhere(
(r) => r.key == preMatchedRoute.key,
);
if (correspondingRouteIndex != -1) {
routesToPush[correspondingRouteIndex] = preMatchedRoute;
_previousIndex = _activeIndex;
_activeIndex = correspondingRouteIndex;
}
}
if (routesToPush.isNotEmpty) {
_pushAll(routesToPush, fromDefault: routes == null);
}
_routeData.pendingChildren.clear();
}