canActivate method
- String path,
- ModularRoute route
Returns a FutureOrGuardedRouteException
.
Implementation
@override
Future<bool> canActivate(String path, ModularRoute route) async {
final auth = Modular.get<AuthRepository>();
await Future.doWhile(() async {
await Future.delayed(const Duration(milliseconds: 100));
return auth.state.isLoading;
});
return auth.isAuthenticated;
}