LoginGuard class

A guard that checks if the user is logged in. If not, it redirects to the loginPath.

Inheritance
Available extensions

Constructors

LoginGuard({required String loginPath})
A guard that checks if the user is logged in. If not, it redirects to the loginPath.

Properties

changeNotifier Stream<bool>
A stream that could be listened to for changes in the guard's status. This stream will emit new values only when the guard's status changes, i.e., when the value emitted is different from the previous one.
no setterinherited
checkIfSatisfied FutureOr<bool>
The function to override for indicating if the guard is satisfied or not.
no setteroverride
currentStatus bool
The current status of the guard, whether it is satisfied or not.
no setterinherited
guardIdentifier String
The path to redirect if the user is not logged in.
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
loginPath String
Creates a LoginGuard instance.
final
parentGuardSystem Guards<GuardBase>
Leave visible for eventual interaction with sibling guards or custom/complex interactions in the update method.
no setterinherited
persistenceDelegate PersistenceDelegate?
The delegate that will be used for checking the guards. If null here, the guard system will provide the persistence delegate it has, that can also be null; in which case the guard will not persist its status.
getter/setter pairinherited
redirectPath String
The path to redirect if the user is not logged in.
no setteroverride
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
setUpAndInitializeGuard() Future<bool>
Checks if the user is logged in, persists it, and returns whether the user is logged in.
override
toAutoRouteGuardGlobal<T extends PageRouteInfo<Object?>>(GuardedRouteGeneratingFunction<T> redirect) → AutoRouteGuard

Available on GuardBase, provided by the AutoRouteExtensionGuardBase extension

Converts your project's guard into an auto_route guard pretended to be used in the router's guards getter, globally to the whole router
toAutoRouteGuardLocal<T extends PageRouteInfo<Object?>>(GuardedRouteGeneratingFunction<T> redirect) → AutoRouteGuard

Available on GuardBase, provided by the AutoRouteExtensionGuardBase extension

Converts your project's guard into an auto_route guard pretended to be used in the router's route definition, locally to that route.
toString() String
A string representation of this object.
inherited
update({required bool isSatisfied}) Future<bool>
Call this function if you want to update the guard's status. This will also update the persistence delegate if it is not null.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited