put<T> method

Future<void> put<T>(
  1. String url, {
  2. String? baseUrl,
  3. Map<String, dynamic>? params,
  4. Map<String, dynamic>? header,
  5. required dynamic data,
  6. Success? success,
  7. SuccessList? successList,
  8. Empty? empty,
  9. Error? error,
  10. CancelToken? cancelToken,
  11. OnValueCallBack<CancelToken>? cancelTokenCallBack,
  12. bool isList = false,
})

put请求 baseUrl 切换baseUrl params 参数 data 上传表单数据 formData success 请求对象成功回调 successList 请求列表成功回调 error 错误回调 isList 请求的数据是否为List列表 默认对象 isList=true 请求data数据为[]list列表

Implementation

Future<void> put<T>(String url,
    {String? baseUrl,
    Map<String, dynamic>? params,
    Map<String, dynamic>? header,
    required data,
    Success? success,
    SuccessList? successList,
    Empty? empty,
    Error? error,
    CancelToken? cancelToken, //可自定义一个取消令牌,也可从回调中获取系统默认取消令牌
    OnValueCallBack<CancelToken>? cancelTokenCallBack, //回调,返回一个取消令牌
    bool isList = false}) async {
  if (isList) {
    return await _requestList<T>(Method.put, url,
        data: data,
        baseUrl: baseUrl,
        params: params,
        header: header,
        empty: empty,
        cancelToken: cancelToken,
        cancelTokenCallBack: cancelTokenCallBack,
        success: successList,
        error: error);
  } else {
    return await _request(Method.put, url,
        data: data,
        baseUrl: baseUrl,
        params: params,
        header: header,
        cancelToken: cancelToken,
        cancelTokenCallBack: cancelTokenCallBack,
        success: success,
        empty: empty,
        error: error);
  }
}