handle method

  1. @override
FutureOr<String?> handle(
  1. BuildContext context,
  2. GoRouterState state
)
override

Logic to decide if the navigation should be redirected. Returns a path to redirect to, or null to allow navigation.

Implementation

@override
FutureOr<String?> handle(BuildContext context, GoRouterState state) {
  if (!isAuthenticated()) {
    return loginPath;
  }
  return null;
}