findMatch method

RouteMatchList findMatch(
  1. Uri uri, {
  2. Object? extra,
})

Finds the routes that matched the given URL.

Implementation

RouteMatchList findMatch(Uri uri, {Object? extra}) {
  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,
  );
}