Baseflow / Baseflow/flutter_cached_network_image
Expose ImageStreamListener in CachedNetworkImage/CachedNetworkImageProvider
- Dominant language
- Dart
- Stars
- 2.6k
- Forks
- 731
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 1
Description
## 🏗 Enhancement Proposal
Expose a `ImageStreamListener` parameter in `CachedNetworkImage` and `CachedNetworkImageProvider` and attach it in MultiImageStreamCompleter > ImageStreamCompleter listeners.
### Pitch
Currently the package has an `errorListener` that is fires when an exception occurs while loading the image, but, without any information.
However, `ImageStreamCompleter` has a listener that provides more information: `ImageStreamListener`.
Also, by attaching an `ImageStreamListener`, we can handle uncatched exceptions as described in some issues (#726, #651, Firebase Crashlytics...) as can be seen in:
https://github.com/flutter/flutter/blob/a7ba717b2fa1f2afa82131272902e60b5f3630a5/packages/flutter/lib/src/painting/image_stream.dart#L669-L672
```
/// If no error listeners (listeners with an [ImageStreamListener.onError]
/// specified) are attached, or if the handlers all rethrow the exception
/// verbatim (with `throw exception`), a [FlutterError] will be reported using
/// [FlutterError.reportError].
```
### Platforms affected (mark all that apply)
- [x] :iphone: iOS
- [x] :robot: Android
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the CachedNetworkImage and CachedNetworkImageProvider APIs, then trace how MultiImageStreamCompleter connects to ImageStreamCompleter listeners. Confirm the expected ImageStreamListener behavior, including error reporting, and consider the issue resolved when callers can provide the listener through both APIs and it is attached during image loading.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter
- Domain
- mobile
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100