HandleClient class Clients

A client that allows retrying HTTP request with different request on response or errors

Inheritance
Mixed in types

Constructors

HandleClient(Client client, {WhenCallback? when, WhenErrorCallback? whenError, WhenRetriedCallback? onRetry, DelayCallback? delay, WhenRequestCallback? updateRequest})
Creates a client that allows retrying HTTP request with different request on response or errors

Properties

delay DelayCallback?
The callback that determines how long to wait before retrying a request.
final
hashCode int
The hash code for this object.
no setterinherited
inner → Client
The inner Client of this WrapperClient.
no setterinherited
onRetry WhenRetriedCallback?
The callback to call to indicate that a request is being retried.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
updateRequest WhenRequestCallback?
The callback that updates a request that should be retried.
final
when WhenCallback?
The callback that determines whether a request should be retried.
final
whenError WhenErrorCallback?
The callback that determines whether a request when an error is thrown.
final

Methods

calculateDelay(int retryCount) Duration?
Returns a duration of delay before retrying a request
override
close({bool force = true, Client? keepAliveHttpClient}) → void
Closes the client and cleans up any resources associated with it.
inherited
delete(Uri url, {Map<String, String>? headers, Object? body, Encoding? encoding}) Future<Response>
Sends an HTTP DELETE request with the given headers to the given URL.
inherited
get(Uri url, {Map<String, String>? headers}) Future<Response>
Sends an HTTP GET request with the given headers to the given URL.
inherited
getUpdatedRequest(BaseRequest originalRequest, BaseRequest lastRequest, FinalizedBodyStreamCallback bodyStream, BaseResponse? response, int retryCount) FutureOr<BaseRequest>
Returns an updated request that should be retried
override
Sends an HTTP HEAD request with the given headers to the given URL.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onRequestRetry(BaseRequest request, BaseResponse? response, int retryCount) FutureOr<void>
This is called when a request is being retried. This is called after the request is updated and before the request is sent.
override
patch(Uri url, {Map<String, String>? headers, Object? body, Encoding? encoding}) Future<Response>
Sends an HTTP PATCH request with the given headers and body to the given URL.
inherited
post(Uri url, {Map<String, String>? headers, Object? body, Encoding? encoding}) Future<Response>
Sends an HTTP POST request with the given headers and body to the given URL.
inherited
put(Uri url, {Map<String, String>? headers, Object? body, Encoding? encoding}) Future<Response>
Sends an HTTP PUT request with the given headers and body to the given URL.
inherited
read(Uri url, {Map<String, String>? headers}) Future<String>
Sends an HTTP GET request with the given headers to the given URL and returns a Future that completes to the body of the response as a String.
inherited
readBytes(Uri url, {Map<String, String>? headers}) Future<Uint8List>
Sends an HTTP GET request with the given headers to the given URL and returns a Future that completes to the body of the response as a list of bytes.
inherited
retryRequestWhen(BaseResponse response, int retryCount) FutureOr<bool>
This is used to determine whether a request should be retried
override
retryRequestWhenError(Object object, StackTrace stackTrace, int retryCount) FutureOr<bool>
This is used to determine whether a request should be retried when an error is thrown
override
send(BaseRequest originalRequest) Future<StreamedResponse>
Sends an HTTP request and asynchronously returns the response.
inherited
toString() String
A string representation of this object.
inherited

Operators

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