toHierarchy static method

RouteMatch toHierarchy(
  1. List<RouteMatch> segments
)

Implementation

static RouteMatch toHierarchy(List<RouteMatch> segments) {
  if (segments.length == 1) {
    return segments.first;
  } else {
    return segments.first.copyWith(children: [
      toHierarchy(
        segments.sublist(1, segments.length),
      ),
    ]);
  }
}