diff --git a/mobile/lib/presentation/widgets/images/image_provider.dart b/mobile/lib/presentation/widgets/images/image_provider.dart index 3c3ed460b4..c3cda46e81 100644 --- a/mobile/lib/presentation/widgets/images/image_provider.dart +++ b/mobile/lib/presentation/widgets/images/image_provider.dart @@ -48,7 +48,7 @@ mixin CancellableImageProviderMixin on CancellableImageProvide return null; } - Stream loadRequest(ImageRequest request, ImageDecoderCallback decode) async* { + Stream loadRequest(ImageRequest request, ImageDecoderCallback decode, {bool evictOnError = true}) async* { if (isCancelled) { this.request = null; PaintingBinding.instance.imageCache.evict(this); @@ -57,14 +57,19 @@ mixin CancellableImageProviderMixin on CancellableImageProvide try { final image = await request.load(decode); - if (image == null || isCancelled) { + if ((image == null && evictOnError) || isCancelled) { PaintingBinding.instance.imageCache.evict(this); return; + } else if (image == null) { + return; } yield image; - } catch (e) { - PaintingBinding.instance.imageCache.evict(this); - rethrow; + } catch (e, stack) { + if (evictOnError) { + PaintingBinding.instance.imageCache.evict(this); + rethrow; + } + _log.warning('Non-fatal image load error', e, stack); } finally { this.request = null; } diff --git a/mobile/lib/presentation/widgets/images/local_image_provider.dart b/mobile/lib/presentation/widgets/images/local_image_provider.dart index 03b9370190..1c7d102239 100644 --- a/mobile/lib/presentation/widgets/images/local_image_provider.dart +++ b/mobile/lib/presentation/widgets/images/local_image_provider.dart @@ -94,7 +94,6 @@ class LocalFullImageProvider extends CancellableImageProvider