getx icon indicating copy to clipboard operation
getx copied to clipboard

getx upload file is very slowly. like this bug #940.

Open youbudong opened this issue 3 years ago • 8 comments

ATTENTION: DO NOT USE THIS FIELD TO ASK SUPPORT QUESTIONS. USE THE PLATFORM CHANNELS FOR THIS. THIS SPACE IS DEDICATED ONLY FOR BUGS DESCRIPTION. Fill in the template. Issues that do not respect the model will be closed.

Describe the bug getx upload file is very slowly. like this bug #940.

when i use dio. it's fast.

**Reproduction code

example:

To Reproduce

Screenshots

Flutter Version:

Flutter 2.2.2 • channel stable Dart 2.13.3

Getx Version: get: ^4.1.4

Describe on which device you found the bug:

android 11

Minimal reproduce code final contentType = lookupMimeType(path); final formdata = FormData({"file":MultipartFile(path,filename: path.split('/').last,contentType: contentType!=null?contentType:"application/octet-stream"),"folder":folder} ); Result result = await cRequest('/admin/sys-file/upload/app',method: 'POST',data: formdata,uploadProgress: (val) async { if(uploadProgress == null) EasyLoading.showProgress(val/100,status: '${val.toStringAsFixed(0)}%'); else uploadProgress(val); });

youbudong avatar Jul 09 '21 09:07 youbudong

You have to use multithreading for async/await post methods that have large multipart files attached to them.

This is to isolate the UI memory from post request process.

See the official video: https://www.youtube.com/watch?v=qrFTt1NZed8

Sivar-Developer avatar Sep 18 '21 10:09 Sivar-Developer

I meet same issue, upload a image file 1.9 MB, UI freezing, and then upload failed.

weishirongzhen avatar Jun 13 '22 09:06 weishirongzhen

I meet same issue, upload a image file 1.9 MB, UI freezing, and then upload failed.

Hey there, it sounds like your UI is freezing while using the post method for uploading files. Just a moment ago, I was facing the same issue. Then I removed the "uploadProgress" parameter from the post method. And now the UI is not freezing anymore. uploadProgress param has a glitch.

dharambudh1 avatar Jun 07 '23 10:06 dharambudh1

I meet same issue, upload a image file 1.9 MB, UI freezing, and then upload failed.

Hey there, it sounds like your UI is freezing while using the post method for uploading files. Just a moment ago, I was facing the same issue. Then I removed the "uploadProgress" parameter from the post method. And now the UI is not freezing anymore. uploadProgress param has a glitch.

I appreciate your helpful answer. Is there a way to use the uploadProgress parameter without any issues?

tinhnvc-gadget avatar Sep 27 '23 03:09 tinhnvc-gadget

您必须对附加有大型多部分文件的 async/await post 方法使用多线程。

这是为了将 UI 内存与 post 请求过程隔离。

观看官方视频: https://www.youtube.com/watch?v =qrFTt1NZed8

This operation should be encapsulated inside getConnect

Oliver-WJ avatar May 21 '24 13:05 Oliver-WJ

您必须对附加有大型多部分文件的 async/await post 方法使用多线程。 这是为了将 UI 内存与 post 请求过程隔离。 观看官方视频:https://www.youtube.com/watch?v =qrFTt1NZed8

这个操作应该封装在getConnect里面

微任务队列被阻塞

Oliver-WJ avatar May 21 '24 14:05 Oliver-WJ

I meet same issue, upload a image file 1.9 MB, UI freezing, and then upload failed.

Hey there, it sounds like your UI is freezing while using the post method for uploading files. Just a moment ago, I was facing the same issue. Then I removed the "uploadProgress" parameter from the post method. And now the UI is not freezing anymore. uploadProgress param has a glitch.

use dio 😭

Oliver-WJ avatar May 21 '24 14:05 Oliver-WJ