rxnet_lib library

Classes

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.
BuildRequest<T>
create_user: zhengzaihong email:1096877329@qq.com create_date: 2025-08-12 create_time: 17:22 describe: 优化 RxNet职责,将BuildRequest从RxNet中分离出来,
CancelToken
Controls cancellation of Dio's requests.
ContentTypes
create_user: zhengzaihong email:1096877329@qq.com create_date: 2025/8/24 create_time: 18:29 describe: Content-Type 类型
Dio
Dio enables you to make HTTP requests easily.
DioForNative
Implements features for Dio on native platforms.
DioMixin
Downloader
create_user: zhengzaihong email:1096877329@qq.com create_date: 2023/9/26 create_time: 12:17 describe: 只提供给 web端
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.
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
Headers
The headers class for requests and responses.
HttpClientAdapter
HttpAdapter is a bridge between Dio and HttpClient.
HttpError
create_user: zhengzaihong email:1096877329@qq.com create_date: 2021/6/9 create_time: 15:17 describe: HTTP 状态码
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 Interceptors.
InterceptorsWrapper
A helper class to create interceptors in ease.
IOHttpClientAdapter
The default HttpClientAdapter for native platforms.
ListParam<T>
Indicates a param being used as queries or form data, and how does it gets formatted.
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.
LogUtil
create_user: zhengzaihong email:1096877329@qq.com create_date: 2021/6/9 create_time: 15:48 describe: 日志输出
MD5Util
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.
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.
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.
RxNet
create_user: zhengzaihong email:1096877329@qq.com create_date: 2025-08-12 create_time: 16:48 describe: 此此变更较大,0.4版本之前为单例: 0.4.0版本开始支持多实例 RxNet 对象,用于多场景(如:一个请求业务API,一个请求日志API) RxNet 整体进行了优化:1.async/await 方式支持缓存策略请求,2.回调方式保持不变,内部实现方式已优化
RxNetLogInterceptor
RxNetPlatform
create_user: zhengzaihong email:1096877329@qq.com create_date: 2025-08-12 create_time: 16:02 describe: 平台判断
RxResult<T>
create_user: zhengzaihong email:1096877329@qq.com create_date: 2023/9/14 create_time: 16:21 describe: 响应结果包装类
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.
TextUtil
create_user: zhengzaihong email:1096877329@qq.com create_date: 2025-08-12 create_time: 16:02 describe: 字符串工具
Transformer
Transformer allows changes to the request/response data before it is sent/received to/from the server.

Enums

CacheMode
create_user: zhengzaihong email:1096877329@qq.com create_date: 2022/8/11 create_time: 9:08 describe: RxNet 请求缓存策略 RxNet request caching strategy
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.
HttpType
create_user: zhengzaihong email:1096877329@qq.com create_date: 2022/8/9 create_time: 10:55 describe: 请求类型
ListFormat
Specifies the array format (a single parameter with multiple parameter or multiple parameters with the same name). and the separator for array items.
ResponseType
Indicates which transformation should be applied to the response data.
SourcesType
create_user: zhengzaihong email:1096877329@qq.com create_date: 2022/8/9 create_time: 10:56 describe: 数据来源

Mixins

OptionsMixin
The mixin class for options that provides common attributes.

Functions

defaultDioExceptionReadableStringBuilder(DioException e) String
The default implementation of building a readable string of DioException.
log2Console(Object object) → void
create_user: zhengzaihong email:1096877329@qq.com create_date: 2021/6/9 create_time: 16:16 describe: 自定义日志拦截器 适配dio 4.0 提供一个更加清晰的日志输出

Typedefs

CacheInvalidationCallback<T> = void Function()
缓存失效超时回调
CheckNetWork = Future<bool> Function()
检查网络的方法 是否有网络
Completed<T> = void Function()
成功或失败都会执行的方法
CreateHttpClient = HttpClient Function()
The signature of IOHttpClientAdapter.createHttpClient. Can be used to provide a custom HttpClient for Dio.
DefaultHttpClientAdapter = IOHttpClientAdapter
DefaultTransformer = SyncTransformer
DioError = DioException
DioError describes the exception info when a request failed.
DioErrorType = DioExceptionType
Deprecated in favor of DioExceptionType and will be removed in future major versions.
DioExceptionReadableStringBuilder = String Function(DioException e)
The readable string builder's signature of DioException.readableStringBuilder.
DioMediaType = MediaType
The type (alias) for specifying the content-type of the MultipartFile.
Failure<T> = void Function(dynamic data)
失败回调
HandlerError = void Function(Exception err, ErrorInterceptorHandler handler)
HandlerRequest = void Function(RequestOptions options, RequestInterceptorHandler handler)
HandlerResponse = void Function(Response response, ResponseInterceptorHandler handler)
HeaderForEachCallback = void Function(String name, List<String> values)
The signature that iterates header fields.
InterceptorErrorCallback = void Function(DioException error, ErrorInterceptorHandler handler)
The signature of Interceptor.onError.
InterceptorSendCallback = void Function(RequestOptions options, RequestInterceptorHandler handler)
The signature of Interceptor.onRequest.
InterceptorSuccessCallback = void Function(Response response, ResponseInterceptorHandler handler)
The signature of Interceptor.onResponse.
JsonDecodeCallback = FutureOr Function(String)
The callback definition for decoding a JSON string.
JsonEncodeCallback = FutureOr<String> Function(Object)
The callback definition for encoding a JSON object.
JsonTransformation<E> = E Function(Map<String, dynamic> data)
OnHttpClientCreate = HttpClient? Function(HttpClient client)
The signature of IOHttpClientAdapter.onHttpClientCreate.
OptionConfig = void Function(Options options)
ParamCallBack = void Function(Map<String, dynamic> params)
ProgressCallback = void Function(int count, int total)
The type of a progress listening callback when sending or receiving data.
RequestEncoder = FutureOr<List<int>> Function(String request, RequestOptions options)
The type of a request encoding callback.
ResponseDecoder = FutureOr<String?> Function(List<int> responseBytes, RequestOptions options, ResponseBody responseBody)
The type of a response decoding callback.
Success<T> = void Function(T data, SourcesType model)
http请求成功回调
ValidateCertificate = bool Function(X509Certificate? certificate, String host, int port)
The signature of IOHttpClientAdapter.validateCertificate.
ValidateStatus = bool Function(int? status)
The type of a response status code validate callback.

Exceptions / Errors

CacheException
获取缓存出错时的异常 Thrown when a cache-related error occurs.
CancellationException
请求被取消时的异常 Thrown when a request is cancelled.
DioException
DioException describes the exception info when a request failed.
NetworkException
网络异常 Thrown when a network-related error occurs.
NotNullableError<T>
A TypeError thrown by _checkNotNullable.
ParsingException
数据解析出错时的异常 Thrown when an error occurs during data parsing or transformation.
RxError
create_user: zhengzaihong email:1096877329@qq.com create_date: 2025-08-12 create_time: 16:17 describe: 定义已知异常的基类 The base class for all RxNet exceptions.
WebException
当在web端使用了移动端api时的异常 Throw when the mobile api is used on the web.