plex_router/plex_route_guard library

Classes

PlexAuthGuard
Redirects to loginPath if currentUser is null.
PlexRoleGuard
Redirects (excludes route) if user lacks the required rule.
PlexRouteContext
Context passed to PlexRouteGuard when evaluating a route.
PlexRouteGuard
Guard that can redirect before navigation. Return null to allow, or a path to redirect.

Functions

evaluateRouteGuards(List<PlexRouteGuard> guards, String? rule, PlexRouteContext context) Future<bool>
Evaluates guards for a route. If guards is empty and rule is set, uses PlexRoleGuard. Returns true if the route is allowed, false if any guard redirects.