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<RouteMatchBase> matches =
      _getLocRouteMatches(uri, pathParameters);

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