delete<T> method

Future<BaseModel> delete<T>(
  1. String path, {
  2. Map<String, dynamic>? params,
  3. Object? data,
  4. dynamic tag,
  5. bool? loading,
  6. bool dataToJson = true,
  7. Options? options,
  8. CancelToken? cancelToken,
})

Implementation

Future<BaseModel> delete<T>(
  String path, {
  Map<String, dynamic>? params,
  Object? data,
  dynamic tag,
  bool? loading,
  bool dataToJson = true,
  Options? options,
  CancelToken? cancelToken,
}) async {
  assert(_singleton != null, '请先调用 initialize');
  if (hasNetWork) return notNetWorkModel;
  _addLoading(loading);
  data = baseDioOptions.extraData?.call(path, data) ?? data;
  final res = await dio.delete<T>(path,
      options: _mergeOptions(options, path),
      params: baseDioOptions.extraParams?.call(path, params) ?? params,
      cancelToken: cancelToken,
      data: dataToJson ? jsonEncode(data) : data);
  return _response(res, tag);
}