createStack method

RouteNode<RouteValue> createStack(
  1. RouteValue target, [
  2. Set<RouteValue> values = const {}
])

Implementation

RouteNode createStack(
  RouteValue target, [
  Set<RouteValue> values = const {},
]) {
  final HyperRoute? targetRoute = routeMap[target.key];

  if (targetRoute == null) {
    throw HyperError(
        "Route tree doesn't contain route with the provided key: ${target.key}");
  }

  final valuesMap = extractCurrentValues();
  valuesMap[target.key] = target;
  valuesMap.addAll(Map.fromIterable(
    values,
    key: (element) => element.key,
  ));

  return targetRoute.createStack(values: valuesMap)!;
}