replaceAll method
Resets _pages
stack with given routes
and sets previousActiveRoute
as active index if provided
Implementation
void replaceAll(List<PageRouteInfo>? routes, int previousIndex) {
final routesToPush = _resolveRoutes(routes);
final previousActiveRoute = stackData[previousIndex];
_pages.clear();
_childControllers.clear();
_pushAll(routesToPush, fromDefault: routes == null);
var targetIndex = routesToPush.indexWhere((r) => r.name == previousActiveRoute.name);
if (targetIndex == -1) {
targetIndex = homeIndex == -1 ? 0 : homeIndex;
}
setActiveIndex(targetIndex, notify: false);
}