BeamGuard class

Checks whether current BeamLocation is allowed to be beamed to and provides steps to be executed following a failed check.

If neither beamTo, beamToNamed nor showPage is specified, the guard will just block navigation, i.e. nothing will happen.

Constructors

BeamGuard({required List pathBlueprints, required bool check(BuildContext context, BeamLocation<BeamState> location), void onCheckFailed(BuildContext context, BeamLocation<BeamState> location)?, BeamLocation<BeamState> beamTo(BuildContext context)?, String? beamToNamed, BeamPage? showPage, bool guardNonMatching = false, bool replaceCurrentStack = true})

Properties

beamTo ↔ (BeamLocation<BeamState> Function(BuildContext context)?)
If guard check returns false, build a BeamLocation to be beamed to.
getter/setter pair
beamToNamed String?
If guard check returns false, beam to this URI string.
getter/setter pair
check bool Function(BuildContext context, BeamLocation<BeamState> location)
What check should be performed on a given location, the one to which beaming has been requested.
getter/setter pair
guardNonMatching bool
Whether to check all the path blueprints defined in pathBlueprints or check all the paths that are not in pathBlueprints.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
onCheckFailed ↔ (void Function(BuildContext context, BeamLocation<BeamState> location)?)
Arbitrary closure to execute when check fails.
getter/setter pair
pathBlueprints List
A list of path strings or regular expressions (using dart's RegExp class) that are to be guarded.
getter/setter pair
replaceCurrentStack bool
Whether or not to replace the current BeamLocation's stack of pages.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showPage BeamPage?
If guard check returns false, put this page onto navigation stack.
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
shouldGuard(BeamLocation<BeamState> location) bool
Whether or not the guard should check the location.
toString() String
A string representation of this object.
inherited

Operators

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