dispatch abstract method

Future<void> dispatch(
  1. ServerHttpRequest request,
  2. ServerHttpResponse response
)

Handles the given request and produces a response.

This method typically includes:

  • Executing business logic or controllers
  • Routing requests to downstream handlers
  • Writing data to the response via ServerHttpResponse

Implementations should ensure the response is properly completed and any streams are flushed/closed as appropriate.

Example:

await dispatcher.dispatch(request, response);

request – The HTTP request to handle. response – The corresponding HTTP response provider to send output.

Implementation

Future<void> dispatch(ServerHttpRequest request, ServerHttpResponse response);