Skip to content

Commit 48ebbe1

Browse files
authored
[image_picker] Fix typos in error messages for android (#10188)
## Pre-Review Checklist [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
1 parent 501d8c9 commit 48ebbe1

File tree

5 files changed

+72
-17
lines changed

5 files changed

+72
-17
lines changed

packages/image_picker/image_picker_android/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.8.13+6
2+
3+
* Fixes typo in limit parameter validation error message.
4+
15
## 0.8.13+5
26

37
* Updates Java compatibility version to 17 and minimum supported SDK version to Flutter 3.35/Dart 3.9.

packages/image_picker/image_picker_android/lib/image_picker_android.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ class ImagePickerAndroid extends ImagePickerPlatform {
339339
}
340340

341341
if (limit != null && limit < 2) {
342-
throw ArgumentError.value(limit, 'limit', 'cannot be lower then 2');
342+
throw ArgumentError.value(limit, 'limit', 'cannot be lower than 2');
343343
}
344344

345345
return GeneralOptions(

packages/image_picker/image_picker_android/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: image_picker_android
22
description: Android implementation of the image_picker plugin.
33
repository: https://github.com/flutter/packages/tree/main/packages/image_picker/image_picker_android
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+image_picker%22
5-
version: 0.8.13+5
5+
version: 0.8.13+6
66

77
environment:
88
sdk: ^3.9.0

packages/image_picker/image_picker_android/test/image_picker_android_test.dart

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -778,18 +778,35 @@ void main() {
778778
});
779779

780780
test('does not accept an invalid limit argument', () {
781+
final Matcher throwsLimitArgumentError = throwsA(
782+
isA<ArgumentError>()
783+
.having((ArgumentError error) => error.name, 'name', 'limit')
784+
.having(
785+
(ArgumentError error) => error.message,
786+
'message',
787+
'cannot be lower than 2',
788+
),
789+
);
790+
781791
expect(
782792
() => picker.getMedia(
783793
options: const MediaOptions(allowMultiple: true, limit: -1),
784794
),
785-
throwsArgumentError,
795+
throwsLimitArgumentError,
786796
);
787797

788798
expect(
789799
() => picker.getMedia(
790800
options: const MediaOptions(allowMultiple: true, limit: 0),
791801
),
792-
throwsArgumentError,
802+
throwsLimitArgumentError,
803+
);
804+
805+
expect(
806+
() => picker.getMedia(
807+
options: const MediaOptions(allowMultiple: true, limit: 1),
808+
),
809+
throwsLimitArgumentError,
793810
);
794811
});
795812

packages/image_picker/image_picker_ios/test/image_picker_ios_test.dart

Lines changed: 47 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ void main() {
293293
]);
294294
});
295295

296-
test('does not accept a invalid imageQuality argument', () {
296+
test('does not accept an invalid imageQuality argument', () {
297297
expect(
298298
() => picker.pickImage(imageQuality: -1, source: ImageSource.gallery),
299299
throwsArgumentError,
@@ -487,7 +487,7 @@ void main() {
487487
expect(() => picker.pickMultiImage(maxHeight: -1.0), throwsArgumentError);
488488
});
489489

490-
test('does not accept a invalid imageQuality argument', () {
490+
test('does not accept an invalid imageQuality argument', () {
491491
expect(
492492
() => picker.pickMultiImage(imageQuality: -1),
493493
throwsArgumentError,
@@ -760,7 +760,7 @@ void main() {
760760
]);
761761
});
762762

763-
test('does not accept a invalid imageQuality argument', () {
763+
test('does not accept an invalid imageQuality argument', () {
764764
expect(
765765
() => picker.getImage(imageQuality: -1, source: ImageSource.gallery),
766766
throwsArgumentError,
@@ -955,7 +955,7 @@ void main() {
955955
expect(() => picker.getMultiImage(maxHeight: -1.0), throwsArgumentError);
956956
});
957957

958-
test('does not accept a invalid imageQuality argument', () {
958+
test('does not accept an invalid imageQuality argument', () {
959959
log.returnValue = <String>['0', '1'];
960960
expect(() => picker.getMultiImage(imageQuality: -1), throwsArgumentError);
961961

@@ -1214,7 +1214,7 @@ void main() {
12141214
);
12151215
});
12161216

1217-
test('does not accept a invalid imageQuality argument', () {
1217+
test('does not accept an invalid imageQuality argument', () {
12181218
log.returnValue = <String>['0', '1'];
12191219
expect(
12201220
() => picker.getMedia(
@@ -1237,20 +1237,37 @@ void main() {
12371237
);
12381238
});
12391239

1240-
test('does not accept a invalid limit argument', () {
1240+
test('does not accept an invalid limit argument', () {
12411241
log.returnValue = <String>['0', '1'];
1242+
final Matcher throwsLimitArgumentError = throwsA(
1243+
isA<ArgumentError>()
1244+
.having((ArgumentError error) => error.name, 'name', 'limit')
1245+
.having(
1246+
(ArgumentError error) => error.message,
1247+
'message',
1248+
'cannot be lower than 2',
1249+
),
1250+
);
1251+
12421252
expect(
12431253
() => picker.getMedia(
12441254
options: const MediaOptions(allowMultiple: true, limit: -1),
12451255
),
1246-
throwsArgumentError,
1256+
throwsLimitArgumentError,
12471257
);
12481258

12491259
expect(
12501260
() => picker.getMedia(
12511261
options: const MediaOptions(allowMultiple: true, limit: 0),
12521262
),
1253-
throwsArgumentError,
1263+
throwsLimitArgumentError,
1264+
);
1265+
1266+
expect(
1267+
() => picker.getMedia(
1268+
options: const MediaOptions(allowMultiple: true, limit: 1),
1269+
),
1270+
throwsLimitArgumentError,
12541271
);
12551272
});
12561273

@@ -1563,7 +1580,7 @@ void main() {
15631580
]);
15641581
});
15651582

1566-
test('does not accept a invalid imageQuality argument', () {
1583+
test('does not accept an invalid imageQuality argument', () {
15671584
expect(
15681585
() => picker.getImageFromSource(
15691586
source: ImageSource.gallery,
@@ -1881,7 +1898,7 @@ void main() {
18811898
);
18821899
});
18831900

1884-
test('does not accept a invalid imageQuality argument', () {
1901+
test('does not accept an invalid imageQuality argument', () {
18851902
log.returnValue = <String>['0', '1'];
18861903
expect(
18871904
() => picker.getMultiImageWithOptions(
@@ -1902,20 +1919,37 @@ void main() {
19021919
);
19031920
});
19041921

1905-
test('does not accept a invalid limit argument', () {
1922+
test('does not accept an invalid limit argument', () {
19061923
log.returnValue = <String>['0', '1'];
1924+
final Matcher throwsLimitArgumentError = throwsA(
1925+
isA<ArgumentError>()
1926+
.having((ArgumentError error) => error.name, 'name', 'limit')
1927+
.having(
1928+
(ArgumentError error) => error.message,
1929+
'message',
1930+
'cannot be lower than 2',
1931+
),
1932+
);
1933+
19071934
expect(
19081935
() => picker.getMultiImageWithOptions(
19091936
options: const MultiImagePickerOptions(limit: -1),
19101937
),
1911-
throwsArgumentError,
1938+
throwsLimitArgumentError,
19121939
);
19131940

19141941
expect(
19151942
() => picker.getMultiImageWithOptions(
19161943
options: const MultiImagePickerOptions(limit: 0),
19171944
),
1918-
throwsArgumentError,
1945+
throwsLimitArgumentError,
1946+
);
1947+
1948+
expect(
1949+
() => picker.getMultiImageWithOptions(
1950+
options: const MultiImagePickerOptions(limit: 1),
1951+
),
1952+
throwsLimitArgumentError,
19191953
);
19201954
});
19211955

0 commit comments

Comments
 (0)