Block class final

Blocks the navigation from proceeding.

Returning an object of this class from an onEnter callback halts the navigation completely.

Use Block.stop for a "hard stop" that resets the redirection history, or Block.then to chain a callback after the block (commonly to redirect elsewhere, e.g. router.go('/login')).

Note: We don't introspect callback bodies. Even an empty closure still counts as chaining, so prefer Block.stop when you want the hard stop behavior.

Inheritance

Constructors

Block.stop()
Creates a Block that stops navigation without running a follow-up callback.
const
Block.then(OnEnterThenCallback then)
Creates a Block that runs then after the navigation is blocked.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
isStop bool
Whether this block represents a hard stop without a follow-up callback.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
then OnEnterThenCallback?
Executed after the decision is committed. Errors are reported and do not revert navigation.
finalinherited

Methods

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