sturdy_http library

Classes

BackgroundDeserializer
A Deserializer that shifts its work to a worker isolate named _workerIsolateName. The worker isolate is spawned on the first request to deserialize for this instance and re-used to avoid the high cost of spinning up new Isolates.
DeleteRequest
A NetworkRequest with NetworkRequestType.Delete.
Deserializer
Contract to be implemented to facilitate transforming NetworkResponse into the desired application domain models.
GetRequest
A NetworkRequest with NetworkRequestType.Get.
MainIsolateDeserializer
A Deserializer that does its work directly on the main isolate.
NetworkRequest
The base class representing a request to be executed by SturdyHttp.
NetworkRequestBody
The body of a NetworkRequest. Note that this type is aimed at providing readability and type safety and does not dictate behavior of SturdyHttp with regards to the content-type header. If you want SturdyHttp to infer the content-type header, configure this via the inferContentType parameter when constructing the instance.
NetworkResponse<R>
The produced object after SturdyHttp processes a NetworkRequest.
NeverRetry
Indicates that a request should never be retried.
PostRequest
A NetworkRequest with NetworkRequestType.Post.
PutRequest
A NetworkRequest with NetworkRequestType.Put.
RawRequest
A NetworkRequest that allows for passing a NetworkRequestType (useful for when this can't be known until runtime). It also defaults to a raw (null) body.
Retry
Indicates that a request should be retried up to maxRetries times with a delay of retryInterval between each attempt. Optionally, a RetryClause can be provided to further customize the retry behavior.
RetryBehavior
Specifies how a failed network request should be handled as it relates to retrying the request.
SturdyHttp
A client that facilitates network interactions. This client offers the following benefits:
SturdyHttpEvent
Represents an event that occurs during a request lifecycle.
SturdyHttpEventListener
A listener that can optionally be supplied when constructing an SturdyHttp to be notified when various events occur while processing NetworkRequests.
Unspecified
Indicates that the behavior for retrying a request is unspecified.

Enums

NetworkRequestType
A type representing the available HTTP request methods.

Extensions

DioExceptionX on DioException
NetworkResponseX on NetworkResponse<M>
Extensions on the NetworkResponse type
RetryBehaviorX on RetryBehavior
Extensions on the RetryBehavior type.

Constants

defaultRetryStatusCodes → const List<int>
The default status codes that will trigger a retry.

Functions

defaultRetryClause(Response<Object?>? r) bool
The default RetryClause to be used when Retry is specified without a custom RetryClause.

Typedefs

Json = Map<String, dynamic>
A nicety to represent a Map as json while making network requests
RetryClause = bool Function(Response<Object?>? r)
A function that returns true if the given Response r should be retried.