reevaluate method

  1. @override
void reevaluate(
  1. RedirectGuardBase guard,
  2. StackRouter router
)
override

Implementation

@override
void reevaluate(RedirectGuardBase guard, StackRouter router) {
  final stackData = router.stackData;
  final routesToRemove =
      List<RouteMatch>.unmodifiable(stackData.map((e) => e._match));
  for (final route in routesToRemove) {
    router._removeRoute(route, notify: false);
  }

  final routesToPush = <RouteMatch>[];
  for (final existingMatch in stackData.map((e) => e.route)) {
    final routeToPush = router.matcher.matchByRoute(
      existingMatch.toPageRouteInfo(),
    );
    if (routeToPush != null) {
      routesToPush.add(routeToPush);
    }
  }
  router._pushAllGuarded(routesToPush);
}