From 568e7c55e1e6218ac0a8286f8b24289404ab45a2 Mon Sep 17 00:00:00 2001 From: Roman Laptev Date: Fri, 12 Apr 2024 13:20:06 +0300 Subject: [PATCH] Replace deprecated `webOnlyInstantiateImageCodecFromUrl` --- cached_network_image_web/CHANGELOG.md | 3 +++ .../lib/cached_network_image_web.dart | 9 ++++----- cached_network_image_web/pubspec.yaml | 6 +++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/cached_network_image_web/CHANGELOG.md b/cached_network_image_web/CHANGELOG.md index c1a24303..7c7d18d3 100644 --- a/cached_network_image_web/CHANGELOG.md +++ b/cached_network_image_web/CHANGELOG.md @@ -1,3 +1,6 @@ +## [1.2.0] - +* Replace deprecated `webOnlyInstantiateImageCodecFromUrl` to `createImageCodecFromUrl` from `dart:ui_web` + ## [1.1.1] - 2023-12-31 * Removed errorListener from ImageLoader interface diff --git a/cached_network_image_web/lib/cached_network_image_web.dart b/cached_network_image_web/lib/cached_network_image_web.dart index 418845c0..3cc212ca 100644 --- a/cached_network_image_web/lib/cached_network_image_web.dart +++ b/cached_network_image_web/lib/cached_network_image_web.dart @@ -4,10 +4,10 @@ library cached_network_image_web; import 'dart:async'; import 'dart:typed_data'; import 'dart:ui' as ui; +import 'dart:ui_web' as ui_web; import 'package:cached_network_image_platform_interface' - '/cached_network_image_platform_interface.dart' as platform - show ImageLoader, ImageRenderMethodForWeb; + '/cached_network_image_platform_interface.dart' as platform show ImageLoader, ImageRenderMethodForWeb; import 'package:flutter/material.dart'; import 'package:flutter_cache_manager/flutter_cache_manager.dart'; @@ -154,8 +154,7 @@ class ImageLoader implements platform.ImageLoader { StreamController chunkEvents, ) { final resolved = Uri.base.resolve(url); - // ignore: undefined_function - return ui.webOnlyInstantiateImageCodecFromUrl( + return ui_web.createImageCodecFromUrl( resolved, chunkCallback: (int bytes, int total) { chunkEvents.add( @@ -165,7 +164,7 @@ class ImageLoader implements platform.ImageLoader { ), ); }, - ) as Future; + ); } } diff --git a/cached_network_image_web/pubspec.yaml b/cached_network_image_web/pubspec.yaml index 23a2969f..755843c5 100644 --- a/cached_network_image_web/pubspec.yaml +++ b/cached_network_image_web/pubspec.yaml @@ -1,10 +1,10 @@ name: cached_network_image_web description: Web implementation of CachedNetworkImage -version: 1.1.1 +version: 1.2.0 homepage: https://github.com/Baseflow/flutter_cached_network_image environment: - sdk: ^3.0.0 + sdk: '>=3.0.0 <4.0.0' flutter: '>=3.10.0' dependencies: @@ -15,6 +15,6 @@ dependencies: dev_dependencies: file: '>=6.1.4 <8.0.0' - flutter_lints: ^2.0.3 + flutter_lints: '>=2.0.3 <4.0.0' flutter_test: sdk: flutter