putUri<T> method
Future<BaseModel>
putUri<T>(
- Uri uri, {
- Object? data,
- dynamic tag,
- bool? loading,
- bool dataToJson = true,
- Options? options,
- ProgressCallback? onSendProgress,
- ProgressCallback? onReceiveProgress,
- CancelToken? cancelToken,
Implementation
Future<BaseModel> putUri<T>(
Uri uri, {
Object? data,
dynamic tag,
bool? loading,
bool dataToJson = true,
Options? options,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
CancelToken? cancelToken,
}) async {
assert(_singleton != null, '请先调用 initialize');
if (hasNetWork) return notNetWorkModel;
_addLoading(loading);
data = baseDioOptions.extraUriData?.call(uri, data) ?? data;
uri = baseDioOptions.extraUri?.call(uri) ?? uri;
final res = await dio.putUri<T>(uri,
options: _mergeOptions(options, uri.path),
onReceiveProgress: onReceiveProgress,
onSendProgress: onSendProgress,
cancelToken: cancelToken,
data: dataToJson ? jsonEncode(data) : data);
return _response(res, tag);
}