withUpdatedValue method

RouteNode<RouteValue> withUpdatedValue(
  1. Object key,
  2. RouteValue value
)

Returns a copy of the stack where the node with key is replaced with a node containing the provided value.

Implementation

RouteNode withUpdatedValue(Object key, RouteValue value) {
  if (key == this.key) {
    return route.updateWithValue(
      next: next,
      value: value,
      popCompleter: popCompleter,
    );
  }
  return route.updateWithNext(
    next: next?.withUpdatedValue(key, value),
    value: this.value,
    popCompleter: popCompleter,
  );
}