The base class for HTTP requests.
Subclasses of BaseRequest can be constructed manually and passed to send, which allows the user to provide fine-grained control over the request properties. However, usually it's easier to use convenience methods like get or get.
- Implemented by
Constructors
- BaseRequest(String method, Uri url)
-
Creates a new HTTP request.
Properties
- contentLength → int
-
The size of the request body, in bytes.
read / write - finalized → bool
-
Whether the request has been finalized.
read-only - followRedirects → bool
-
Whether the client should follow redirects while resolving this request. Defaults to true.
read / write - headers → Map<String, String>
-
The headers for this request.
read-only - maxRedirects → int
-
The maximum number of redirects to follow when
followRedirects
is true. If this number is exceeded theBaseResponse
future will signal aRedirectException
. Defaults to 5.read / write - method → String
-
The HTTP method of the request. Most commonly "GET" or "POST", less commonly "HEAD", "PUT", or "DELETE". Non-standard method names are also supported.
read-only - persistentConnection → bool
-
Whether a persistent connection should be maintained with the server. Defaults to true.
read / write - url → Uri
-
The URL to which the request will be sent.
read-only - hashCode → int
-
Get a hash code for this object.
read-only, inherited - runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Operators
-
operator ==(
other) → bool -
The equality operator.
inherited
Methods
-
finalize(
) → ByteStream -
Finalizes the HTTP request in preparation for it being sent. This freezes all mutable fields and returns a single-subscription ByteStream that emits the body of the request.
-
send(
) → Future<StreamedResponse> -
Sends this request.
-
toString(
) → String -
Returns a string representation of this object.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited