matchUrl static method

RouteNode<RouteValue>? matchUrl({
  1. required UrlData url,
  2. required List<HyperRoute<RouteValue>> routes,
})

Finds a route that matches the url and creates a stack from it.

Implementation

static RouteNode? matchUrl({
  required UrlData url,
  required List<HyperRoute> routes,
}) {
  if (url.segments.isEmpty) {
    return null;
  }

  for (final route in routes) {
    final node = route.createFromUrl(url);
    if (node != null) {
      return node;
    }
  }

  return null;
}