register<TResponse, TRequest extends Request<TResponse>> method

void register<TResponse, TRequest extends Request<TResponse>>(
  1. RequestHandler<TResponse, TRequest> handler
)

Registers the handler to a given TRequest.

Implementation

void register<TResponse, TRequest extends Request<TResponse>>(
  RequestHandler<TResponse, TRequest> handler,
) {
  assert(
    !_handlers.containsKey(TRequest),
    'register<$TResponse, $TRequest> was called with an already registered handler',
  );

  _handlers[TRequest] = handler;
}