Baseflow / Baseflow/flutter_cached_network_image
First Attempt On Empty String URL Shows Error Widget, But Second Attempt When URL Available, It Still Shows The Error Widget
- Dominant language
- Dart
- Stars
- 2.6k
- Forks
- 731
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 1
Description
## 🐛 Bug Report
I'm using Bloc as state management, and implement default empty string "" value to image url while the bloc fetches image from network. Here's the example:
```
CachedNetworkImage(
imageUrl: state.imageUrl, // This will default to empty string until data fetching completed
fit: BoxFit.cover,
errorWidget: (context, url, error) => Image.asset(
'assets/no_image.png',
),
);
```
This way, I expect the CachedNetworkImage to throw an error in every initial state, as the url string is always empty. And when the url is available, the CachedNetworkImage will load the image.
But apparently, the CachedNetworkImage cannot load the url, and it stays showing "no_image" asset. I've checked the url, tried to print out the url right before returning the CachedNetworkImage widget to check whether the widget got the rebuild notification. It should work, I don't know why but seemed like CachedNetworkImage act as if the url variable hasn't changed and so it keeps showing the error widget.
### Configuration
**Version:** ^2.3.3
**Platform:**
- [ ] :iphone: iOS
- [x] :robot: Android
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.