Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose ImageStreamListener in CachedNetworkImage/CachedNetworkImageProvider #774

Open
2 tasks done
kaiquegazola opened this issue Sep 2, 2022 · 2 comments
Open
2 tasks done

Comments

@kaiquegazola
Copy link

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

  • 📱 iOS
  • 🤖 Android
@atrope
Copy link

atrope commented Sep 8, 2022

#777 should fix this.

@atrope
Copy link

atrope commented Sep 8, 2022

@kaiquegazola you can try using in your pubspec like this:

  cached_network_image:
    git:
      url: https://github.com/SuaMusica/flutter_cached_network_image.git
      ref: feature/errorListener
      path: cached_network_image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants