uploadFile<T> method

Future<void> uploadFile<T>(
  1. String url, {
  2. String? baseUrl,
  3. required FormData data,
  4. Success? success,
  5. Empty? empty,
  6. Error? error,
  7. CancelToken? cancelToken,
  8. OnValueCallBack<CancelToken>? cancelTokenCallBack,
  9. ProgressCallback? onSendProgress,
})

上传文件

Implementation

Future<void> uploadFile<T>(
  String url, {
  String? baseUrl,
  required FormData data,
  Success? success,
  Empty? empty,
  Error? error,
  CancelToken? cancelToken, //可自定义一个取消令牌,也可从回调中获取系统默认取消令牌
  OnValueCallBack<CancelToken>? cancelTokenCallBack, //回调,返回一个取消令牌
  ProgressCallback? onSendProgress, // 上传数据进度
}) async {
  // MultipartFile.fromFile("filePath",filename: "");
  return await _request(Method.post, url,
      data: data,
      baseUrl: baseUrl,
      cancelToken: cancelToken,
      cancelTokenCallBack: cancelTokenCallBack,
      onSendProgress: onSendProgress,
      success: success,
      empty: empty,
      error: error);
}