Skip to content

Commit

Permalink
[image_picker] Deprecate platform interface methods (#4520)
Browse files Browse the repository at this point in the history
Deprecates all of the platform interface methods that have been replaced with newer variants.
  • Loading branch information
stuartmorgan authored Jul 19, 2023
1 parent 84b086f commit 674179f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.9.0

* Formally deprecates all methods that have been replaced with newer variants.

## 2.8.0

* Adds `getMedia` method.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ abstract class ImagePickerPlatform extends PlatformInterface {
_instance = instance;
}

// Next version of the API.

/// Returns a [PickedFile] with the image that was picked.
///
/// The `source` argument controls where the image comes from. This can
Expand Down Expand Up @@ -67,6 +65,7 @@ abstract class ImagePickerPlatform extends PlatformInterface {
/// in this call. You can then call [retrieveLostData] when your app relaunches to retrieve the lost data.
///
/// If no images were picked, the return value is null.
@Deprecated('Use getImageFromSource instead.')
Future<PickedFile?> pickImage({
required ImageSource source,
double? maxWidth,
Expand Down Expand Up @@ -95,6 +94,7 @@ abstract class ImagePickerPlatform extends PlatformInterface {
/// a warning message will be logged.
///
/// If no images were picked, the return value is null.
@Deprecated('Use getMultiImageWithOptions instead.')
Future<List<PickedFile>?> pickMultiImage({
double? maxWidth,
double? maxHeight,
Expand All @@ -119,6 +119,7 @@ abstract class ImagePickerPlatform extends PlatformInterface {
/// in this call. You can then call [retrieveLostData] when your app relaunches to retrieve the lost data.
///
/// If no images were picked, the return value is null.
@Deprecated('Use getVideo instead.')
Future<PickedFile?> pickVideo({
required ImageSource source,
CameraDevice preferredCameraDevice = CameraDevice.rear,
Expand All @@ -141,12 +142,11 @@ abstract class ImagePickerPlatform extends PlatformInterface {
/// See also:
/// * [LostData], for what's included in the response.
/// * [Android Activity Lifecycle](https://developer.android.com/reference/android/app/Activity.html), for more information on MainActivity destruction.
@Deprecated('Use getLostData instead.')
Future<LostData> retrieveLostData() {
throw UnimplementedError('retrieveLostData() has not been implemented.');
}

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

/// This method is deprecated in favor of [getMultiImageWithOptions] and will be removed in a future update.
///
/// Returns a [List<XFile>] with the images that were picked.
///
/// The images come from the [ImageSource.gallery].
Expand All @@ -205,6 +204,7 @@ abstract class ImagePickerPlatform extends PlatformInterface {
/// a warning message will be logged.
///
/// If no images were picked, the return value is null.
@Deprecated('Use getMultiImageWithOptions instead.')
Future<List<XFile>?> getMultiImage({
double? maxWidth,
double? maxHeight,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/image_picker/
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+image_picker%22
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
version: 2.8.0
version: 2.9.0

environment:
sdk: ">=2.18.0 <4.0.0"
Expand Down

0 comments on commit 674179f

Please sign in to comment.