Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 3a38cd0

Browse files
authored
Revert "[image_picker] add forceFullMetadata to interface" (#4314)
Reverts #4288 which published a breaking change as if it were a non-breaking change. The discussion in that PR prior to it landing was incorrect, because adding a new parameter with a default value is non-breaking *only for clients*. It is breaking for subclasses that override it, and the purpose of the platform interface is for implementations to subclass it and override everything.
1 parent 998f51f commit 3a38cd0

File tree

6 files changed

+24
-61
lines changed

6 files changed

+24
-61
lines changed

packages/image_picker/image_picker_for_web/lib/image_picker_for_web.dart

-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ class ImagePickerPlugin extends ImagePickerPlatform {
5353
double? maxWidth,
5454
double? maxHeight,
5555
int? imageQuality,
56-
bool forceFullMetadata = true,
5756
CameraDevice preferredCameraDevice = CameraDevice.rear,
5857
}) {
5958
String? capture = computeCaptureAttribute(source, preferredCameraDevice);
@@ -116,7 +115,6 @@ class ImagePickerPlugin extends ImagePickerPlatform {
116115
double? maxWidth,
117116
double? maxHeight,
118117
int? imageQuality,
119-
bool forceFullMetadata = true,
120118
CameraDevice preferredCameraDevice = CameraDevice.rear,
121119
}) async {
122120
String? capture = computeCaptureAttribute(source, preferredCameraDevice);

packages/image_picker/image_picker_platform_interface/CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 2.4.1
2+
3+
* Reverts the changes from 2.4.0, which was a breaking change that
4+
was incorrectly marked as a non-breaking change.
5+
16
## 2.4.0
27

38
* Add `forceFullMetadata` option to `pickImage`.

packages/image_picker/image_picker_platform_interface/lib/src/method_channel/method_channel_image_picker.dart

-6
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,13 @@ class MethodChannelImagePicker extends ImagePickerPlatform {
2424
double? maxWidth,
2525
double? maxHeight,
2626
int? imageQuality,
27-
bool forceFullMetadata = true,
2827
CameraDevice preferredCameraDevice = CameraDevice.rear,
2928
}) async {
3029
String? path = await _getImagePath(
3130
source: source,
3231
maxWidth: maxWidth,
3332
maxHeight: maxHeight,
3433
imageQuality: imageQuality,
35-
forceFullMetadata: forceFullMetadata,
3634
preferredCameraDevice: preferredCameraDevice,
3735
);
3836
return path != null ? PickedFile(path) : null;
@@ -87,7 +85,6 @@ class MethodChannelImagePicker extends ImagePickerPlatform {
8785
double? maxWidth,
8886
double? maxHeight,
8987
int? imageQuality,
90-
bool forceFullMetadata = true,
9188
CameraDevice preferredCameraDevice = CameraDevice.rear,
9289
}) {
9390
if (imageQuality != null && (imageQuality < 0 || imageQuality > 100)) {
@@ -110,7 +107,6 @@ class MethodChannelImagePicker extends ImagePickerPlatform {
110107
'maxWidth': maxWidth,
111108
'maxHeight': maxHeight,
112109
'imageQuality': imageQuality,
113-
'forceFullMetadata': forceFullMetadata,
114110
'cameraDevice': preferredCameraDevice.index
115111
},
116112
);
@@ -187,15 +183,13 @@ class MethodChannelImagePicker extends ImagePickerPlatform {
187183
double? maxWidth,
188184
double? maxHeight,
189185
int? imageQuality,
190-
bool forceFullMetadata = true,
191186
CameraDevice preferredCameraDevice = CameraDevice.rear,
192187
}) async {
193188
String? path = await _getImagePath(
194189
source: source,
195190
maxWidth: maxWidth,
196191
maxHeight: maxHeight,
197192
imageQuality: imageQuality,
198-
forceFullMetadata: forceFullMetadata,
199193
preferredCameraDevice: preferredCameraDevice,
200194
);
201195
return path != null ? XFile(path) : null;

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

-12
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,6 @@ abstract class ImagePickerPlatform extends PlatformInterface {
5858
/// image types such as JPEG. If compression is not supported for the image that is picked,
5959
/// a warning message will be logged.
6060
///
61-
/// `forceFullMetadata` defaults to `true`, so the plugin tries to get the full image metadata which may require
62-
/// extra permission requests on certain platforms.
63-
/// If `forceFullMetadata` is set to `false`, the plugin fetches the image in a way that reduces permission requests
64-
/// from the platform (e.g. on iOS the plugin won’t ask for the `NSPhotoLibraryUsageDescription` permission).
65-
///
6661
/// Use `preferredCameraDevice` to specify the camera to use when the `source` is [ImageSource.camera].
6762
/// The `preferredCameraDevice` is ignored when `source` is [ImageSource.gallery]. It is also ignored if the chosen camera is not supported on the device.
6863
/// Defaults to [CameraDevice.rear]. Note that Android has no documented parameter for an intent to specify if
@@ -78,7 +73,6 @@ abstract class ImagePickerPlatform extends PlatformInterface {
7873
double? maxWidth,
7974
double? maxHeight,
8075
int? imageQuality,
81-
bool forceFullMetadata = true,
8276
CameraDevice preferredCameraDevice = CameraDevice.rear,
8377
}) {
8478
throw UnimplementedError('pickImage() has not been implemented.');
@@ -170,11 +164,6 @@ abstract class ImagePickerPlatform extends PlatformInterface {
170164
/// image types such as JPEG. If compression is not supported for the image that is picked,
171165
/// a warning message will be logged.
172166
///
173-
/// `forceFullMetadata` defaults to `true`, so the plugin tries to get the full image metadata which may require
174-
/// extra permission requests on certain platforms.
175-
/// If `forceFullMetadata` is set to `false`, the plugin fetches the image in a way that reduces permission requests
176-
/// from the platform (e.g. on iOS the plugin won’t ask for the `NSPhotoLibraryUsageDescription` permission).
177-
///
178167
/// Use `preferredCameraDevice` to specify the camera to use when the `source` is [ImageSource.camera].
179168
/// The `preferredCameraDevice` is ignored when `source` is [ImageSource.gallery]. It is also ignored if the chosen camera is not supported on the device.
180169
/// Defaults to [CameraDevice.rear]. Note that Android has no documented parameter for an intent to specify if
@@ -190,7 +179,6 @@ abstract class ImagePickerPlatform extends PlatformInterface {
190179
double? maxWidth,
191180
double? maxHeight,
192181
int? imageQuality,
193-
bool forceFullMetadata = true,
194182
CameraDevice preferredCameraDevice = CameraDevice.rear,
195183
}) {
196184
throw UnimplementedError('getImage() has not been implemented.');

packages/image_picker/image_picker_platform_interface/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ repository: https://github.com/flutter/plugins/tree/master/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.4.0
7+
version: 2.4.1
88

99
environment:
1010
sdk: ">=2.12.0 <3.0.0"

packages/image_picker/image_picker_platform_interface/test/new_method_channel_image_picker_test.dart

+18-40
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,14 @@ void main() {
4040
'maxWidth': null,
4141
'maxHeight': null,
4242
'imageQuality': null,
43-
'cameraDevice': 0,
44-
'forceFullMetadata': true,
43+
'cameraDevice': 0
4544
}),
4645
isMethodCall('pickImage', arguments: <String, dynamic>{
4746
'source': 1,
4847
'maxWidth': null,
4948
'maxHeight': null,
5049
'imageQuality': null,
51-
'cameraDevice': 0,
52-
'forceFullMetadata': true,
50+
'cameraDevice': 0
5351
}),
5452
],
5553
);
@@ -95,56 +93,49 @@ void main() {
9593
'maxWidth': null,
9694
'maxHeight': null,
9795
'imageQuality': null,
98-
'cameraDevice': 0,
99-
'forceFullMetadata': true,
96+
'cameraDevice': 0
10097
}),
10198
isMethodCall('pickImage', arguments: <String, dynamic>{
10299
'source': 0,
103100
'maxWidth': 10.0,
104101
'maxHeight': null,
105102
'imageQuality': null,
106-
'cameraDevice': 0,
107-
'forceFullMetadata': true,
103+
'cameraDevice': 0
108104
}),
109105
isMethodCall('pickImage', arguments: <String, dynamic>{
110106
'source': 0,
111107
'maxWidth': null,
112108
'maxHeight': 10.0,
113109
'imageQuality': null,
114-
'cameraDevice': 0,
115-
'forceFullMetadata': true,
110+
'cameraDevice': 0
116111
}),
117112
isMethodCall('pickImage', arguments: <String, dynamic>{
118113
'source': 0,
119114
'maxWidth': 10.0,
120115
'maxHeight': 20.0,
121116
'imageQuality': null,
122-
'cameraDevice': 0,
123-
'forceFullMetadata': true,
117+
'cameraDevice': 0
124118
}),
125119
isMethodCall('pickImage', arguments: <String, dynamic>{
126120
'source': 0,
127121
'maxWidth': 10.0,
128122
'maxHeight': null,
129123
'imageQuality': 70,
130-
'cameraDevice': 0,
131-
'forceFullMetadata': true,
124+
'cameraDevice': 0
132125
}),
133126
isMethodCall('pickImage', arguments: <String, dynamic>{
134127
'source': 0,
135128
'maxWidth': null,
136129
'maxHeight': 10.0,
137130
'imageQuality': 70,
138-
'cameraDevice': 0,
139-
'forceFullMetadata': true,
131+
'cameraDevice': 0
140132
}),
141133
isMethodCall('pickImage', arguments: <String, dynamic>{
142134
'source': 0,
143135
'maxWidth': 10.0,
144136
'maxHeight': 20.0,
145137
'imageQuality': 70,
146-
'cameraDevice': 0,
147-
'forceFullMetadata': true,
138+
'cameraDevice': 0
148139
}),
149140
],
150141
);
@@ -205,7 +196,6 @@ void main() {
205196
'maxHeight': null,
206197
'imageQuality': null,
207198
'cameraDevice': 0,
208-
'forceFullMetadata': true,
209199
}),
210200
],
211201
);
@@ -225,7 +215,6 @@ void main() {
225215
'maxHeight': null,
226216
'imageQuality': null,
227217
'cameraDevice': 1,
228-
'forceFullMetadata': true,
229218
}),
230219
],
231220
);
@@ -520,16 +509,14 @@ void main() {
520509
'maxWidth': null,
521510
'maxHeight': null,
522511
'imageQuality': null,
523-
'cameraDevice': 0,
524-
'forceFullMetadata': true,
512+
'cameraDevice': 0
525513
}),
526514
isMethodCall('pickImage', arguments: <String, dynamic>{
527515
'source': 1,
528516
'maxWidth': null,
529517
'maxHeight': null,
530518
'imageQuality': null,
531-
'cameraDevice': 0,
532-
'forceFullMetadata': true,
519+
'cameraDevice': 0
533520
}),
534521
],
535522
);
@@ -575,56 +562,49 @@ void main() {
575562
'maxWidth': null,
576563
'maxHeight': null,
577564
'imageQuality': null,
578-
'cameraDevice': 0,
579-
'forceFullMetadata': true,
565+
'cameraDevice': 0
580566
}),
581567
isMethodCall('pickImage', arguments: <String, dynamic>{
582568
'source': 0,
583569
'maxWidth': 10.0,
584570
'maxHeight': null,
585571
'imageQuality': null,
586-
'cameraDevice': 0,
587-
'forceFullMetadata': true,
572+
'cameraDevice': 0
588573
}),
589574
isMethodCall('pickImage', arguments: <String, dynamic>{
590575
'source': 0,
591576
'maxWidth': null,
592577
'maxHeight': 10.0,
593578
'imageQuality': null,
594-
'cameraDevice': 0,
595-
'forceFullMetadata': true,
579+
'cameraDevice': 0
596580
}),
597581
isMethodCall('pickImage', arguments: <String, dynamic>{
598582
'source': 0,
599583
'maxWidth': 10.0,
600584
'maxHeight': 20.0,
601585
'imageQuality': null,
602-
'cameraDevice': 0,
603-
'forceFullMetadata': true,
586+
'cameraDevice': 0
604587
}),
605588
isMethodCall('pickImage', arguments: <String, dynamic>{
606589
'source': 0,
607590
'maxWidth': 10.0,
608591
'maxHeight': null,
609592
'imageQuality': 70,
610-
'cameraDevice': 0,
611-
'forceFullMetadata': true,
593+
'cameraDevice': 0
612594
}),
613595
isMethodCall('pickImage', arguments: <String, dynamic>{
614596
'source': 0,
615597
'maxWidth': null,
616598
'maxHeight': 10.0,
617599
'imageQuality': 70,
618-
'cameraDevice': 0,
619-
'forceFullMetadata': true,
600+
'cameraDevice': 0
620601
}),
621602
isMethodCall('pickImage', arguments: <String, dynamic>{
622603
'source': 0,
623604
'maxWidth': 10.0,
624605
'maxHeight': 20.0,
625606
'imageQuality': 70,
626-
'cameraDevice': 0,
627-
'forceFullMetadata': true,
607+
'cameraDevice': 0
628608
}),
629609
],
630610
);
@@ -684,7 +664,6 @@ void main() {
684664
'maxHeight': null,
685665
'imageQuality': null,
686666
'cameraDevice': 0,
687-
'forceFullMetadata': true,
688667
}),
689668
],
690669
);
@@ -704,7 +683,6 @@ void main() {
704683
'maxHeight': null,
705684
'imageQuality': null,
706685
'cameraDevice': 1,
707-
'forceFullMetadata': true,
708686
}),
709687
],
710688
);

0 commit comments

Comments
 (0)