ValueRoute<T extends RouteValue> class

Use when you need to pass data to the route. T is the type you will use to navigate to this route and pass data.

To declare the value type, extend RouteValue:

class ProductRouteValue extends RouteValue {
  const ProductRouteValue(this.product);
  final Product product;
}

To navigate to the route, pass a value of type T the to the navigator:

context.hyper.navigate(ProductRouteValue(Product(/*...*/)));

If you enableUrl, make sure to provide a urlParser for serializing the value.

Inheritance
Implementers

Constructors

ValueRoute({required Widget screenBuilder(BuildContext context, T value), T? defaultValue, Page pageBuilder(BuildContext context, Widget child)?, UrlParser<T>? urlParser, List<HyperRoute<RouteValue>> children = const []})

Properties

children List<HyperRoute<RouteValue>>
finalinherited
defaultValue → T?
During navigation, when a new stack is being composed, the values from the previous stack are reused. However, if the new stack contains routes (apart from the target route) that aren't present in the previous stack, those routes will have to rely on their default values.
final
hashCode int
The hash code for this object.
no setterinherited
key Object
Same as RouteValue.key
no setteroverride
pageBuilder Page Function(BuildContext context, Widget child)?
final
parent HyperRoute<RouteValue>?
latefinalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
screenBuilder Widget Function(BuildContext context, T value)
final
urlParser UrlParser<T>?
Provide if you've set HyperRouter.enableUrl to true.
final

Methods

buildPage(BuildContext context, T value) Page
createFromUrl(UrlData url) RouteNode<RouteValue>?
Receives a list of url segments and returns the stack parsed from them. The first segment in the list is matched against this route. If it does not correspond to this route, returns null.
override
createNode({RouteNode<RouteValue>? next, T? value}) RouteNode<RouteValue>
override
createStack({RouteNode<RouteValue>? next, required Map<Object, RouteValue> values}) RouteNode<RouteValue>?
Creates a stack of RouteNodes from this route to the root.
inherited
forEach(void action(HyperRoute<RouteValue> r)) → void
inherited
nextNodeFromUrl(UrlData url) RouteNode<RouteValue>?
Finds a route that matches the url among its children and returns a stack created from it.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
updateWithNext({RouteNode<RouteValue>? next, required T value}) RouteNode<RouteValue>
Prioritizes next over value.
inherited
updateWithValue({RouteNode<RouteValue>? next, required T value}) RouteNode<RouteValue>
Prioritizes value over next.
inherited

Operators

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