CanReuse class

Defines route lifecycle method routerCanReuse, which is called by the router to determine whether a component should be reused across routes, or whether to destroy and instantiate a new component.

The routerCanReuse hook is called with two ComponentInstructions as parameters, the first representing the current route being navigated to, and the second parameter representing the previous route.

If routerCanReuse returns or resolves to true, the component instance will be reused and the OnDeactivate hook will be run. If routerCanReuse returns or resolves to false, a new component will be instantiated, and the existing component will be deactivated and removed as part of the navigation.

If routerCanReuse throws or rejects, the navigation will be cancelled.


FutureOr<bool> routerCanReuse(next, prev) => true;

See the router documentation for details.




hashCode → int
The hash code for this object. [...]
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited


routerCanReuse(ComponentInstruction nextInstruction, ComponentInstruction prevInstruction) → dynamic
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
toString() → String
Returns a string representation of this object.


operator ==(other) → bool
The equality operator. [...]