toAutoRouteGuardGlobal<T extends PageRouteInfo<Object?>> method

AutoRouteGuard toAutoRouteGuardGlobal<T extends PageRouteInfo<Object?>>(
  1. GuardedRouteGeneratingFunction<T> redirect
)

Converts your project's guard into an auto_route guard pretended to be used in the router's guards getter, globally to the whole router

Implementation

AutoRouteGuard toAutoRouteGuardGlobal<T extends PageRouteInfo>(
  GuardedRouteGeneratingFunction<T> redirect,
) {
  return GuardsAutoRouteGuard(this, redirect);
  //   AutoRouteGuard.simple((resolver, router) {
  //       if(isAuthenticated || resolver.routeName == LoginRoute.name) {
  //         // we continue navigation
  //         resolver.next();
  //       } else {
  //         // else we navigate to the Login page so we get authenticated

  //         // tip: use resolver.redirectUntil to have the redirected route
  //         // automatically removed from the stack when the resolver is completed
  //         resolver.redirectUntil(LoginRoute(onResult: (didLogin) => resolver.next(didLogin)));
  //       }
  //     },
  //   ),
  //   // add more guards here
  // ];
}