Baseflow / Baseflow/flutter_cached_network_image
Add the ability to set `debugLabel`
- Dominant language
- Dart
- Stars
- 2.6k
- Forks
- 731
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 1
Description
## 🏗 Enhancement Proposal
Add the ability to set `debugLabel` for `ImageInfo`'s produced by `MultiImageStreamCompleter`.
### Pitch
In Flutter, you can set `debugInvertOversizedImages` which, if set to `true`, triggers a throw of a `FlutterException` which has a following text:
> Image **$debugImageLabel** has a display size of $outputWidth×$outputHeight but a decode size of ${image.width}×${image.height}, which uses an additional ${overheadInKilobytes}KB (assuming a device pixel ratio of $maxDevicePixelRatio).
As you can see, it uses `debugImageLabel` as image indicator for debug. This `debugImageLabel` is a `debugLabel` from `ImageInfo` class. But when `MultiImageStreamCompleter` from this library emits new `ImageInfo` object, it completely ignores `debugLabel` argument, which always results in it being equal to `null`, which, in case of multiple simultaneously resizing images, makes it impossible to detect the problematic image.
- Q: Why would you need debug label if image is inverted by "debugInvertOversizedImages" flag?
- A: Because during the rapid resizing animations, there might be the case when exception is thrown in the middle of the animation, but at the end, everything returns to normal and image is not inverted anymore.
In order to implement this, `MultiImageStreamCompleter` must receive `debugLabel` (or `debugLabelCallback` with some info passed to it) from above (the origin being `CachedNetworkImage` and `CachedNetworkImageProvider`) and pass it to all `_emitFrame` calls inside of it.
### Platforms affected (mark all that apply)
- [ ] :iphone: iOS
- [ ] :robot: Android
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.