Skip to content

Commit

Permalink
[ios_platform_images] remove deprecated APIs (flutter#6693)
Browse files Browse the repository at this point in the history
* [ios_platform_images] remove deprecated APIs

* ++

* ++

* ++

* Update pubspec.yaml

* Update CHANGELOG.md
  • Loading branch information
jonahwilliams authored Nov 23, 2022
1 parent b2d4ee5 commit be85501
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 18 deletions.
5 changes: 3 additions & 2 deletions packages/ios_platform_images/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## NEXT
## 0.2.1

* Updates minimum Flutter version to 2.10.
* Updates minimum Flutter version to 3.3.0.
* Removes usage of deprecated [ImageProvider.load].
* Ignores unnecessary import warnings in preparation for [upcoming Flutter changes](https://github.com/flutter/flutter/pull/106316).

## 0.2.0+9
Expand Down
19 changes: 5 additions & 14 deletions packages/ios_platform_images/lib/ios_platform_images.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
// found in the LICENSE file.

import 'dart:async';
// TODO(a14n): remove this import once Flutter 3.1 or later reaches stable (including flutter/flutter#106316)
// ignore: unnecessary_import
import 'dart:typed_data';
import 'dart:ui' as ui;

import 'package:flutter/foundation.dart'
Expand Down Expand Up @@ -64,12 +61,9 @@ class _FutureMemoryImage extends ImageProvider<_FutureMemoryImage> {
return SynchronousFuture<_FutureMemoryImage>(this);
}

// ignore:deprecated_member_use
/// See [ImageProvider.load].
// TODO(jmagman): Implement the new API once it lands, https://github.com/flutter/flutter/issues/103556
@override
// ignore: deprecated_member_use
ImageStreamCompleter load(_FutureMemoryImage key, DecoderCallback decode) {
ImageStreamCompleter loadBuffer(
_FutureMemoryImage key, DecoderBufferCallback decode) {
return _FutureImageStreamCompleter(
codec: _loadAsync(key, decode),
futureScale: _futureScale,
Expand All @@ -78,13 +72,10 @@ class _FutureMemoryImage extends ImageProvider<_FutureMemoryImage> {

Future<ui.Codec> _loadAsync(
_FutureMemoryImage key,
// ignore: deprecated_member_use
DecoderCallback decode,
) async {
DecoderBufferCallback decode,
) {
assert(key == this);
return _futureBytes.then((Uint8List bytes) {
return decode(bytes);
});
return _futureBytes.then(ui.ImmutableBuffer.fromUint8List).then(decode);
}

/// See [ImageProvider.operator==].
Expand Down
4 changes: 2 additions & 2 deletions packages/ios_platform_images/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: ios_platform_images
description: A plugin to share images between Flutter and iOS in add-to-app setups.
repository: https://github.com/flutter/plugins/tree/main/packages/ios_platform_images
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+ios_platform_images%22
version: 0.2.0+9
version: 0.2.1

environment:
sdk: ">=2.14.0 <3.0.0"
flutter: ">=2.10.0"
flutter: ">=3.3.0"

flutter:
plugin:
Expand Down

0 comments on commit be85501

Please sign in to comment.