Skip to content

Instantly share code, notes, and snippets.

@jacobaraujo7
Created December 15, 2020 16:31
Show Gist options
  • Select an option

  • Save jacobaraujo7/464ed71287793adc923814cebe80ab2d to your computer and use it in GitHub Desktop.

Select an option

Save jacobaraujo7/464ed71287793adc923814cebe80ab2d to your computer and use it in GitHub Desktop.
class MyGuard extends RouteGuard {
@override
Future<bool> canActivate(String path, ModularRoute router) async {
if (path == '/admin') {
return await UserService().isAdmin();
} else {
return true;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment