AnHttp class

封装 Dio 用于http网络请求

Properties

hashCode int
The hash code for this object.
no setterinherited
responseConvert ResponseConvert?
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

dio() → Dio
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
request<T>(Param param, {HttpMethodType method = HttpMethodType.post, HttpRequestToken? cancelToken, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress}) Future<Response<T>>
网络请求 method请求方法类型,默认为post, 当发起请求后要中断本次请求可使用cancelToken来终止。 onSendProgress 请求进度 onReceiveProgress 响应进度
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

instance AnHttp
no setter

Static Methods

addInterceptor(Interceptor interceptor) → void
anHttp<T>(Param param, {HttpMethodType method = HttpMethodType.post, HttpRequestToken? cancelToken, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress}) Future<Response<T>>
dio 原始返回类型 请求
anHttpArray<T>(Param param, {required JsonArrayConvertor<T> convertor, HttpMethodType method = HttpMethodType.post, HttpRequestToken? cancelToken, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress}) Future<List<T>>
http请求, 用于返回值是数组的请求。 convert 数据类型转换器。
anHttpJson<T>(Param param, {required JsonObjectConvertor<T> convertor, HttpMethodType method = HttpMethodType.post, HttpRequestToken? cancelToken, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress}) Future<T>
http请求, 用于返回值是Object的请求。 convert 数据类型转换器。
checkOptions(String method, Options? options) → Options
forbiddenLogInterceptor() → void
禁用日志拦截器
interceptors() → Interceptors