match method

RouteMatchResult? match(
  1. String method,
  2. String path
)

Matches a route for the given method and path. Matches the first route that fits the given method and path.

Implementation

RouteMatchResult? match(String method, String path) {
  _matcher ??= RouteMatcher(_registry.routes);
  final result = _matcher!.match(method, path);
  if (result != null) {
    return RouteMatchResult(
      handler: _handler.wrapWithExceptionHandler(result.handler),
      params: result.params,
      middleware: result.middleware,
    );
  }
  return null;
}