use method

void use(
  1. RequestHandler handler, {
  2. String? method,
})

Implementation

void use(RequestHandler handler, {String? method}) {
  if (method != null) {
    final handlers = _middlewares[method];
    if (handlers == null) {
      _middlewares[method] = [handler];
    } else {
      _middlewares[method]!.add(handler);
    }
  } else {
    use(handler, method: 'GET');
    use(handler, method: 'POST');
    use(handler, method: 'PATCH');
    use(handler, method: 'PUT');
    use(handler, method: 'DELETE');
    use(handler, method: 'OPTIONS');
  }
}