upload method

Future<Response> upload(
  1. String path,
  2. String filePath, {
  3. String? filename,
  4. ProgressCallback? onSendProgress,
  5. Options? options,
  6. CancelToken? cancelToken,
})

Implementation

Future<Response> upload(
  String path,
  String filePath, {
  String? filename,
  ProgressCallback? onSendProgress,
  Options? options,
  CancelToken? cancelToken,
}) async {
  FormData formData = FormData.fromMap({
    "file": await MultipartFile.fromFile(filePath, filename: filename),
  });

  return HttpUtils().request(path,
      showLoading: false,
      method: DioMethod.post,
      data: formData,
      options: options,
      onSendProgress: onSendProgress,
      cancelToken: cancelToken);
}