ts_api_handler library

Classes

ApiConfig
Everything ApiServices needs, in one object.
ApiLogOptions
Controls what the console logger prints for each request.
ApiObserver
A single place to watch every request the package makes — for crash reporting, analytics, or a debug overlay.
ApiServices
A typed HTTP client wrapping Dio. All methods return Either<Failure, Response> — use .fold(onLeft, onRight) to handle errors and successes without exceptions.
AuthConfig
Token-based authentication settings for ApiServices.
Base64LogTrimmer
Collapses base64 blobs out of the logger's output.
CancelToken
Controls cancellation of Dio's requests.
Either<L, R>
Represents a value of one of two possible types, Left or Right.
ErrorInterceptorHandler
The handler for interceptors to handle error occurred during the request.
FormData
A class to create readable "multipart/form-data" streams. It can be used to submit forms and file uploads to http server.
HttpClientAdapter
HttpAdapter is a bridge between Dio and HttpClient.
Interceptor
Interceptor helps to deal with RequestOptions, Response, and DioException during the lifecycle of a request before it reaches users.
InterceptorsWrapper
A helper class to create interceptors in ease.
Left<L, R>
MultipartFile
An upload content that is a part of MultipartRequest. This doesn't need to correspond to a physical file.
QueuedInterceptor
Interceptor in queue.
RequestInterceptorHandler
The handler for interceptors to handle before the request has been sent.
RequestOptions
The internal request option class that is the eventual result after BaseOptions and Options are composed.
Response<T>
The Response class contains the payload (could be transformed) that respond from the request, and other information of the response.
ResponseInterceptorHandler
The handler for interceptors to handle after respond.
RetryPolicy
Controls how transient failures are retried by NetworkRetryInterceptor.
UploadFile
One file in a multipart upload.

Enums

DioExceptionType
The exception enumeration indicates what type of exception has happened during requests.
ErrorSource
HttpMethod
RefreshOutcome
What a token refresh came to, for AuthConfig.refreshSession.
ResponseCode
ResponseType
Indicates which transformation should be applied to the response data.

Functions

listParser<T>(T fromJson(Map<String, dynamic> json), {String? key}) → List<T> Function(dynamic data)
Turns a single-object parser into one that reads a JSON array, for the common list endpoint.

Exceptions / Errors

DioException
DioException describes the exception info when a request failed.
Failure
Represents a failure from ApiServices, carrying the error type, HTTP/internal code, and a human-readable message.