Fixed download speed display.

This commit is contained in:
2025-02-20 13:16:09 +08:00
parent bd5d10e919
commit edc2cb066b
3 changed files with 22 additions and 8 deletions

View File

@@ -139,12 +139,10 @@ class ImageDownloader {
var buffer = <int>[];
await for (var data in stream) {
buffer.addAll(data);
if (expectedBytes != null) {
yield ImageDownloadProgress(
currentBytes: buffer.length,
totalBytes: expectedBytes,
);
}
yield ImageDownloadProgress(
currentBytes: buffer.length,
totalBytes: expectedBytes,
);
}
if (configs['onResponse'] is JSInvokable) {
@@ -194,7 +192,7 @@ class ImageDownloader {
class ImageDownloadProgress {
final int currentBytes;
final int totalBytes;
final int? totalBytes;
final Uint8List? imageBytes;