Skip to content

Commit a05e39d

Browse files
authored
Merge pull request #937 from robert-northmind/bugfix/emit_error_via_stream_in_ImageLoader
Bugfix: Change how errors are reported by ImageLoader. Emits as stream instead of re-throwing
2 parents 536da01 + d4b4acb commit a05e39d

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

cached_network_image/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## [3.3.2] - 2024-04-10
2+
* Change how errors are reported by ImageLoader. Emitting errors as streams instead of re-throwing.
3+
14
## [3.3.1] - 2023-12-31
25
* Adding an errorListener prevents automatic reporting to global error handler.
36

cached_network_image/example/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ class BasicContent extends StatelessWidget {
142142
aspectRatio: 1.6,
143143
child: BlurHash(hash: 'LEHV6nWB2yk8pyo0adR*.7kCMdnj'),
144144
),
145-
imageUrl: 'https://blurha.sh/assets/images/img1.jpg',
145+
imageUrl: 'https://blurha.sh/12c2aca29ea896a628be.jpg',
146146
fit: BoxFit.cover,
147147
),
148148
);

cached_network_image/lib/src/image_provider/_image_loader.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,14 @@ class ImageLoader implements platform.ImageLoader {
125125
yield decoded;
126126
}
127127
}
128-
} on Object {
128+
} on Object catch (error, stackTrace) {
129129
// Depending on where the exception was thrown, the image cache may not
130130
// have had a chance to track the key in the cache at all.
131131
// Schedule a microtask to give the cache a chance to add the key.
132132
scheduleMicrotask(() {
133133
evictImage();
134134
});
135-
rethrow;
135+
yield* Stream.error(error, stackTrace);
136136
} finally {
137137
await chunkEvents.close();
138138
}

cached_network_image/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ topics:
66
- cache
77
- image
88
- network-image
9-
version: 3.3.1
9+
version: 3.3.2
1010
environment:
1111
sdk: ^3.0.0
1212
flutter: '>=3.10.0'

0 commit comments

Comments
 (0)