Baseflow / Baseflow/flutter_cached_network_image
Feature: Avoid Retrying Removed Image After Repeated 404 Errors
- Dominant language
- Dart
- Stars
- 2.6k
- Forks
- 731
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 1
Description
## π Feature Requests
The `cached_network_image` package is widely used to improve image loading performance in Flutter apps by caching network images. However, there are cases where the image URLs become invalid or the image content is removed from the server (e.g., deleted user-generated content).
Currently, the library continues to re-fetch these removed images even though they're no longer needed, causing repeated `HttpException: 404` errors. This behavior leads to unnecessary network requests, exception logs, and wasted resources.
```
ββββββββ Exception caught by image resource service ββββββββββββββββββββββββββββ
HttpException: Invalid statusCode: 404, uri = {{image_url}}
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
This feature would add more robust cache control and allow developers to prevent repeated failed image fetches by either setting an expiry on cached images or removing them programmatically.
### Describe the feature
To add support for one or more of the following capabilities:
* **Cache Expiry Duration**: Allow developers to set a `cacheDuration` . Once expired, the image would be re-fetched only if itβs still in use.
* **Manual Cache Invalidation**: Provide a public API such as `CachedNetworkImage.evictFromCache(String url)` to allow developers to explicitly remove unused or obsolete images from disk and memory cache.
* **Automatic Removal After Repeated Failure**: Automatically remove images from cache that continuously fail to load (e.g., after 3 consecutive 404s), assuming the resource is permanently gone.
These additions would give developers more control over image caching behavior, reduce unnecessary network traffic, and improve app stability when working with dynamic or short-lived content.
### Platforms affected
* [x] iOS
* [x] Android
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.