DioUtils class

lx git:https://gitee.com/twopai dio封装,可设置header、baseUrl、拦截器

Constructors

DioUtils()
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

addInterceptor({Interceptor? interceptor}) DioUtils
downloadFile(dynamic urlPath, dynamic savePath, {dynamic onProgress(int count, int total)?, dynamic onSuccess()?, dynamic onFail(Exception e)?, Map<String, dynamic>? params}) → dynamic
initDio({String baseUrl = ''}) → dynamic
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
request<T>(String method, String url, {bool isFormData = false, dynamic params, Map<String, dynamic>? queryParameters, CancelToken? cancelToken, Options? options, Function? generateOBJ}) Future<BaseEntity<T>>
requestList<T>(String method, String url, {dynamic params, Map<String, dynamic>? queryParameters, CancelToken? cancelToken, Options? options, Function? generateOBJ}) Future<BaseEntity<List<T>>>
requestNetwork<T>(String method, String url, {bool isList = false, bool isFormData = false, dynamic params, Map<String, dynamic>? queryParameters, CancelToken? cancelToken, Options? options, Function? generateOBJ}) Future<BaseEntity>
统一处理(onSuccess返回T对象,onSuccessList返回List
setBaseUrl({String? baseUrl = ''}) DioUtils
setHeaders({List<Map<String, dynamic>>? headers}) DioUtils
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

instance DioUtils
no setter

Static Methods

uploadFile(String path, {FormData? data}) Future<Response>