BloomAuthGuard class

Standard authentication route guard protecting authenticated screens.

Redirects unauthenticated visitors to loginPath (preserving original route in ?from=... query).

Example:

BloomRoute(
  path: '/dashboard',
  guards: const [BloomAuthGuard()],
  builder: (context, match) => const DashboardScreen(),
);
Implemented types

Constructors

BloomAuthGuard({String loginPath = '/login', BloomAuthBase? auth})
Creates a BloomAuthGuard with an optional loginPath and auth manager override.
const

Properties

auth BloomAuthBase?
Explicit BloomAuthBase session manager override. If null, resolved via global DI.
final
hashCode int
The hash code for this object.
no setterinherited
loginPath String
Path to redirect unauthenticated users to (defaults to '/login').
final
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.
override
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