BaseRequest class

The base class for HTTP requests.

Subclasses of BaseRequest can be constructed manually and passed to BaseClient.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 BaseClient.get.



BaseRequest(String method, Uri url)
Creates a new HTTP request.


contentLength ↔ int
The size of the request body, in bytes. [...]
read / write
finalized → bool
Whether the request has been finalized.
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.
maxRedirects ↔ int
The maximum number of redirects to follow when followRedirects is true. If this number is exceeded the BaseResponse future will signal a RedirectException. 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.
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.
hashCode → int
The hash code for this object.
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited


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.


operator ==(dynamic other) → bool
The equality operator.