resilify_dio library

Opt-in package:dio integration for resilify.

Includes DioResultHandler (with file upload/download) and ResultLoggerInterceptor.

Classes

BaseOptions
A set of base settings for each Dio(). BaseOptions and Options will be merged into one RequestOptions before sending the requests. See Options.compose.
CancelToken
Controls cancellation of Dio's requests.
CircuitBreaker
Wraps an unreliable operation with the circuit-breaker resilience pattern: after failureThreshold consecutive failures the breaker "opens" and fast-fails calls for resetTimeout; one probe call is then admitted, and its outcome decides whether the breaker closes or reopens.
Dio
Dio enables you to make HTTP requests easily.
DioResultHandler
A Result-returning wrapper around a Dio instance — the recommended integration for production apps.
Error<T>
The failed variant of a Result.
Failure
An immutable, structured description of why an operation failed.
FormData
A class to create readable "multipart/form-data" streams. It can be used to submit forms and file uploads to http server.
Interceptor
Interceptor helps to deal with RequestOptions, Response, and DioException during the lifecycle of a request before it reaches users.
MultipartFile
An upload content that is a part of MultipartRequest. This doesn't need to correspond to a physical file.
Options
The configuration for a single request. BaseOptions and Options will be merged into one RequestOptions before sending the requests. See Options.compose.
Response<T>
The Response class contains the payload (could be transformed) that respond from the request, and other information of the response.
Result<T>
A type-safe representation of an operation that either produced a value of type T (Success) or failed with a Failure (Error).
ResultCache<K, V>
An in-memory cache for Result values with optional TTL expiry.
ResultDeduplicator<K, V>
Ensures only one Future<Result<V>> is in flight per key at any time.
ResultLoggerInterceptor
A Dio Interceptor that emits structured, human-readable log output for requests, responses, and errors.
RetryHelper
Static helpers for retrying Result-returning async operations.
Success<T>
The successful variant of a Result.

Enums

CircuitBreakerState
State of a CircuitBreaker.
DioExceptionType
The exception enumeration indicates what type of exception has happened during requests.
FailureKind
Categorical tag describing what kind of thing went wrong, independent of any HTTP status code or human-readable message.
FailureType
Structural category of a Failure.

Extensions

FlattenResultX on Result<Result<T>>
Collapses a nested Result into a single layer. If the outer is an Error, it is returned unchanged; otherwise the inner Result is returned.
FutureResultX on Future<Result<T>>
Async helpers on Future<Result<T>>.
FutureToResultX on Future<T>
Bridges a regular Future<T> (which signals failure by throwing) into a Future<Result<T>> without writing Result.tryRunAsync(() => future) at every call site.
ResultAsyncX on Result<T>
Async transformations applied directly to a Result (not a future).
ResultListX on Result<List<T>>
Extensions that operate on the elements inside a successful list result.
ResultX on Result<T>
Synchronous helpers on Result.
StreamResultX on Stream<Result<T>>
Extensions for working with streams of Result values without unwrapping each event manually.

Functions

mapDioException(DioException e, [StackTrace? stackTrace]) Failure
Maps a DioException to the appropriate Failure variant.

Typedefs

DioJsonParser<T> = T Function(Object? data)
Decodes a Dio response payload (already JSON-decoded by Dio's default Transformer) into a typed model T.
LogCallback = void Function(String line)
Sink for log lines emitted by resilify interceptors and handlers.

Exceptions / Errors

DioException
DioException describes the exception info when a request failed.
ResultUnwrapException
Thrown by ResultX.getOrThrow when called on an Error.