extended_image
extended_image copied to clipboard
No way to catch error [Bug report]
Version
8.2.0
Platforms
Android, iOS
Device Model
iPhone 13 mini
flutter info
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.16.8, on macOS 13.6.4 22G513 darwin-x64, locale en-SA)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] VS Code (version 1.85.2)
[✓] Connected device (3 available)
[✓] Network resources
• No issues found!
How to reproduce?
How to handle error if one is thrown by the package? It just throws error in console.. There should be a better way to handle error than throwing it. This issue still happens even after : clearMemoryCacheIfFailed= true and defining failed widget by loadstatechanged
It still throws errors and there is no way to catch it
Exception caught by image resource service ════════════════════════════
The following StateError was thrown resolving an image codec:
Bad state: Failed to load https://tteemp.png.
Image provider: ExtendedNetworkImageProvider("https://temmp.png", scale: 1.0)
Image key: ExtendedNetworkImageProvider("https://tempp.png", scale: 1.0)
Logs
Exception caught by image resource service ════════════════════════════
The following StateError was thrown resolving an image codec:
Bad state: Failed to load https://tteemp.png.
Image provider: ExtendedNetworkImageProvider("https://temmp.png", scale: 1.0)
Image key: ExtendedNetworkImageProvider("https://tempp.png", scale: 1.0)
Example code (optional)
SizedBox(
width: width,
height: height,
child: ClipRRect(
borderRadius: decoration?.borderRadius ?? BorderRadius.zero,
child: ExtendedImage.network(
imageUrl!,
fit: BoxFit.cover,
cache: true,
cacheMaxAge: const Duration(days: 15),
clearMemoryCacheIfFailed: false,
printError: false,
loadStateChanged: (state) {
return switch (state.extendedImageLoadState) {
LoadState.loading => const AnimatedLoadingBubbles(
color: ColorManager.primaryIu,
),
LoadState.failed => UIImagePlaceholder(
width: width,
height: height,
decoration: decoration,
),
(_) => null,
};
},
),
),
);
Contact
reply to this issue
https://github.com/fluttercandies/extended_image_library/blob/d2e0a2299601248c55f58486dd90b4384f35f671/lib/src/network/network_image_io.dart#L265
you can set printError = false to ignore the error info to be print
and for more , if the error is throw by http, then we can't do any thing for it
https://github.com/fluttercandies/extended_image_library/blob/d2e0a2299601248c55f58486dd90b4384f35f671/lib/src/network/network_image_io.dart#L265
you can set printError = false to ignore the error info to be print
I already set to false but it is still printing the error
https://github.com/fluttercandies/extended_image_library/blob/d2e0a2299601248c55f58486dd90b4384f35f671/lib/src/network/network_image_io.dart#L265 you can set printError = false to ignore the error info to be print
I already set to false but it is still printing the error
and for more , if the error is throw by http, then we can't do any thing for it
https://github.com/fluttercandies/extended_image_library/blob/d2e0a2299601248c55f58486dd90b4384f35f671/lib/src/network/network_image_io.dart#L265 you can set printError = false to ignore the error info to be print
I already set to false but it is still printing the error
and for more , if the error is throw by http, then we can't do any thing for it
Please check this to fix your ImageProvider
in order to catch errors
https://stackoverflow.com/questions/77165237/flutter-prevent-cachednetworkimageprovider-throwing-when-it-cannot-fetch-the-u