rest_api_client
library
Classes
AuthHandler
AuthOptions
Configuration options for authentication handling.
BackgroundTransformer
The default Transformer for Dio .
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 .
CacheHandler
A class for managing cached data to optimize API request handling.
CacheModel
A model representing cached data along with its expiration time.
CacheOptions
Configuration options for caching responses in API calls.
CacheResult <T >
Represents a result that comes from cache.
CancelToken
Controls cancellation of Dio 's requests.
Dio
Dio enables you to make HTTP requests easily.
DioMixin
ErrorInterceptorHandler
The handler for interceptors to handle error occurred during the request.
ErrorResult <T >
Represents an error result.
ExceptionHandler
Handles exceptions thrown by Dio during API calls.
Converts DioException into custom BaseException types.
ExceptionOptions
This class is part of the exception handling mechanism
implemented in the RestApiClient.
FormData
A class to create readable "multipart/form-data" streams.
It can be used to submit forms and file uploads to http server.
FusedTransformer
A Transformer that has a fast path for decoding UTF8-encoded JSON.
If the response is utf8-encoded JSON and no custom decoder is specified in the RequestOptions , this transformer
is significantly faster than the default SyncTransformer and the BackgroundTransformer .
This improvement is achieved by using a fused Utf8Decoder and JsonDecoder to decode the response,
which is faster than decoding the utf8-encoded JSON in two separate steps, since
Dart uses a special fast decoder for this case.
See https://github.com/dart-lang/sdk/blob/5b2ea0c7a227d91c691d2ff8cbbeb5f7f86afdb9/sdk/lib/_internal/vm/lib/convert_patch.dart#L40
The headers class for requests and responses.
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.
Interceptors
A Queue-Model list for Interceptor s.
InterceptorsWrapper
A helper class to create interceptors in ease.
ListParam <T >
Indicates a param being used as queries or form data,
and how does it gets formatted.
LocalErrorResult <T >
Represents a local error result (e.g., a caching error).
LocalSuccessResult <T >
Represents a successful local (cached) result.
LoggingOptions
Options to customize logging of HTTP requests and responses.
LogInterceptor
LogInterceptor is used to print logs during network requests.
It should be the last interceptor added,
otherwise modifications by following interceptors will not be logged.
This is because the execution of interceptors is in the order of addition.
MultipartFile
An upload content that is a part of MultipartRequest
.
This doesn't need to correspond to a physical file.
NetworkResult <T >
Represents a network result that includes the response.
Options
The configuration for a single request.
BaseOptions and Options will be merged into one RequestOptions before
sending the requests. See Options.compose .
QueuedInterceptor
Interceptor in queue.
QueuedInterceptorsWrapper
A helper class to create QueuedInterceptor in ease.
RedirectRecord
A record that records the redirection happens during requests,
including status code, request method, and the location.
RefreshTokenInterceptor
A Dio interceptor that handles refreshing of JWT tokens.
This interceptor can automatically refresh the token before it expires,
or handle token refresh upon receiving an unauthorized response.
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.
ResponseBody
The response wrapper class for adapters.
ResponseInterceptorHandler
The handler for interceptors to handle after respond.
RestApiClient
An abstract class representing a REST API client.
A class that contains commonly used HTTP headers for the REST API client.
RestApiClientImpl
RestApiClientKeys
A class that contains constant keys used by the RestApiClient.
RestApiClientOptions
Options to configure the RestApiClient.
RestApiClientRequestOptions
Options for configuring HTTP requests in the RestApiClient.
Result <T >
A generic Result class to hold the outcome of operations.
SuccessResult <T >
Represents a successful result.
SyncTransformer
If you want to custom the transformation of request/response data,
you can provide a Transformer by your self, and replace
the transformer by setting the Dio.transformer .
Transformer
Transformer allows changes to the request/response data before
it is sent/received to/from the server.
Enums
DioExceptionType
The exception enumeration indicates what type of exception
has happened during requests.
FileAccessMode
The file access mode when downloading a file, corresponds to a subset of
dart:io::FileMode .
ListFormat
Specifies the array format (a single parameter with multiple parameter
or multiple parameters with the same name).
and the separator for array items.
RefreshTokenStrategy
Enumeration for defining strategies for handling refresh tokens.
ResponseType
Indicates which transformation should be applied to the response data.
Mixins
OptionsMixin
The mixin class for options that provides common attributes.
Exceptions / Errors
BaseException
A base class for exceptions that may occur during HTTP requests/responses
when using the RestApiClient.
DioException
DioException describes the exception info when a request failed.
ForbiddenException
A derived exception class that represents a server error when access is forbidden,
typically indicating a 403 HTTP status code.
NetworkErrorException
A derived exception class that represents network-related errors during
HTTP requests, such as connectivity issues or timeouts.
NotNullableError <T >
A TypeError thrown by _checkNotNullable
.
ServerErrorException
A derived exception class that represents any server error encountered
during HTTP requests, typically indicating a 5xx HTTP status code.
UnauthorizedException
A derived exception class that represents unauthorized access errors
encountered during HTTP requests, typically indicating a 401 HTTP status code.
ValidationException
A derived exception class that represents any validation errors
encountered during API requests, typically related to improper data input.