HttpMethod enum

author: ZhengZaiHong email:1096877329@qq.com date: 2025-01-31 describe: HTTP 请求方法枚举 HTTP method enumeration.

Defines the standard HTTP methods supported by RxNet Plus. This enum is used across all adapters to ensure consistency.

Inheritance
Available extensions

Values

GET → const HttpMethod

HTTP GET method - retrieves data from the server

Example:

RxNet.get().setPath("/users").request();
POST → const HttpMethod

HTTP POST method - submits data to the server

Example:

RxNet.post()
  .setPath("/users")
  .setBodyParams({"name": "John"})
  .asJson()
  .request();
PUT → const HttpMethod

HTTP PUT method - updates existing data on the server

Example:

RxNet.put()
  .setPath("/users/123")
  .setBodyParams({"name": "John Updated"})
  .asJson()
  .request();
DELETE → const HttpMethod

HTTP DELETE method - deletes data from the server

Example:

RxNet.delete().setPath("/users/123").request();
PATCH → const HttpMethod

HTTP PATCH method - partially updates data on the server

Example:

RxNet.patch()
  .setPath("/users/123")
  .setBodyParams({"email": "new@example.com"})
  .asJson()
  .request();

HTTP HEAD method - retrieves headers only (no body)

Useful for checking if a resource exists or getting metadata without downloading the entire response body.

Example:

RxNet.head().setPath("/users/123").request();
OPTIONS → const HttpMethod

HTTP OPTIONS method - describes communication options

Used to determine which HTTP methods are supported by the server for a specific resource (CORS preflight requests).

Example:

RxNet.options().setPath("/users").request();

Properties

hashCode int
The hash code for this object.
no setterinherited
index int
A numeric identifier for the enumerated value.
no setterinherited
name String

Available on Enum, provided by the EnumName extension

The name of the enum value.
no setter
name String

Available on HttpMethod, provided by the HttpMethodExtension extension

Returns lowercase string representation
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value String

Available on HttpMethod, provided by the HttpMethodExtension extension

Returns the string representation of the HTTP method
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

values → const List<HttpMethod>
A constant List of the values in this enum, in order of their declaration.