Skip to content

Add the ability to set debugLabel #973

@kardenwork

Description

@kardenwork

🏗 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)

  • 📱 iOS
  • 🤖 Android

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions