handle method
Runs the handler for method, or returns null when none exists.
Implementation
Future<ServerResponse>? handle(
HttpMethod method,
RequestContext request,
RouteMatches matches,
) {
final handler =
handlers[method] ??
(method == HttpMethod.head ? handlers[HttpMethod.get] : null);
if (handler == null) return null;
final match = matches.match(this)!;
return Future<ServerResponse>.sync(
() => handler(
ServerRouteContext<P, S>(
context: request,
params: match.params,
search: match.search,
location: match.location,
),
),
);
}