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

Bugfix: Change how errors are reported by ImageLoader. Emits as stream instead of re-throwing #937

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions cached_network_image/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [3.3.2] - 2024-04-10
* Change how errors are reported by ImageLoader. Emitting errors as streams instead of re-throwing.

## [3.3.1] - 2023-12-31
* Adding an errorListener prevents automatic reporting to global error handler.

Expand Down
2 changes: 1 addition & 1 deletion cached_network_image/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class BasicContent extends StatelessWidget {
aspectRatio: 1.6,
child: BlurHash(hash: 'LEHV6nWB2yk8pyo0adR*.7kCMdnj'),
),
imageUrl: 'https://blurha.sh/assets/images/img1.jpg',
imageUrl: 'https://blurha.sh/12c2aca29ea896a628be.jpg',
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just updated this URL since the old https://blurha.sh/assets/images/img1.jpg didn't point to a resource anymore. You just got back a 404.

fit: BoxFit.cover,
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,14 @@ class ImageLoader implements platform.ImageLoader {
yield decoded;
}
}
} on Object {
} on Object catch (error, stackTrace) {
// Depending on where the exception was thrown, the image cache may not
// have had a chance to track the key in the cache at all.
// Schedule a microtask to give the cache a chance to add the key.
scheduleMicrotask(() {
evictImage();
});
rethrow;
yield* Stream.error(error, stackTrace);
} finally {
await chunkEvents.close();
}
Expand Down
2 changes: 1 addition & 1 deletion cached_network_image/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ topics:
- cache
- image
- network-image
version: 3.3.1
version: 3.3.2
environment:
sdk: ^3.0.0
flutter: '>=3.10.0'
Expand Down