evaluateGuards method

Future<GuardResult> evaluateGuards(
  1. BloomRoute route,
  2. String location,
  3. Map<String, String> params
)

Evaluates all navigation guards attached to route in sequential order.

Passes the full location (including query string and hash fragment) and extracted params to each BloomRouteGuard.canActivate.

Returns the first failing GuardResult if any guard disallows navigation, or GuardResult.allow if all guards pass.

Implementation

Future<GuardResult> evaluateGuards(
  BloomRoute route,
  String location,
  Map<String, String> params,
) async {
  for (final guard in route.guards) {
    final res = await guard.canActivate(location, params);
    if (!res.isAllowed) return res;
  }
  return GuardResult.allow();
}