findMatch method

RouteMatchList findMatch(
  1. String location, {
  2. Object? extra,
})

Finds the routes that matched the given URL.

Implementation

RouteMatchList findMatch(String location, {Object? extra}) {
  final Uri uri = Uri.parse(canonicalUri(location));

  final Map<String, String> pathParameters = <String, String>{};
  final List<RouteMatch>? matches = _getLocRouteMatches(uri, pathParameters);

  if (matches == null) {
    return _errorRouteMatchList(
        uri, GoException('no routes for location: $uri'));
  }
  return RouteMatchList(
      matches: matches,
      uri: uri,
      pathParameters: pathParameters,
      extra: extra);
}