replaceAll method

void replaceAll(
  1. List<PageRouteInfo> routes,
  2. PageRouteInfo previousActiveRoute
)

Implementation

void replaceAll(
    List<PageRouteInfo> routes, PageRouteInfo<dynamic> previousActiveRoute) {
  final routesToPush = _matchAllOrReportFailure(routes)!;

  _pages.clear();
  _childControllers.clear();
  _pushAll(routesToPush);
  var targetIndex =
      routesToPush.indexWhere((r) => r.name == previousActiveRoute.routeName);
  if (targetIndex == -1) {
    targetIndex = homeIndex == -1 ? 0 : homeIndex;
  }
  setActiveIndex(targetIndex, notify: false);
}