-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
onSendProgress "jumps" to 99% and waits there until finished #925
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, please make sure it is up to date and if so, add a comment that this is still an issue to keep it open. Thank you for your contributions. |
Problem still exists, please don't close. |
I have this problem too. Any workaround? |
yes same here |
this is how I'm using it and the output is not accurate
|
up up |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, please make sure it is up to date and if so, add a comment that this is still an issue to keep it open. Thank you for your contributions. |
Still no fix Please keep it open |
Still no fix Please keep it open |
use MultipartFile.fromFileSync(file.path, filename: basename(file.path)) this working ! |
static Future<MultipartFile> fromFile(
String filePath, {
String filename,
MediaType contentType,
}) it's work too. |
fromFileSync isn't available in Flutter Web. onSendProgress still not working correctly (0% and then 100%) |
fromFile also isn't available in Flutter Web. onSendProgress still not working correctly (0% and then 100%) |
==========================working :======================= those percentages as well. E.g. 10%, 20%, 50%, 75% etc. ==========================now working=====================
flutter: progress: 0.000003035281907563734 (29/9554302) As you can see it jumps from 0% to 100% my code :
} |
I'm using Dio in my project but I couldn't write method that uploads file and show progress bar. I wrote code that uses "raw" Dart classes: |
I'm experiencing the same behaviour with
I upload the formData using POST as follows:
The Function As you can see, it jumps from 0% to 100%. When it hits 100% it just waits until the file uploads. After this, there is an XMLHttpRequest error thrown. Will post if I'm able to solve the problem. |
same problem here ... |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, please make sure it is up to date and if so, add a comment that this is still an issue to keep it open. Thank you for your contributions. |
problem still remains ... |
after two years still, dio have this issue |
This problem (0% to 100% imediatly) is always appears when using As I assume, this is due to the work of the algorithm, which counts the transferred bytes when reading the file from disk (by I recently ran into this problem and just started looking for a solution and this is just my guess as to why this is happening. Hopefully someone can find a way to get the value of the actually transferred bytes over the network. |
This problem still remains, please someone find any ans let us know |
I have found the resolution. Just use For var client = Dio();
await client.put(
url,
data: file.openRead(),
options: dio.Options(
headers: headers,
),
onSendProgress: (int sent, int total) {
print('progress: ${(sent / total * 100).toStringAsFixed(0)}% ($sent/$total)');
},
); The progress callback is smooth now.
|
also try this header, example: await client.put ( |
@zhpoo Thank you :)
|
this does not work on flutter-web |
Still broken - the only viable solution that I found is to resort to vanilla JS as explained in the SO answer https://stackoverflow.com/a/67513990/445090 |
this does not work on flutter-web .. plz fix it. |
I confirm that it doesn't work with flutter web : it jumps to 100% at the start of upload, event if it just started... |
this bug still exits on 4.0.6 |
Same problem.
|
bug still found in version 5.33 |
This code is working for me -> Uri uri = Uri(queryParameters: params);
String url = "${Vals.apiUrl}/upload?${uri.query}";
FormData formData = FormData.fromMap({
"file": MultipartFile.fromFileSync(filepath),
});
Response response = await Api.authDio.put(
url,
data: formData,
onSendProgress: progressCallback,
); Just a snippet from my code. Result -> |
bug still found in version 5.3.4 |
Please file new issues with a minimal reproducible example. Thanks. |
Please see this issue:
https://stackoverflow.com/questions/61635094/flutter-how-to-increase-onsendprogress-calls-for-a-fluid-progress-bar-animation
It's happening to me too and it looks like a bug in Dio.
Platform name is Flutter, Dio version is 3.0.10.
The text was updated successfully, but these errors were encountered: