Skip to content

Commit 674179f

Browse files
[image_picker] Deprecate platform interface methods (flutter#4520)
Deprecates all of the platform interface methods that have been replaced with newer variants.
1 parent 84b086f commit 674179f

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

packages/image_picker/image_picker_platform_interface/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.9.0
2+
3+
* Formally deprecates all methods that have been replaced with newer variants.
4+
15
## 2.8.0
26

37
* Adds `getMedia` method.

packages/image_picker/image_picker_platform_interface/lib/src/platform_interface/image_picker_platform.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ abstract class ImagePickerPlatform extends PlatformInterface {
3737
_instance = instance;
3838
}
3939

40-
// Next version of the API.
41-
4240
/// Returns a [PickedFile] with the image that was picked.
4341
///
4442
/// The `source` argument controls where the image comes from. This can
@@ -67,6 +65,7 @@ abstract class ImagePickerPlatform extends PlatformInterface {
6765
/// in this call. You can then call [retrieveLostData] when your app relaunches to retrieve the lost data.
6866
///
6967
/// If no images were picked, the return value is null.
68+
@Deprecated('Use getImageFromSource instead.')
7069
Future<PickedFile?> pickImage({
7170
required ImageSource source,
7271
double? maxWidth,
@@ -95,6 +94,7 @@ abstract class ImagePickerPlatform extends PlatformInterface {
9594
/// a warning message will be logged.
9695
///
9796
/// If no images were picked, the return value is null.
97+
@Deprecated('Use getMultiImageWithOptions instead.')
9898
Future<List<PickedFile>?> pickMultiImage({
9999
double? maxWidth,
100100
double? maxHeight,
@@ -119,6 +119,7 @@ abstract class ImagePickerPlatform extends PlatformInterface {
119119
/// in this call. You can then call [retrieveLostData] when your app relaunches to retrieve the lost data.
120120
///
121121
/// If no images were picked, the return value is null.
122+
@Deprecated('Use getVideo instead.')
122123
Future<PickedFile?> pickVideo({
123124
required ImageSource source,
124125
CameraDevice preferredCameraDevice = CameraDevice.rear,
@@ -141,12 +142,11 @@ abstract class ImagePickerPlatform extends PlatformInterface {
141142
/// See also:
142143
/// * [LostData], for what's included in the response.
143144
/// * [Android Activity Lifecycle](https://developer.android.com/reference/android/app/Activity.html), for more information on MainActivity destruction.
145+
@Deprecated('Use getLostData instead.')
144146
Future<LostData> retrieveLostData() {
145147
throw UnimplementedError('retrieveLostData() has not been implemented.');
146148
}
147149

148-
/// This method is deprecated in favor of [getImageFromSource] and will be removed in a future update.
149-
///
150150
/// Returns an [XFile] with the image that was picked.
151151
///
152152
/// The `source` argument controls where the image comes from. This can
@@ -175,6 +175,7 @@ abstract class ImagePickerPlatform extends PlatformInterface {
175175
/// in this call. You can then call [getLostData] when your app relaunches to retrieve the lost data.
176176
///
177177
/// If no images were picked, the return value is null.
178+
@Deprecated('Use getImageFromSource instead.')
178179
Future<XFile?> getImage({
179180
required ImageSource source,
180181
double? maxWidth,
@@ -185,8 +186,6 @@ abstract class ImagePickerPlatform extends PlatformInterface {
185186
throw UnimplementedError('getImage() has not been implemented.');
186187
}
187188

188-
/// This method is deprecated in favor of [getMultiImageWithOptions] and will be removed in a future update.
189-
///
190189
/// Returns a [List<XFile>] with the images that were picked.
191190
///
192191
/// The images come from the [ImageSource.gallery].
@@ -205,6 +204,7 @@ abstract class ImagePickerPlatform extends PlatformInterface {
205204
/// a warning message will be logged.
206205
///
207206
/// If no images were picked, the return value is null.
207+
@Deprecated('Use getMultiImageWithOptions instead.')
208208
Future<List<XFile>?> getMultiImage({
209209
double? maxWidth,
210210
double? maxHeight,

packages/image_picker/image_picker_platform_interface/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/image_picker/
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+image_picker%22
55
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
66
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
7-
version: 2.8.0
7+
version: 2.9.0
88

99
environment:
1010
sdk: ">=2.18.0 <4.0.0"

0 commit comments

Comments
 (0)