Baseflow / Baseflow/flutter_cached_network_image

Progress returns null after 1.0

Open
#608 3 comments 7 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
2.6k
Forks
731
Avg merge
3d 9h
Merged PRs (30d)
1

Description

## 🐛 Bug Report

In `progressIndicatorBuilder` the `DownloadProgress` argument has `progress.progress == null` moments after it returns 1.0. This causes the indicator to become indeterminate as the now-downloaded image fades into view. `progress.downloaded` is also reset to 0.

### Expected behavior

Download progress, once reaching 1.0, will stay at 1.0, download total will stay > 0.

### Reproduction steps

```
// with progress value logging
return CachedNetworkImage(
imageUrl: "",
progressIndicatorBuilder: (context, url, progress) {
final t = DateTime.now(). t.toIso8601String();
print("$t Progress: ${progress.progress} Downloaded: ${progress.downloaded}");
return CircularProgressIndicator.adaptive(
value: progress.progress,
);
},
errorWidget: (context, url, error) => ...
);
```

Sample output:

```
2021-05-21T11:06:46.417502 Progress: null Downloaded: 0
2021-05-21T11:06:48.272545 Progress: 0.11589180050718512 Downloaded: 4113
2021-05-21T11:06:48.305771 Progress: 0.3090448013524937 Downloaded: 10968
2021-05-21T11:06:48.342850 Progress: 0.46356720202874047 Downloaded: 16452
2021-05-21T11:06:48.375774 Progress: 0.7339814032121724 Downloaded: 26049
2021-05-21T11:06:48.409621 Progress: 0.9271344040574809 Downloaded: 32904
2021-05-21T11:06:48.435467 Progress: 1.0 Downloaded: 35490
2021-05-21T11:06:48.532975 Progress: null Downloaded: 0
```

### Configuration

**Version:** 3.0.0

**Platform:**
- [x] :iphone: iOS
- [x] :robot: Android

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.