onBefore method
Called before navigation to the route.
Return next to continue navigation, or redirect/abort to stop.
Example:
@override
Future<GuardResult> onBefore(RouteContext context) async {
if (!await hasPermission()) {
return redirect('/unauthorized');
}
return next();
}
Implementation
Future<GuardResult> onBefore(RouteContext context) async => GuardResult.next;