HttpClient class abstract

An HTTP client acts as a single point from which many requests can be constructed. All requests constructed from a client will inherit headers, the withCredentials flag, and the timeoutThreshold.

On the server, the Dart VM will also be able to take advantage of cached network connections between requests that share a client.

Inheritance
Implementers

Constructors

HttpClient.new({TransportPlatform? transportPlatform})
factory

Properties

autoRetry ↔ AutoRetryConfig
Configuration of automatic request retrying for failed requests. Use this object to enable or disable automatic retrying, configure the criteria that determines whether or not a request should be retried, as well as the number of retries to attempt.
getter/setter pairinherited
baseUri Uri?
A base URI that all requests from this client should inherit.
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, String>
Get and set request headers that will be applied to all requests created by this HTTP client.
getter/setter pairinherited
isClosed bool
Whether or not the HTTP client has been closed.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
timeoutThreshold Duration?
Amount of time to wait for a request created by this client to finish before canceling it and considering it "timed out" (results in a RequestException being thrown).
getter/setter pairinherited
withCredentials bool?
Whether or not to send requests from this client with credentials. Only applicable to requests in the browser, but does not adversely affect any other platform.
getter/setter pairinherited

Methods

addInterceptor(HttpInterceptor interceptor) → void
inherited
close() → void
Closes the client, cancelling or closing any outstanding connections.
inherited
newFormRequest() FormRequest
Constructs a new FormRequest that will use this client to send the request. Throws a StateError if this client has been closed.
inherited
newJsonRequest() JsonRequest
Constructs a new JsonRequest that will use this client to send the request. Throws a StateError if this client has been closed.
inherited
newMultipartRequest() MultipartRequest
Constructs a new MultipartRequest that will use this client to send the request. Throws a StateError if this client has been closed.
inherited
newRequest() Request
Constructs a new Request that will use this client to send the request. Throws a StateError if this client has been closed.
inherited
newStreamedRequest() StreamedRequest
Constructs a new StreamedRequest that will use this client to send the request. Throws a StateError if this client has been closed.
inherited
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