CameraGuard class

A guard that checks if the camera permission is granted. If not, it redirects to the cameraPermissionPath.

Inheritance
Available extensions

Constructors

CameraGuard.new({required String cameraPermissionPath, CameraPersistenceDelegate? persistenceDelegate})
Creates a CameraGuard instance.

Properties

cameraPermissionPath String
The path to redirect if the camera permission is not granted.
final
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
A key for identifying this guard in a key-value way
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
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 guard is not satisfied
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 camera permission, persists it, and returns whether permission is granted.
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