From 3e97abd42a844a555692adf6aa38ecba975643be Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Wed, 14 Feb 2024 13:03:44 -0500 Subject: [PATCH] [flutter_image] Replace deprecated APIs Now that it's available on every supported version, switch to `loadImage` instead of the deprecated `loadBuffer`. Fixes https://github.com/flutter/flutter/issues/132856 --- packages/flutter_image/CHANGELOG.md | 4 ++++ packages/flutter_image/lib/network.dart | 4 ++-- packages/flutter_image/pubspec.yaml | 2 +- packages/flutter_image/test/network_test.dart | 8 ++++---- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/packages/flutter_image/CHANGELOG.md b/packages/flutter_image/CHANGELOG.md index 987e7a5bb29f..7e83f85aa595 100644 --- a/packages/flutter_image/CHANGELOG.md +++ b/packages/flutter_image/CHANGELOG.md @@ -1,3 +1,7 @@ +## 4.1.11 + +* Replaces deprecated loadBuffer API usage. + ## 4.1.10 * Fixes image asset link to use image within package. diff --git a/packages/flutter_image/lib/network.dart b/packages/flutter_image/lib/network.dart index 620435efcdf0..8b1031cbdb71 100644 --- a/packages/flutter_image/lib/network.dart +++ b/packages/flutter_image/lib/network.dart @@ -99,9 +99,9 @@ class NetworkImageWithRetry extends ImageProvider { } @override - ImageStreamCompleter loadBuffer( + ImageStreamCompleter loadImage( NetworkImageWithRetry key, - DecoderBufferCallback decode, + ImageDecoderCallback decode, ) { return OneFrameImageStreamCompleter(_loadWithRetry(key, decode), informationCollector: () sync* { diff --git a/packages/flutter_image/pubspec.yaml b/packages/flutter_image/pubspec.yaml index 483576343d1d..99c0eb78f51a 100644 --- a/packages/flutter_image/pubspec.yaml +++ b/packages/flutter_image/pubspec.yaml @@ -3,7 +3,7 @@ description: > Image utilities for Flutter: improved network providers, effects, etc. repository: https://github.com/flutter/packages/tree/main/packages/flutter_image issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+flutter_image%22 -version: 4.1.10 +version: 4.1.11 environment: sdk: ">=3.0.0 <4.0.0" diff --git a/packages/flutter_image/test/network_test.dart b/packages/flutter_image/test/network_test.dart index 692e6f5c1e23..6d2a99b0cd1e 100644 --- a/packages/flutter_image/test/network_test.dart +++ b/packages/flutter_image/test/network_test.dart @@ -140,9 +140,9 @@ void assertThatImageLoadingFails( NetworkImageWithRetry subject, List errorLog, ) { - final ImageStreamCompleter completer = subject.loadBuffer( + final ImageStreamCompleter completer = subject.loadImage( subject, - PaintingBinding.instance.instantiateImageCodecFromBuffer, + PaintingBinding.instance.instantiateImageCodecWithSize, ); completer.addListener(ImageStreamListener( (ImageInfo image, bool synchronousCall) {}, @@ -157,9 +157,9 @@ void assertThatImageLoadingFails( void assertThatImageLoadingSucceeds( NetworkImageWithRetry subject, ) { - final ImageStreamCompleter completer = subject.loadBuffer( + final ImageStreamCompleter completer = subject.loadImage( subject, - PaintingBinding.instance.instantiateImageCodecFromBuffer, + PaintingBinding.instance.instantiateImageCodecWithSize, ); completer.addListener(ImageStreamListener( expectAsync2((ImageInfo image, bool synchronousCall) {