reevaluate method
Implementation
@override
void reevaluate(RedirectGuardBase guard, StackRouter router) {
final routes = router.stackData.map((e) => e.route).toList();
final firstGuardedRouteIndex =
routes.indexWhere((r) => r.guards.contains(guard));
if (firstGuardedRouteIndex == -1) return;
final routesToRemove =
routes.sublist(firstGuardedRouteIndex, routes.length);
for (final route in routesToRemove) {
router._removeRoute(route, notify: false);
}
// resolve initial child routes if there are any
final routeToPush = router.matcher.matchByRoute(
routes[firstGuardedRouteIndex].toPageRouteInfo(),
);
if (routeToPush != null) {
router._pushAllGuarded([routeToPush]);
}
}