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

Remove duplicate error reporting #910

Merged
merged 1 commit into from
Dec 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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.1] - 2023-12-31
* Adding an errorListener prevents automatic reporting to global error handler.

## [3.3.0] - 2023-09-25
* Add error to ErrorListener
* Update to Dart 3
Expand Down
9 changes: 9 additions & 0 deletions cached_network_image/example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:io';

import 'package:baseflow_plugin_template/baseflow_plugin_template.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -106,6 +108,13 @@ class BasicContent extends StatelessWidget {
placeholder: (context, url) =>
const CircularProgressIndicator(),
errorWidget: (context, url, error) => const Icon(Icons.error),
errorListener: (e) {
if (e is SocketException) {
print('Error with ${e.address} and message ${e.message}');
} else {
print('Image Exception is: ${e.runtimeType}');
}
},
),
),
_sizedContainer(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class ImageLoader implements platform.ImageLoader {
int? maxHeight,
int? maxWidth,
Map<String, String>? headers,
VoidCallback? errorListener,
ImageRenderMethodForWeb imageRenderMethodForWeb,
VoidCallback evictImage,
) {
Expand All @@ -39,7 +38,6 @@ class ImageLoader implements platform.ImageLoader {
maxHeight,
maxWidth,
headers,
(_) => errorListener?.call(),
imageRenderMethodForWeb,
evictImage,
);
Expand All @@ -55,7 +53,6 @@ class ImageLoader implements platform.ImageLoader {
int? maxHeight,
int? maxWidth,
Map<String, String>? headers,
ErrorListener? errorListener,
ImageRenderMethodForWeb imageRenderMethodForWeb,
VoidCallback evictImage,
) {
Expand All @@ -71,7 +68,6 @@ class ImageLoader implements platform.ImageLoader {
maxHeight,
maxWidth,
headers,
errorListener,
imageRenderMethodForWeb,
evictImage,
);
Expand All @@ -86,7 +82,6 @@ class ImageLoader implements platform.ImageLoader {
int? maxHeight,
int? maxWidth,
Map<String, String>? headers,
ErrorListener? errorListener,
ImageRenderMethodForWeb imageRenderMethodForWeb,
VoidCallback evictImage,
) async* {
Expand Down Expand Up @@ -137,8 +132,6 @@ class ImageLoader implements platform.ImageLoader {
scheduleMicrotask(() {
evictImage();
});

errorListener?.call(e);
rethrow;
} finally {
await chunkEvents.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ class CachedNetworkImageProvider
maxHeight,
maxWidth,
headers,
() => errorListener,
imageRenderMethodForWeb,
() => PaintingBinding.instance.imageCache.evict(key),
);
Expand Down Expand Up @@ -171,7 +170,6 @@ class CachedNetworkImageProvider
maxHeight,
maxWidth,
headers,
errorListener,
imageRenderMethodForWeb,
() => PaintingBinding.instance.imageCache.evict(key),
);
Expand Down
6 changes: 3 additions & 3 deletions cached_network_image/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ topics:
- cache
- image
- network-image
version: 3.3.0
version: 3.3.1
environment:
sdk: ^3.0.0
flutter: '>=3.10.0'

dependencies:
cached_network_image_platform_interface: ^3.0.0
cached_network_image_web: ^1.1.0
cached_network_image_platform_interface: ^4.0.0
cached_network_image_web: ^1.1.1
flutter:
sdk: flutter
flutter_cache_manager: ^3.3.1
Expand Down
3 changes: 3 additions & 0 deletions cached_network_image_platform_interface/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [4.0.0] - 2023-12-31
* Removed errorListener from ImageLoader interface

## [3.0.0] - 2023-09-25
* Add error to ErrorListener
* Specify types
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class ImageLoader {
int? maxHeight,
int? maxWidth,
Map<String, String>? headers,
VoidCallback? errorListener,
ImageRenderMethodForWeb imageRenderMethodForWeb,
VoidCallback evictImage,
) {
Expand All @@ -53,7 +52,6 @@ class ImageLoader {
int? maxHeight,
int? maxWidth,
Map<String, String>? headers,
ErrorListener? errorListener,
ImageRenderMethodForWeb imageRenderMethodForWeb,
VoidCallback evictImage,
) {
Expand Down
2 changes: 1 addition & 1 deletion cached_network_image_platform_interface/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: cached_network_image_platform_interface
description: Platform interface for CachedNetworkImage
version: 3.0.0
version: 4.0.0
homepage: https://github.com/Baseflow/flutter_cached_network_image

environment:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ void main() {
null,
null,
null,
null,
ImageRenderMethodForWeb.HttpGet,
() => {},
),
Expand Down
3 changes: 3 additions & 0 deletions cached_network_image_web/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [1.1.1] - 2023-12-31
* Removed errorListener from ImageLoader interface

## [1.1.0] - 2023-09-25
* Add error to ErrorListener
* Specify types
Expand Down
10 changes: 1 addition & 9 deletions cached_network_image_web/lib/cached_network_image_web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'dart:ui' as ui;

import 'package:cached_network_image_platform_interface'
'/cached_network_image_platform_interface.dart' as platform
show ImageLoader, ErrorListener, ImageRenderMethodForWeb;
show ImageLoader, ImageRenderMethodForWeb;
import 'package:flutter/material.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';

Expand All @@ -24,7 +24,6 @@ class ImageLoader implements platform.ImageLoader {
int? maxHeight,
int? maxWidth,
Map<String, String>? headers,
VoidCallback? errorListener,
platform.ImageRenderMethodForWeb imageRenderMethodForWeb,
VoidCallback evictImage,
) {
Expand All @@ -40,7 +39,6 @@ class ImageLoader implements platform.ImageLoader {
maxHeight,
maxWidth,
headers,
(_) {},
imageRenderMethodForWeb,
evictImage,
);
Expand All @@ -56,7 +54,6 @@ class ImageLoader implements platform.ImageLoader {
int? maxHeight,
int? maxWidth,
Map<String, String>? headers,
ValueChanged<Object>? errorListener,
platform.ImageRenderMethodForWeb imageRenderMethodForWeb,
VoidCallback evictImage,
) {
Expand All @@ -72,7 +69,6 @@ class ImageLoader implements platform.ImageLoader {
maxHeight,
maxWidth,
headers,
errorListener,
imageRenderMethodForWeb,
evictImage,
);
Expand All @@ -87,7 +83,6 @@ class ImageLoader implements platform.ImageLoader {
int? maxHeight,
int? maxWidth,
Map<String, String>? headers,
platform.ErrorListener? errorListener,
platform.ImageRenderMethodForWeb imageRenderMethodForWeb,
VoidCallback evictImage,
) {
Expand All @@ -102,7 +97,6 @@ class ImageLoader implements platform.ImageLoader {
maxHeight,
maxWidth,
headers,
errorListener,
evictImage,
);
case platform.ImageRenderMethodForWeb.HtmlImage:
Expand All @@ -119,7 +113,6 @@ class ImageLoader implements platform.ImageLoader {
int? maxHeight,
int? maxWidth,
Map<String, String>? headers,
platform.ErrorListener? errorListener,
VoidCallback evictImage,
) async* {
try {
Expand Down Expand Up @@ -151,7 +144,6 @@ class ImageLoader implements platform.ImageLoader {
scheduleMicrotask(() {
evictImage();
});
errorListener?.call(e);
rethrow;
}
await chunkEvents.close();
Expand Down
4 changes: 2 additions & 2 deletions cached_network_image_web/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: cached_network_image_web
description: Web implementation of CachedNetworkImage
version: 1.1.0
version: 1.1.1
homepage: https://github.com/Baseflow/flutter_cached_network_image

environment:
sdk: ^3.0.0
flutter: '>=3.10.0'

dependencies:
cached_network_image_platform_interface: ^3.0.0
cached_network_image_platform_interface: ^4.0.0
flutter:
sdk: flutter
flutter_cache_manager: ^3.3.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ void main() {
null,
null,
null,
null,
ImageRenderMethodForWeb.HttpGet,
() => {},
);
Expand Down
Loading