BloomGuard class abstract

Abstract contract for route guards (e.g. authentication, role permissions, feature flags).

Guards run asynchronously before a route is resolved and can redirect or cancel navigation.

Example:

class AuthGuard extends BloomGuard {
  const AuthGuard();

  @override
  FutureOr<GuardResult> canActivate(BuildContext context, BloomRouteMatch match) {
    final auth = inject<AuthService>();
    return auth.isLoggedIn ? GuardResult.allow() : GuardResult.redirect('/login');
  }
}
Implementers

Constructors

BloomGuard()
Creates a BloomGuard.
const

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

canActivate(BuildContext context, BloomRouteMatch match) FutureOr<GuardResult>
Determines whether navigation to the matched route should be allowed, redirected, or denied.
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