diff --git a/CHANGELOG.md b/CHANGELOG.md index 397b8ff..4244fff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.6.0 + +* Migrate to 3.13.0 + ## 3.5.3 * upgrade http to 1.0.0 diff --git a/analysis_options.yaml b/analysis_options.yaml index 82ddd0a..f18af29 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -19,9 +19,6 @@ # Android Studio, and the `flutter analyze` command. analyzer: - strong-mode: - implicit-casts: false - implicit-dynamic: false errors: # treat missing required parameters as a warning (not a hint) missing_required_param: warning @@ -103,12 +100,12 @@ linter: - hash_and_equals - implementation_imports # - invariant_booleans # too many false positives: https://github.com/dart-lang/linter/issues/811 - - iterable_contains_unrelated_type + # - iterable_contains_unrelated_type # - join_return_with_assignment # not yet tested - library_names - library_prefixes # - lines_longer_than_80_chars # not yet tested - - list_remove_unrelated_type + # - list_remove_unrelated_type # - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/sdk/issues/34181 # - missing_whitespace_between_adjacent_strings # not yet tested - no_adjacent_strings_in_list @@ -137,7 +134,7 @@ linter: # - prefer_constructors_over_static_methods # not yet tested - prefer_contains # - prefer_double_quotes # opposite of prefer_single_quotes - - prefer_equal_for_default_values + # - prefer_equal_for_default_values # - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods - prefer_final_fields - prefer_final_in_for_each diff --git a/lib/src/network/network_image_io.dart b/lib/src/network/network_image_io.dart index c24e42f..965fa5c 100644 --- a/lib/src/network/network_image_io.dart +++ b/lib/src/network/network_image_io.dart @@ -265,6 +265,14 @@ class ExtendedNetworkImageProvider if (printError) { print(e); } + // [ExtendedImage.clearMemoryCacheIfFailed] can clear cache + // 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(() { + // PaintingBinding.instance.imageCache.evict(key); + // }); + // rethrow; } finally { await chunkEvents?.close(); } diff --git a/lib/src/network/network_image_web.dart b/lib/src/network/network_image_web.dart index 6e5e34f..ccfed1a 100644 --- a/lib/src/network/network_image_web.dart +++ b/lib/src/network/network_image_web.dart @@ -5,7 +5,7 @@ // ignore_for_file: implementation_imports import 'dart:async'; -import 'dart:typed_data'; +import 'dart:js_interop'; import 'dart:ui' as ui; import 'package:extended_image_library/src/extended_image_provider.dart'; @@ -13,7 +13,6 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/src/services/dom.dart'; import 'package:http_client_helper/http_client_helper.dart'; -import 'package:js/js.dart'; import 'extended_network_image_provider.dart' as image_provider; @@ -22,7 +21,7 @@ typedef HttpRequestFactory = DomXMLHttpRequest Function(); /// Default HTTP client. DomXMLHttpRequest _httpClient() { - return createDomXMLHttpRequest(); + return DomXMLHttpRequest(); } /// Creates an overridable factory function. @@ -163,7 +162,7 @@ class ExtendedNetworkImageProvider }); } - request.addEventListener('load', allowInterop((DomEvent e) { + request.addEventListener('load', createDomEventListener((DomEvent e) { final int? status = request.status; final bool accepted = status! >= 200 && status < 300; final bool fileUri = status == 0; // file:// URIs have status of 0. @@ -181,13 +180,15 @@ class ExtendedNetworkImageProvider } })); - request.addEventListener('error', allowInterop(completer.completeError)); + request.addEventListener( + 'error', createDomEventListener(completer.completeError)); request.send(); await completer.future; - final Uint8List bytes = (request.response as ByteBuffer).asUint8List(); + final Uint8List bytes = + (request.response! as JSArrayBuffer).toDart.asUint8List(); if (bytes.lengthInBytes == 0) { throw NetworkImageLoadException( diff --git a/pubspec.yaml b/pubspec.yaml index d7dc31c..267ad53 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,11 +1,11 @@ name: extended_image_library description: package library for extended_image, extended_text and extended_text_field, provide common base class. -version: 3.5.3 +version: 3.6.0 homepage: https://github.com/fluttercandies/extended_image_library environment: sdk: '>=2.19.0 <4.0.0' - flutter: '>=3.7.0' + flutter: '>=3.13.0' dependencies: crypto: ^3.0.0