ZenithRouteGuard class
Evaluates a ZenithPolicy synchronously at the navigation layer, returning a redirect path if access is denied.
Designed for use with declarative routers (go_router, auto_route):
final redirect = ZenithRouteGuard.evaluate(
context: userSecurityContext,
policy: adminPolicy,
authService: authService,
deniedRedirectPath: '/login',
);
if (redirect != null) return redirect;
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
evaluate(
{required UserSecurityContext context, required ZenithPolicy policy, required ZenithAuthorizationService authService, required String deniedRedirectPath}) → String? -
Evaluates
policyagainstcontextviaauthService.