methodNotAllowed static method

dynamic methodNotAllowed()

Creates a Response for a request with a Method Not Allowed status.

Returns:

  • A Response with a 405 status code and a message indicating that the method is not allowed.

Implementation

static methodNotAllowed() {
  // Create a Response object with a status code of 405 (Method Not Allowed)
  return Response('{"error": "Method Not Allowed"}', 405,
      headers: {'Content-Type': 'application/json'});
}