fromString static method

HttpMethod fromString(
  1. String method
)

Parses an string into a Method Enum value.

Implementation

static HttpMethod fromString(String method) {
  switch (method) {
    case "HEAD":
      return HttpMethod.HEAD;
    case "GET":
      return HttpMethod.GET;
    case "POST":
      return HttpMethod.POST;
    case "PUT":
      return HttpMethod.PUT;
    case "PATCH":
      return HttpMethod.PATCH;
    case "DELETE":
      return HttpMethod.DELETE;
  }
  throw ArgumentError.value(method, "method", "Must be a valid HTTP Method.");
}