createStack method

RouteNode<RouteValue>? createStack({
  1. RouteNode<RouteValue>? next,
  2. required Map<Object, RouteValue> values,
  3. Map<Object, Completer> popCompleters = const {},
})

Creates a stack of RouteNodes from this route to the root.

Implementation

RouteNode? createStack({
  RouteNode? next,
  required Map<Object, RouteValue> values,
  Map<Object, Completer> popCompleters = const {},
}) {
  final node = createNode(
    next: next,
    value: values[key] as T?,
    popCompleter: popCompleters[key],
  );

  if (parent case final parent?) {
    return parent.createStack(
      next: node,
      values: values,
      popCompleters: popCompleters,
    );
  } else {
    return node;
  }
}