DioManager class

Constructors

DioManager()
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

createErrorEntity(Exception error) ErrorEntity
download({required String url, required String savePath, bool isExternalUrl = false, required dynamic onSuccess(String), dynamic onError(ErrorEntity)?, dynamic onProgress(int)?, dynamic onStart()?, dynamic onFinish()?}) Future
下载文件 url下载地址 当isExternalUrl为true,传完整下载路径;isExternalUrl为false,传相对路径 savePath存储路径 isExternalUrl 是否为外部地址(默认false); onSuccess请求成功回调 onError请求失败回调 onProgress请求过程回调(百分比 0~100) onStart发起请求前回调 onFinish请求完成回调(不论请求失败与否)
getAuthorizationHeader(String path, Map<String, dynamic>? params, [String? auth]) Map<String, dynamic>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
request<T>(RequestType method, String path, {String? host, JJResponseType jjResponseType = JJResponseType.jsonObj, Map<String, dynamic>? params, String? auth, required dynamic onSuccess(dynamic), dynamic onError(ErrorEntity)?, dynamic onStart()?, dynamic onFinish()?, dynamic onMessage(String msg)?, Duration? timeout, bool errorToast = true, bool pathConfuseEnabled = true, bool encryptDataEnabled = true, CancelToken? cancel}) Future
请求,返回参数为 Map 或 List method请求类型 RequestType path请求地址 host请求域名(可选:如果传递则走传递的域名) jjResponseType接口返回的data类型JJResponseType(JSON对象/JSON数组) params请求参数 onSuccess请求成功回调 onError请求失败回调 onStart发起请求前回调 onFinish请求完成回调(不论请求失败与否) auth允许指定auth,主要用于在直播间时账号被挤下线的处理 errorToast是否显示Toast提示(默认显示) pathConfuseEnabled path路径混淆 (默认启用) encryptDataEnabled 是否启用加密 (默认启用) tag 用于取消接口
requestList<T>(RequestType method, String path, {String? host, Map<String, dynamic>? params, required dynamic onSuccess(dynamic), dynamic onError(ErrorEntity)?, dynamic onStart()?, dynamic onFinish()?, bool errorToast = true}) Future
showErrorToast(ErrorEntity? errorEntity, bool show) → void
toString() String
A string representation of this object.
inherited
upload(File file, {required dynamic onSuccess(String), dynamic onError(ErrorEntity)?, dynamic onProgress(int)?, dynamic onStart()?, dynamic onFinish()?, bool errorToast = true}) Future
uploadXFile(XFile xFile, {required dynamic onSuccess(String), dynamic onError(ErrorEntity)?, dynamic onProgress(int)?, dynamic onStart()?, dynamic onFinish()?, bool errorToast = true}) Future

Operators

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

Static Methods

responseInterceptor(Response options, ResponseInterceptorHandler handler) → dynamic
拦截接口返回的header信息

Constants

defDioErrorCode → const int
defHttpTimeout → const Duration
defHttpTimeoutLong → const Duration