patch<T> method
Future<BaseModel>
patch<T>(
- String path, {
- Map<
String, dynamic> ? params, - Object? data,
- dynamic tag,
- bool? loading,
- bool dataToJson = true,
- Options? options,
- ProgressCallback? onSendProgress,
- ProgressCallback? onReceiveProgress,
- CancelToken? cancelToken,
Implementation
Future<BaseModel> patch<T>(
String path, {
Map<String, dynamic>? params,
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.extraData?.call(path, data) ?? data;
final res = await dio.patch<T>(path,
options: _mergeOptions(options, path),
params: baseDioOptions.extraParams?.call(path, params) ?? params,
onReceiveProgress: onReceiveProgress,
onSendProgress: onSendProgress,
cancelToken: cancelToken,
data: dataToJson ? jsonEncode(data) : data);
return _response(res, tag);
}