uploadUri<T> method
文件上传 File upload
Implementation
Future<BasicModel> uploadUri<T>(Uri uri, Object? data,
{ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
bool? loading,
Options? options,
dynamic tag,
CancelToken? cancelToken,
Duration receiveTimeout = const Duration(seconds: 40),
Duration sendTimeout = const Duration(seconds: 40)}) async {
assert(_singleton != null, '请先调用 initialize');
if (hasNetWork) return notNetWorkModel;
_addLoading(loading);
uri = basicDioOptions.extraUri?.call(uri) ?? uri;
final res = await dio.postUri<T>(uri,
data: basicDioOptions.extraUriData?.call(uri, data) ?? data,
options: _initBasicOptions(options, uri.path)
.copyWith(receiveTimeout: receiveTimeout, sendTimeout: sendTimeout),
onReceiveProgress: onReceiveProgress,
cancelToken: cancelToken,
onSendProgress: onSendProgress);
return _response(res, tag);
}