diff --git a/packages/image_picker/image_picker_android/CHANGELOG.md b/packages/image_picker/image_picker_android/CHANGELOG.md index 22f9afdccd5d..8dd98f1e099a 100644 --- a/packages/image_picker/image_picker_android/CHANGELOG.md +++ b/packages/image_picker/image_picker_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.8.12+16 + +* Updates Pigeon for non-nullable collection type support. + ## 0.8.12+15 * Updates Java compatibility version to 11. diff --git a/packages/image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/Messages.java b/packages/image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/Messages.java index b987a2284a8e..c11f20e228d4 100644 --- a/packages/image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/Messages.java +++ b/packages/image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/Messages.java @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v17.0.0), do not edit directly. +// Autogenerated from Pigeon (v22.4.1), do not edit directly. // See also: https://pub.dev/packages/pigeon package io.flutter.plugins.imagepicker; @@ -22,6 +22,7 @@ import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.List; +import java.util.Objects; /** Generated class from Pigeon. */ @SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression", "serial"}) @@ -45,7 +46,7 @@ public FlutterError(@NonNull String code, @Nullable String message, @Nullable Ob @NonNull protected static ArrayList wrapError(@NonNull Throwable exception) { - ArrayList errorList = new ArrayList(3); + ArrayList errorList = new ArrayList<>(3); if (exception instanceof FlutterError) { FlutterError error = (FlutterError) exception; errorList.add(error.code); @@ -70,7 +71,7 @@ public enum SourceCamera { final int index; - private SourceCamera(final int index) { + SourceCamera(final int index) { this.index = index; } } @@ -81,7 +82,7 @@ public enum SourceType { final int index; - private SourceType(final int index) { + SourceType(final int index) { this.index = index; } } @@ -92,7 +93,7 @@ public enum CacheRetrievalType { final int index; - private CacheRetrievalType(final int index) { + CacheRetrievalType(final int index) { this.index = index; } } @@ -138,6 +139,25 @@ public void setLimit(@Nullable Long setterArg) { /** Constructor is non-public to enforce null safety; use Builder. */ GeneralOptions() {} + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GeneralOptions that = (GeneralOptions) o; + return allowMultiple.equals(that.allowMultiple) + && usePhotoPicker.equals(that.usePhotoPicker) + && Objects.equals(limit, that.limit); + } + + @Override + public int hashCode() { + return Objects.hash(allowMultiple, usePhotoPicker, limit); + } + public static final class Builder { private @Nullable Boolean allowMultiple; @@ -175,22 +195,21 @@ public static final class Builder { @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList(3); + ArrayList toListResult = new ArrayList<>(3); toListResult.add(allowMultiple); toListResult.add(usePhotoPicker); toListResult.add(limit); return toListResult; } - static @NonNull GeneralOptions fromList(@NonNull ArrayList list) { + static @NonNull GeneralOptions fromList(@NonNull ArrayList pigeonVar_list) { GeneralOptions pigeonResult = new GeneralOptions(); - Object allowMultiple = list.get(0); + Object allowMultiple = pigeonVar_list.get(0); pigeonResult.setAllowMultiple((Boolean) allowMultiple); - Object usePhotoPicker = list.get(1); + Object usePhotoPicker = pigeonVar_list.get(1); pigeonResult.setUsePhotoPicker((Boolean) usePhotoPicker); - Object limit = list.get(2); - pigeonResult.setLimit( - (limit == null) ? null : ((limit instanceof Integer) ? (Integer) limit : (Long) limit)); + Object limit = pigeonVar_list.get(2); + pigeonResult.setLimit((Long) limit); return pigeonResult; } } @@ -244,6 +263,25 @@ public void setQuality(@NonNull Long setterArg) { /** Constructor is non-public to enforce null safety; use Builder. */ ImageSelectionOptions() {} + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ImageSelectionOptions that = (ImageSelectionOptions) o; + return Objects.equals(maxWidth, that.maxWidth) + && Objects.equals(maxHeight, that.maxHeight) + && quality.equals(that.quality); + } + + @Override + public int hashCode() { + return Objects.hash(maxWidth, maxHeight, quality); + } + public static final class Builder { private @Nullable Double maxWidth; @@ -281,24 +319,21 @@ public static final class Builder { @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList(3); + ArrayList toListResult = new ArrayList<>(3); toListResult.add(maxWidth); toListResult.add(maxHeight); toListResult.add(quality); return toListResult; } - static @NonNull ImageSelectionOptions fromList(@NonNull ArrayList list) { + static @NonNull ImageSelectionOptions fromList(@NonNull ArrayList pigeonVar_list) { ImageSelectionOptions pigeonResult = new ImageSelectionOptions(); - Object maxWidth = list.get(0); + Object maxWidth = pigeonVar_list.get(0); pigeonResult.setMaxWidth((Double) maxWidth); - Object maxHeight = list.get(1); + Object maxHeight = pigeonVar_list.get(1); pigeonResult.setMaxHeight((Double) maxHeight); - Object quality = list.get(2); - pigeonResult.setQuality( - (quality == null) - ? null - : ((quality instanceof Integer) ? (Integer) quality : (Long) quality)); + Object quality = pigeonVar_list.get(2); + pigeonResult.setQuality((Long) quality); return pigeonResult; } } @@ -321,6 +356,23 @@ public void setImageSelectionOptions(@NonNull ImageSelectionOptions setterArg) { /** Constructor is non-public to enforce null safety; use Builder. */ MediaSelectionOptions() {} + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MediaSelectionOptions that = (MediaSelectionOptions) o; + return imageSelectionOptions.equals(that.imageSelectionOptions); + } + + @Override + public int hashCode() { + return Objects.hash(imageSelectionOptions); + } + public static final class Builder { private @Nullable ImageSelectionOptions imageSelectionOptions; @@ -340,18 +392,15 @@ public static final class Builder { @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList(1); - toListResult.add((imageSelectionOptions == null) ? null : imageSelectionOptions.toList()); + ArrayList toListResult = new ArrayList<>(1); + toListResult.add(imageSelectionOptions); return toListResult; } - static @NonNull MediaSelectionOptions fromList(@NonNull ArrayList list) { + static @NonNull MediaSelectionOptions fromList(@NonNull ArrayList pigeonVar_list) { MediaSelectionOptions pigeonResult = new MediaSelectionOptions(); - Object imageSelectionOptions = list.get(0); - pigeonResult.setImageSelectionOptions( - (imageSelectionOptions == null) - ? null - : ImageSelectionOptions.fromList((ArrayList) imageSelectionOptions)); + Object imageSelectionOptions = pigeonVar_list.get(0); + pigeonResult.setImageSelectionOptions((ImageSelectionOptions) imageSelectionOptions); return pigeonResult; } } @@ -373,6 +422,23 @@ public void setMaxDurationSeconds(@Nullable Long setterArg) { this.maxDurationSeconds = setterArg; } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VideoSelectionOptions that = (VideoSelectionOptions) o; + return Objects.equals(maxDurationSeconds, that.maxDurationSeconds); + } + + @Override + public int hashCode() { + return Objects.hash(maxDurationSeconds); + } + public static final class Builder { private @Nullable Long maxDurationSeconds; @@ -392,20 +458,15 @@ public static final class Builder { @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList(1); + ArrayList toListResult = new ArrayList<>(1); toListResult.add(maxDurationSeconds); return toListResult; } - static @NonNull VideoSelectionOptions fromList(@NonNull ArrayList list) { + static @NonNull VideoSelectionOptions fromList(@NonNull ArrayList pigeonVar_list) { VideoSelectionOptions pigeonResult = new VideoSelectionOptions(); - Object maxDurationSeconds = list.get(0); - pigeonResult.setMaxDurationSeconds( - (maxDurationSeconds == null) - ? null - : ((maxDurationSeconds instanceof Integer) - ? (Integer) maxDurationSeconds - : (Long) maxDurationSeconds)); + Object maxDurationSeconds = pigeonVar_list.get(0); + pigeonResult.setMaxDurationSeconds((Long) maxDurationSeconds); return pigeonResult; } } @@ -442,6 +503,23 @@ public void setCamera(@Nullable SourceCamera setterArg) { /** Constructor is non-public to enforce null safety; use Builder. */ SourceSpecification() {} + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SourceSpecification that = (SourceSpecification) o; + return type.equals(that.type) && Objects.equals(camera, that.camera); + } + + @Override + public int hashCode() { + return Objects.hash(type, camera); + } + public static final class Builder { private @Nullable SourceType type; @@ -470,18 +548,18 @@ public static final class Builder { @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList(2); - toListResult.add(type == null ? null : type.index); - toListResult.add(camera == null ? null : camera.index); + ArrayList toListResult = new ArrayList<>(2); + toListResult.add(type); + toListResult.add(camera); return toListResult; } - static @NonNull SourceSpecification fromList(@NonNull ArrayList list) { + static @NonNull SourceSpecification fromList(@NonNull ArrayList pigeonVar_list) { SourceSpecification pigeonResult = new SourceSpecification(); - Object type = list.get(0); - pigeonResult.setType(SourceType.values()[(int) type]); - Object camera = list.get(1); - pigeonResult.setCamera(camera == null ? null : SourceCamera.values()[(int) camera]); + Object type = pigeonVar_list.get(0); + pigeonResult.setType((SourceType) type); + Object camera = pigeonVar_list.get(1); + pigeonResult.setCamera((SourceCamera) camera); return pigeonResult; } } @@ -520,6 +598,23 @@ public void setMessage(@Nullable String setterArg) { /** Constructor is non-public to enforce null safety; use Builder. */ CacheRetrievalError() {} + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CacheRetrievalError that = (CacheRetrievalError) o; + return code.equals(that.code) && Objects.equals(message, that.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, message); + } + public static final class Builder { private @Nullable String code; @@ -548,17 +643,17 @@ public static final class Builder { @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList(2); + ArrayList toListResult = new ArrayList<>(2); toListResult.add(code); toListResult.add(message); return toListResult; } - static @NonNull CacheRetrievalError fromList(@NonNull ArrayList list) { + static @NonNull CacheRetrievalError fromList(@NonNull ArrayList pigeonVar_list) { CacheRetrievalError pigeonResult = new CacheRetrievalError(); - Object code = list.get(0); + Object code = pigeonVar_list.get(0); pigeonResult.setCode((String) code); - Object message = list.get(1); + Object message = pigeonVar_list.get(1); pigeonResult.setMessage((String) message); return pigeonResult; } @@ -595,12 +690,7 @@ public void setError(@Nullable CacheRetrievalError setterArg) { this.error = setterArg; } - /** - * The results from the last selection, if any. - * - *

Elements must not be null, by convention. See - * https://github.com/flutter/flutter/issues/97848 - */ + /** The results from the last selection, if any. */ private @NonNull List paths; public @NonNull List getPaths() { @@ -617,6 +707,25 @@ public void setPaths(@NonNull List setterArg) { /** Constructor is non-public to enforce null safety; use Builder. */ CacheRetrievalResult() {} + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CacheRetrievalResult that = (CacheRetrievalResult) o; + return type.equals(that.type) + && Objects.equals(error, that.error) + && paths.equals(that.paths); + } + + @Override + public int hashCode() { + return Objects.hash(type, error, paths); + } + public static final class Builder { private @Nullable CacheRetrievalType type; @@ -654,73 +763,62 @@ public static final class Builder { @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList(3); - toListResult.add(type == null ? null : type.index); - toListResult.add((error == null) ? null : error.toList()); + ArrayList toListResult = new ArrayList<>(3); + toListResult.add(type); + toListResult.add(error); toListResult.add(paths); return toListResult; } - static @NonNull CacheRetrievalResult fromList(@NonNull ArrayList list) { + static @NonNull CacheRetrievalResult fromList(@NonNull ArrayList pigeonVar_list) { CacheRetrievalResult pigeonResult = new CacheRetrievalResult(); - Object type = list.get(0); - pigeonResult.setType(CacheRetrievalType.values()[(int) type]); - Object error = list.get(1); - pigeonResult.setError( - (error == null) ? null : CacheRetrievalError.fromList((ArrayList) error)); - Object paths = list.get(2); + Object type = pigeonVar_list.get(0); + pigeonResult.setType((CacheRetrievalType) type); + Object error = pigeonVar_list.get(1); + pigeonResult.setError((CacheRetrievalError) error); + Object paths = pigeonVar_list.get(2); pigeonResult.setPaths((List) paths); return pigeonResult; } } - /** Asynchronous error handling return type for non-nullable API method returns. */ - public interface Result { - /** Success case callback method for handling returns. */ - void success(@NonNull T result); + private static class PigeonCodec extends StandardMessageCodec { + public static final PigeonCodec INSTANCE = new PigeonCodec(); - /** Failure case callback method for handling errors. */ - void error(@NonNull Throwable error); - } - /** Asynchronous error handling return type for nullable API method returns. */ - public interface NullableResult { - /** Success case callback method for handling returns. */ - void success(@Nullable T result); - - /** Failure case callback method for handling errors. */ - void error(@NonNull Throwable error); - } - /** Asynchronous error handling return type for void API method returns. */ - public interface VoidResult { - /** Success case callback method for handling returns. */ - void success(); - - /** Failure case callback method for handling errors. */ - void error(@NonNull Throwable error); - } - - private static class ImagePickerApiCodec extends StandardMessageCodec { - public static final ImagePickerApiCodec INSTANCE = new ImagePickerApiCodec(); - - private ImagePickerApiCodec() {} + private PigeonCodec() {} @Override protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { switch (type) { - case (byte) 128: - return CacheRetrievalError.fromList((ArrayList) readValue(buffer)); case (byte) 129: - return CacheRetrievalResult.fromList((ArrayList) readValue(buffer)); + { + Object value = readValue(buffer); + return value == null ? null : SourceCamera.values()[((Long) value).intValue()]; + } case (byte) 130: - return GeneralOptions.fromList((ArrayList) readValue(buffer)); + { + Object value = readValue(buffer); + return value == null ? null : SourceType.values()[((Long) value).intValue()]; + } case (byte) 131: - return ImageSelectionOptions.fromList((ArrayList) readValue(buffer)); + { + Object value = readValue(buffer); + return value == null ? null : CacheRetrievalType.values()[((Long) value).intValue()]; + } case (byte) 132: - return MediaSelectionOptions.fromList((ArrayList) readValue(buffer)); + return GeneralOptions.fromList((ArrayList) readValue(buffer)); case (byte) 133: - return SourceSpecification.fromList((ArrayList) readValue(buffer)); + return ImageSelectionOptions.fromList((ArrayList) readValue(buffer)); case (byte) 134: + return MediaSelectionOptions.fromList((ArrayList) readValue(buffer)); + case (byte) 135: return VideoSelectionOptions.fromList((ArrayList) readValue(buffer)); + case (byte) 136: + return SourceSpecification.fromList((ArrayList) readValue(buffer)); + case (byte) 137: + return CacheRetrievalError.fromList((ArrayList) readValue(buffer)); + case (byte) 138: + return CacheRetrievalResult.fromList((ArrayList) readValue(buffer)); default: return super.readValueOfType(type, buffer); } @@ -728,63 +826,81 @@ protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { @Override protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { - if (value instanceof CacheRetrievalError) { - stream.write(128); - writeValue(stream, ((CacheRetrievalError) value).toList()); - } else if (value instanceof CacheRetrievalResult) { + if (value instanceof SourceCamera) { stream.write(129); - writeValue(stream, ((CacheRetrievalResult) value).toList()); - } else if (value instanceof GeneralOptions) { + writeValue(stream, value == null ? null : ((SourceCamera) value).index); + } else if (value instanceof SourceType) { stream.write(130); + writeValue(stream, value == null ? null : ((SourceType) value).index); + } else if (value instanceof CacheRetrievalType) { + stream.write(131); + writeValue(stream, value == null ? null : ((CacheRetrievalType) value).index); + } else if (value instanceof GeneralOptions) { + stream.write(132); writeValue(stream, ((GeneralOptions) value).toList()); } else if (value instanceof ImageSelectionOptions) { - stream.write(131); + stream.write(133); writeValue(stream, ((ImageSelectionOptions) value).toList()); } else if (value instanceof MediaSelectionOptions) { - stream.write(132); + stream.write(134); writeValue(stream, ((MediaSelectionOptions) value).toList()); - } else if (value instanceof SourceSpecification) { - stream.write(133); - writeValue(stream, ((SourceSpecification) value).toList()); } else if (value instanceof VideoSelectionOptions) { - stream.write(134); + stream.write(135); writeValue(stream, ((VideoSelectionOptions) value).toList()); + } else if (value instanceof SourceSpecification) { + stream.write(136); + writeValue(stream, ((SourceSpecification) value).toList()); + } else if (value instanceof CacheRetrievalError) { + stream.write(137); + writeValue(stream, ((CacheRetrievalError) value).toList()); + } else if (value instanceof CacheRetrievalResult) { + stream.write(138); + writeValue(stream, ((CacheRetrievalResult) value).toList()); } else { super.writeValue(stream, value); } } } + /** Asynchronous error handling return type for non-nullable API method returns. */ + public interface Result { + /** Success case callback method for handling returns. */ + void success(@NonNull T result); + + /** Failure case callback method for handling errors. */ + void error(@NonNull Throwable error); + } + /** Asynchronous error handling return type for nullable API method returns. */ + public interface NullableResult { + /** Success case callback method for handling returns. */ + void success(@Nullable T result); + + /** Failure case callback method for handling errors. */ + void error(@NonNull Throwable error); + } + /** Asynchronous error handling return type for void API method returns. */ + public interface VoidResult { + /** Success case callback method for handling returns. */ + void success(); + + /** Failure case callback method for handling errors. */ + void error(@NonNull Throwable error); + } /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface ImagePickerApi { - /** - * Selects images and returns their paths. - * - *

Elements must not be null, by convention. See - * https://github.com/flutter/flutter/issues/97848 - */ + /** Selects images and returns their paths. */ void pickImages( @NonNull SourceSpecification source, @NonNull ImageSelectionOptions options, @NonNull GeneralOptions generalOptions, @NonNull Result> result); - /** - * Selects video and returns their paths. - * - *

Elements must not be null, by convention. See - * https://github.com/flutter/flutter/issues/97848 - */ + /** Selects video and returns their paths. */ void pickVideos( @NonNull SourceSpecification source, @NonNull VideoSelectionOptions options, @NonNull GeneralOptions generalOptions, @NonNull Result> result); - /** - * Selects images and videos and returns their paths. - * - *

Elements must not be null, by convention. See - * https://github.com/flutter/flutter/issues/97848 - */ + /** Selects images and videos and returns their paths. */ void pickMedia( @NonNull MediaSelectionOptions mediaSelectionOptions, @NonNull GeneralOptions generalOptions, @@ -795,22 +911,31 @@ void pickMedia( /** The codec used by ImagePickerApi. */ static @NonNull MessageCodec getCodec() { - return ImagePickerApiCodec.INSTANCE; + return PigeonCodec.INSTANCE; } /** Sets up an instance of `ImagePickerApi` to handle messages through the `binaryMessenger`. */ static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable ImagePickerApi api) { + setUp(binaryMessenger, "", api); + } + + static void setUp( + @NonNull BinaryMessenger binaryMessenger, + @NonNull String messageChannelSuffix, + @Nullable ImagePickerApi api) { + messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; { BinaryMessenger.TaskQueue taskQueue = binaryMessenger.makeBackgroundTaskQueue(); BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, - "dev.flutter.pigeon.image_picker_android.ImagePickerApi.pickImages", + "dev.flutter.pigeon.image_picker_android.ImagePickerApi.pickImages" + + messageChannelSuffix, getCodec(), taskQueue); if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; SourceSpecification sourceArg = (SourceSpecification) args.get(0); ImageSelectionOptions optionsArg = (ImageSelectionOptions) args.get(1); @@ -839,13 +964,14 @@ public void error(Throwable error) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, - "dev.flutter.pigeon.image_picker_android.ImagePickerApi.pickVideos", + "dev.flutter.pigeon.image_picker_android.ImagePickerApi.pickVideos" + + messageChannelSuffix, getCodec(), taskQueue); if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; SourceSpecification sourceArg = (SourceSpecification) args.get(0); VideoSelectionOptions optionsArg = (VideoSelectionOptions) args.get(1); @@ -873,12 +999,13 @@ public void error(Throwable error) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, - "dev.flutter.pigeon.image_picker_android.ImagePickerApi.pickMedia", + "dev.flutter.pigeon.image_picker_android.ImagePickerApi.pickMedia" + + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; MediaSelectionOptions mediaSelectionOptionsArg = (MediaSelectionOptions) args.get(0); @@ -907,19 +1034,19 @@ public void error(Throwable error) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, - "dev.flutter.pigeon.image_picker_android.ImagePickerApi.retrieveLostResults", + "dev.flutter.pigeon.image_picker_android.ImagePickerApi.retrieveLostResults" + + messageChannelSuffix, getCodec(), taskQueue); if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); try { CacheRetrievalResult output = api.retrieveLostResults(); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); diff --git a/packages/image_picker/image_picker_android/lib/image_picker_android.dart b/packages/image_picker/image_picker_android/lib/image_picker_android.dart index 2bcebe268027..5fa164b2d0f1 100644 --- a/packages/image_picker/image_picker_android/lib/image_picker_android.dart +++ b/packages/image_picker/image_picker_android/lib/image_picker_android.dart @@ -51,7 +51,7 @@ class ImagePickerAndroid extends ImagePickerPlatform { double? maxHeight, int? imageQuality, }) async { - final List paths = await _getMultiImagePath( + final List paths = await _getMultiImagePath( maxWidth: maxWidth, maxHeight: maxHeight, imageQuality: imageQuality, @@ -60,10 +60,10 @@ class ImagePickerAndroid extends ImagePickerPlatform { return null; } - return paths.map((dynamic path) => PickedFile(path as String)).toList(); + return paths.map((String path) => PickedFile(path)).toList(); } - Future> _getMultiImagePath({ + Future> _getMultiImagePath({ double? maxWidth, double? maxHeight, int? imageQuality, @@ -121,7 +121,7 @@ class ImagePickerAndroid extends ImagePickerPlatform { throw ArgumentError.value(maxHeight, 'maxHeight', 'cannot be negative'); } - final List paths = await _hostApi.pickImages( + final List paths = await _hostApi.pickImages( _buildSourceSpec(source, preferredCameraDevice), ImageSelectionOptions( maxWidth: maxWidth, @@ -154,7 +154,7 @@ class ImagePickerAndroid extends ImagePickerPlatform { CameraDevice preferredCameraDevice = CameraDevice.rear, Duration? maxDuration, }) async { - final List paths = await _hostApi.pickVideos( + final List paths = await _hostApi.pickVideos( _buildSourceSpec(source, preferredCameraDevice), VideoSelectionOptions(maxDurationSeconds: maxDuration?.inSeconds), GeneralOptions( @@ -205,7 +205,7 @@ class ImagePickerAndroid extends ImagePickerPlatform { double? maxHeight, int? imageQuality, }) async { - final List paths = await _getMultiImagePath( + final List paths = await _getMultiImagePath( maxWidth: maxWidth, maxHeight: maxHeight, imageQuality: imageQuality, @@ -214,14 +214,14 @@ class ImagePickerAndroid extends ImagePickerPlatform { return null; } - return paths.map((dynamic path) => XFile(path as String)).toList(); + return paths.map((String path) => XFile(path)).toList(); } @override Future> getMultiImageWithOptions({ MultiImagePickerOptions options = const MultiImagePickerOptions(), }) async { - final List paths = await _getMultiImagePath( + final List paths = await _getMultiImagePath( maxWidth: options.imageOptions.maxWidth, maxHeight: options.imageOptions.maxHeight, imageQuality: options.imageOptions.imageQuality, @@ -232,7 +232,7 @@ class ImagePickerAndroid extends ImagePickerPlatform { return []; } - return paths.map((dynamic path) => XFile(path as String)).toList(); + return paths.map((String path) => XFile(path)).toList(); } @override diff --git a/packages/image_picker/image_picker_android/lib/src/messages.g.dart b/packages/image_picker/image_picker_android/lib/src/messages.g.dart index 1466b15aee85..e221123fd800 100644 --- a/packages/image_picker/image_picker_android/lib/src/messages.g.dart +++ b/packages/image_picker/image_picker_android/lib/src/messages.g.dart @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v17.0.0), do not edit directly. +// Autogenerated from Pigeon (v22.4.1), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers @@ -121,15 +121,14 @@ class MediaSelectionOptions { Object encode() { return [ - imageSelectionOptions.encode(), + imageSelectionOptions, ]; } static MediaSelectionOptions decode(Object result) { result as List; return MediaSelectionOptions( - imageSelectionOptions: - ImageSelectionOptions.decode(result[0]! as List), + imageSelectionOptions: result[0]! as ImageSelectionOptions, ); } } @@ -170,16 +169,16 @@ class SourceSpecification { Object encode() { return [ - type.index, - camera?.index, + type, + camera, ]; } static SourceSpecification decode(Object result) { result as List; return SourceSpecification( - type: SourceType.values[result[0]! as int], - camera: result[1] != null ? SourceCamera.values[result[1]! as int] : null, + type: result[0]! as SourceType, + camera: result[1] as SourceCamera?, ); } } @@ -228,15 +227,12 @@ class CacheRetrievalResult { CacheRetrievalError? error; /// The results from the last selection, if any. - /// - /// Elements must not be null, by convention. See - /// https://github.com/flutter/flutter/issues/97848 - List paths; + List paths; Object encode() { return [ - type.index, - error?.encode(), + type, + error, paths, ]; } @@ -244,39 +240,49 @@ class CacheRetrievalResult { static CacheRetrievalResult decode(Object result) { result as List; return CacheRetrievalResult( - type: CacheRetrievalType.values[result[0]! as int], - error: result[1] != null - ? CacheRetrievalError.decode(result[1]! as List) - : null, - paths: (result[2] as List?)!.cast(), + type: result[0]! as CacheRetrievalType, + error: result[1] as CacheRetrievalError?, + paths: (result[2] as List?)!.cast(), ); } } -class _ImagePickerApiCodec extends StandardMessageCodec { - const _ImagePickerApiCodec(); +class _PigeonCodec extends StandardMessageCodec { + const _PigeonCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { - if (value is CacheRetrievalError) { - buffer.putUint8(128); - writeValue(buffer, value.encode()); - } else if (value is CacheRetrievalResult) { + if (value is int) { + buffer.putUint8(4); + buffer.putInt64(value); + } else if (value is SourceCamera) { buffer.putUint8(129); - writeValue(buffer, value.encode()); - } else if (value is GeneralOptions) { + writeValue(buffer, value.index); + } else if (value is SourceType) { buffer.putUint8(130); + writeValue(buffer, value.index); + } else if (value is CacheRetrievalType) { + buffer.putUint8(131); + writeValue(buffer, value.index); + } else if (value is GeneralOptions) { + buffer.putUint8(132); writeValue(buffer, value.encode()); } else if (value is ImageSelectionOptions) { - buffer.putUint8(131); + buffer.putUint8(133); writeValue(buffer, value.encode()); } else if (value is MediaSelectionOptions) { - buffer.putUint8(132); + buffer.putUint8(134); + writeValue(buffer, value.encode()); + } else if (value is VideoSelectionOptions) { + buffer.putUint8(135); writeValue(buffer, value.encode()); } else if (value is SourceSpecification) { - buffer.putUint8(133); + buffer.putUint8(136); writeValue(buffer, value.encode()); - } else if (value is VideoSelectionOptions) { - buffer.putUint8(134); + } else if (value is CacheRetrievalError) { + buffer.putUint8(137); + writeValue(buffer, value.encode()); + } else if (value is CacheRetrievalResult) { + buffer.putUint8(138); writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); @@ -286,20 +292,29 @@ class _ImagePickerApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: - return CacheRetrievalError.decode(readValue(buffer)!); case 129: - return CacheRetrievalResult.decode(readValue(buffer)!); + final int? value = readValue(buffer) as int?; + return value == null ? null : SourceCamera.values[value]; case 130: - return GeneralOptions.decode(readValue(buffer)!); + final int? value = readValue(buffer) as int?; + return value == null ? null : SourceType.values[value]; case 131: - return ImageSelectionOptions.decode(readValue(buffer)!); + final int? value = readValue(buffer) as int?; + return value == null ? null : CacheRetrievalType.values[value]; case 132: - return MediaSelectionOptions.decode(readValue(buffer)!); + return GeneralOptions.decode(readValue(buffer)!); case 133: - return SourceSpecification.decode(readValue(buffer)!); + return ImageSelectionOptions.decode(readValue(buffer)!); case 134: + return MediaSelectionOptions.decode(readValue(buffer)!); + case 135: return VideoSelectionOptions.decode(readValue(buffer)!); + case 136: + return SourceSpecification.decode(readValue(buffer)!); + case 137: + return CacheRetrievalError.decode(readValue(buffer)!); + case 138: + return CacheRetrievalResult.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); } @@ -310,138 +325,133 @@ class ImagePickerApi { /// Constructor for [ImagePickerApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - ImagePickerApi({BinaryMessenger? binaryMessenger}) - : __pigeon_binaryMessenger = binaryMessenger; - final BinaryMessenger? __pigeon_binaryMessenger; + ImagePickerApi( + {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + final BinaryMessenger? pigeonVar_binaryMessenger; - static const MessageCodec pigeonChannelCodec = - _ImagePickerApiCodec(); + static const MessageCodec pigeonChannelCodec = _PigeonCodec(); + + final String pigeonVar_messageChannelSuffix; /// Selects images and returns their paths. - /// - /// Elements must not be null, by convention. See - /// https://github.com/flutter/flutter/issues/97848 - Future> pickImages(SourceSpecification source, + Future> pickImages(SourceSpecification source, ImageSelectionOptions options, GeneralOptions generalOptions) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.image_picker_android.ImagePickerApi.pickImages'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.image_picker_android.ImagePickerApi.pickImages$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel + final List? pigeonVar_replyList = await pigeonVar_channel .send([source, options, generalOptions]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: __pigeon_replyList[0]! as String, - message: __pigeon_replyList[1] as String?, - details: __pigeon_replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); - } else if (__pigeon_replyList[0] == null) { + } else if (pigeonVar_replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (__pigeon_replyList[0] as List?)!.cast(); + return (pigeonVar_replyList[0] as List?)!.cast(); } } /// Selects video and returns their paths. - /// - /// Elements must not be null, by convention. See - /// https://github.com/flutter/flutter/issues/97848 - Future> pickVideos(SourceSpecification source, + Future> pickVideos(SourceSpecification source, VideoSelectionOptions options, GeneralOptions generalOptions) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.image_picker_android.ImagePickerApi.pickVideos'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.image_picker_android.ImagePickerApi.pickVideos$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel + final List? pigeonVar_replyList = await pigeonVar_channel .send([source, options, generalOptions]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: __pigeon_replyList[0]! as String, - message: __pigeon_replyList[1] as String?, - details: __pigeon_replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); - } else if (__pigeon_replyList[0] == null) { + } else if (pigeonVar_replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (__pigeon_replyList[0] as List?)!.cast(); + return (pigeonVar_replyList[0] as List?)!.cast(); } } /// Selects images and videos and returns their paths. - /// - /// Elements must not be null, by convention. See - /// https://github.com/flutter/flutter/issues/97848 - Future> pickMedia(MediaSelectionOptions mediaSelectionOptions, + Future> pickMedia(MediaSelectionOptions mediaSelectionOptions, GeneralOptions generalOptions) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.image_picker_android.ImagePickerApi.pickMedia'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.image_picker_android.ImagePickerApi.pickMedia$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel + final List? pigeonVar_replyList = await pigeonVar_channel .send([mediaSelectionOptions, generalOptions]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: __pigeon_replyList[0]! as String, - message: __pigeon_replyList[1] as String?, - details: __pigeon_replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); - } else if (__pigeon_replyList[0] == null) { + } else if (pigeonVar_replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (__pigeon_replyList[0] as List?)!.cast(); + return (pigeonVar_replyList[0] as List?)!.cast(); } } /// Returns results from a previous app session, if any. Future retrieveLostResults() async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.image_picker_android.ImagePickerApi.retrieveLostResults'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.image_picker_android.ImagePickerApi.retrieveLostResults$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send(null) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send(null) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: __pigeon_replyList[0]! as String, - message: __pigeon_replyList[1] as String?, - details: __pigeon_replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { - return (__pigeon_replyList[0] as CacheRetrievalResult?); + return (pigeonVar_replyList[0] as CacheRetrievalResult?); } } } diff --git a/packages/image_picker/image_picker_android/pigeons/messages.dart b/packages/image_picker/image_picker_android/pigeons/messages.dart index 7f39ae501b62..2d124eb12fdb 100644 --- a/packages/image_picker/image_picker_android/pigeons/messages.dart +++ b/packages/image_picker/image_picker_android/pigeons/messages.dart @@ -89,44 +89,32 @@ class CacheRetrievalResult { final CacheRetrievalError? error; /// The results from the last selection, if any. - /// - /// Elements must not be null, by convention. See - /// https://github.com/flutter/flutter/issues/97848 - final List paths; + final List paths; } @HostApi(dartHostTestHandler: 'TestHostImagePickerApi') abstract class ImagePickerApi { /// Selects images and returns their paths. - /// - /// Elements must not be null, by convention. See - /// https://github.com/flutter/flutter/issues/97848 @TaskQueue(type: TaskQueueType.serialBackgroundThread) @async - List pickImages( + List pickImages( SourceSpecification source, ImageSelectionOptions options, GeneralOptions generalOptions, ); /// Selects video and returns their paths. - /// - /// Elements must not be null, by convention. See - /// https://github.com/flutter/flutter/issues/97848 @TaskQueue(type: TaskQueueType.serialBackgroundThread) @async - List pickVideos( + List pickVideos( SourceSpecification source, VideoSelectionOptions options, GeneralOptions generalOptions, ); /// Selects images and videos and returns their paths. - /// - /// Elements must not be null, by convention. See - /// https://github.com/flutter/flutter/issues/97848 @async - List pickMedia( + List pickMedia( MediaSelectionOptions mediaSelectionOptions, GeneralOptions generalOptions, ); diff --git a/packages/image_picker/image_picker_android/pubspec.yaml b/packages/image_picker/image_picker_android/pubspec.yaml index 2fe67e1fc8fb..7aa133de61ec 100755 --- a/packages/image_picker/image_picker_android/pubspec.yaml +++ b/packages/image_picker/image_picker_android/pubspec.yaml @@ -2,7 +2,7 @@ name: image_picker_android description: Android implementation of the image_picker plugin. repository: https://github.com/flutter/packages/tree/main/packages/image_picker/image_picker_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+image_picker%22 -version: 0.8.12+15 +version: 0.8.12+16 environment: sdk: ^3.5.0 @@ -27,7 +27,7 @@ dev_dependencies: flutter_test: sdk: flutter mockito: ^5.4.4 - pigeon: ^17.0.0 + pigeon: ^22.4.1 topics: - camera diff --git a/packages/image_picker/image_picker_android/test/image_picker_android_test.dart b/packages/image_picker/image_picker_android/test/image_picker_android_test.dart index 172b135ac0ac..75dc312226b7 100644 --- a/packages/image_picker/image_picker_android/test/image_picker_android_test.dart +++ b/packages/image_picker/image_picker_android/test/image_picker_android_test.dart @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'package:flutter/src/services/binary_messenger.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:image_picker_android/image_picker_android.dart'; @@ -966,7 +967,7 @@ class _FakeImagePickerApi implements ImagePickerApi { _LastPickType? lastCall; @override - Future> pickImages( + Future> pickImages( SourceSpecification source, ImageSelectionOptions options, GeneralOptions generalOptions, @@ -977,11 +978,11 @@ class _FakeImagePickerApi implements ImagePickerApi { passedAllowMultiple = generalOptions.allowMultiple; passedPhotoPickerFlag = generalOptions.usePhotoPicker; limit = generalOptions.limit; - return returnValue as List? ?? []; + return returnValue as List? ?? []; } @override - Future> pickMedia( + Future> pickMedia( MediaSelectionOptions options, GeneralOptions generalOptions, ) async { @@ -990,11 +991,11 @@ class _FakeImagePickerApi implements ImagePickerApi { passedPhotoPickerFlag = generalOptions.usePhotoPicker; passedAllowMultiple = generalOptions.allowMultiple; limit = generalOptions.limit; - return returnValue as List? ?? []; + return returnValue as List? ?? []; } @override - Future> pickVideos( + Future> pickVideos( SourceSpecification source, VideoSelectionOptions options, GeneralOptions generalOptions, @@ -1004,11 +1005,19 @@ class _FakeImagePickerApi implements ImagePickerApi { passedVideoOptions = options; passedAllowMultiple = generalOptions.allowMultiple; passedPhotoPickerFlag = generalOptions.usePhotoPicker; - return returnValue as List? ?? []; + return returnValue as List? ?? []; } @override Future retrieveLostResults() async { return returnValue as CacheRetrievalResult?; } + + @override + // ignore: non_constant_identifier_names + BinaryMessenger? get pigeonVar_binaryMessenger => null; + + @override + // ignore: non_constant_identifier_names + String get pigeonVar_messageChannelSuffix => ''; } diff --git a/packages/image_picker/image_picker_android/test/test_api.g.dart b/packages/image_picker/image_picker_android/test/test_api.g.dart index 52aefcd0faab..4343c4958436 100644 --- a/packages/image_picker/image_picker_android/test/test_api.g.dart +++ b/packages/image_picker/image_picker_android/test/test_api.g.dart @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v17.0.0), do not edit directly. +// Autogenerated from Pigeon (v22.4.1), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, unnecessary_import, no_leading_underscores_for_local_identifiers // ignore_for_file: avoid_relative_lib_imports @@ -13,30 +13,42 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:image_picker_android/src/messages.g.dart'; -class _TestHostImagePickerApiCodec extends StandardMessageCodec { - const _TestHostImagePickerApiCodec(); +class _PigeonCodec extends StandardMessageCodec { + const _PigeonCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { - if (value is CacheRetrievalError) { - buffer.putUint8(128); - writeValue(buffer, value.encode()); - } else if (value is CacheRetrievalResult) { + if (value is int) { + buffer.putUint8(4); + buffer.putInt64(value); + } else if (value is SourceCamera) { buffer.putUint8(129); - writeValue(buffer, value.encode()); - } else if (value is GeneralOptions) { + writeValue(buffer, value.index); + } else if (value is SourceType) { buffer.putUint8(130); + writeValue(buffer, value.index); + } else if (value is CacheRetrievalType) { + buffer.putUint8(131); + writeValue(buffer, value.index); + } else if (value is GeneralOptions) { + buffer.putUint8(132); writeValue(buffer, value.encode()); } else if (value is ImageSelectionOptions) { - buffer.putUint8(131); + buffer.putUint8(133); writeValue(buffer, value.encode()); } else if (value is MediaSelectionOptions) { - buffer.putUint8(132); + buffer.putUint8(134); + writeValue(buffer, value.encode()); + } else if (value is VideoSelectionOptions) { + buffer.putUint8(135); writeValue(buffer, value.encode()); } else if (value is SourceSpecification) { - buffer.putUint8(133); + buffer.putUint8(136); writeValue(buffer, value.encode()); - } else if (value is VideoSelectionOptions) { - buffer.putUint8(134); + } else if (value is CacheRetrievalError) { + buffer.putUint8(137); + writeValue(buffer, value.encode()); + } else if (value is CacheRetrievalResult) { + buffer.putUint8(138); writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); @@ -46,20 +58,29 @@ class _TestHostImagePickerApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: - return CacheRetrievalError.decode(readValue(buffer)!); case 129: - return CacheRetrievalResult.decode(readValue(buffer)!); + final int? value = readValue(buffer) as int?; + return value == null ? null : SourceCamera.values[value]; case 130: - return GeneralOptions.decode(readValue(buffer)!); + final int? value = readValue(buffer) as int?; + return value == null ? null : SourceType.values[value]; case 131: - return ImageSelectionOptions.decode(readValue(buffer)!); + final int? value = readValue(buffer) as int?; + return value == null ? null : CacheRetrievalType.values[value]; case 132: - return MediaSelectionOptions.decode(readValue(buffer)!); + return GeneralOptions.decode(readValue(buffer)!); case 133: - return SourceSpecification.decode(readValue(buffer)!); + return ImageSelectionOptions.decode(readValue(buffer)!); case 134: + return MediaSelectionOptions.decode(readValue(buffer)!); + case 135: return VideoSelectionOptions.decode(readValue(buffer)!); + case 136: + return SourceSpecification.decode(readValue(buffer)!); + case 137: + return CacheRetrievalError.decode(readValue(buffer)!); + case 138: + return CacheRetrievalResult.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); } @@ -69,47 +90,43 @@ class _TestHostImagePickerApiCodec extends StandardMessageCodec { abstract class TestHostImagePickerApi { static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; - static const MessageCodec pigeonChannelCodec = - _TestHostImagePickerApiCodec(); + static const MessageCodec pigeonChannelCodec = _PigeonCodec(); /// Selects images and returns their paths. - /// - /// Elements must not be null, by convention. See - /// https://github.com/flutter/flutter/issues/97848 - Future> pickImages(SourceSpecification source, + Future> pickImages(SourceSpecification source, ImageSelectionOptions options, GeneralOptions generalOptions); /// Selects video and returns their paths. - /// - /// Elements must not be null, by convention. See - /// https://github.com/flutter/flutter/issues/97848 - Future> pickVideos(SourceSpecification source, + Future> pickVideos(SourceSpecification source, VideoSelectionOptions options, GeneralOptions generalOptions); /// Selects images and videos and returns their paths. - /// - /// Elements must not be null, by convention. See - /// https://github.com/flutter/flutter/issues/97848 - Future> pickMedia(MediaSelectionOptions mediaSelectionOptions, + Future> pickMedia(MediaSelectionOptions mediaSelectionOptions, GeneralOptions generalOptions); /// Returns results from a previous app session, if any. CacheRetrievalResult? retrieveLostResults(); - static void setup(TestHostImagePickerApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setUp( + TestHostImagePickerApi? api, { + BinaryMessenger? binaryMessenger, + String messageChannelSuffix = '', + }) { + messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.image_picker_android.ImagePickerApi.pickImages', + 'dev.flutter.pigeon.image_picker_android.ImagePickerApi.pickImages$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(__pigeon_channel, null); + .setMockDecodedMessageHandler(pigeonVar_channel, null); } else { _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(__pigeon_channel, + .setMockDecodedMessageHandler(pigeonVar_channel, (Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.image_picker_android.ImagePickerApi.pickImages was null.'); @@ -127,7 +144,7 @@ abstract class TestHostImagePickerApi { assert(arg_generalOptions != null, 'Argument for dev.flutter.pigeon.image_picker_android.ImagePickerApi.pickImages was null, expected non-null GeneralOptions.'); try { - final List output = await api.pickImages( + final List output = await api.pickImages( arg_source!, arg_options!, arg_generalOptions!); return [output]; } on PlatformException catch (e) { @@ -140,17 +157,18 @@ abstract class TestHostImagePickerApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.image_picker_android.ImagePickerApi.pickVideos', + 'dev.flutter.pigeon.image_picker_android.ImagePickerApi.pickVideos$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(__pigeon_channel, null); + .setMockDecodedMessageHandler(pigeonVar_channel, null); } else { _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(__pigeon_channel, + .setMockDecodedMessageHandler(pigeonVar_channel, (Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.image_picker_android.ImagePickerApi.pickVideos was null.'); @@ -168,7 +186,7 @@ abstract class TestHostImagePickerApi { assert(arg_generalOptions != null, 'Argument for dev.flutter.pigeon.image_picker_android.ImagePickerApi.pickVideos was null, expected non-null GeneralOptions.'); try { - final List output = await api.pickVideos( + final List output = await api.pickVideos( arg_source!, arg_options!, arg_generalOptions!); return [output]; } on PlatformException catch (e) { @@ -181,17 +199,18 @@ abstract class TestHostImagePickerApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.image_picker_android.ImagePickerApi.pickMedia', + 'dev.flutter.pigeon.image_picker_android.ImagePickerApi.pickMedia$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(__pigeon_channel, null); + .setMockDecodedMessageHandler(pigeonVar_channel, null); } else { _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(__pigeon_channel, + .setMockDecodedMessageHandler(pigeonVar_channel, (Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.image_picker_android.ImagePickerApi.pickMedia was null.'); @@ -205,7 +224,7 @@ abstract class TestHostImagePickerApi { assert(arg_generalOptions != null, 'Argument for dev.flutter.pigeon.image_picker_android.ImagePickerApi.pickMedia was null, expected non-null GeneralOptions.'); try { - final List output = await api.pickMedia( + final List output = await api.pickMedia( arg_mediaSelectionOptions!, arg_generalOptions!); return [output]; } on PlatformException catch (e) { @@ -218,17 +237,18 @@ abstract class TestHostImagePickerApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.image_picker_android.ImagePickerApi.retrieveLostResults', + 'dev.flutter.pigeon.image_picker_android.ImagePickerApi.retrieveLostResults$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(__pigeon_channel, null); + .setMockDecodedMessageHandler(pigeonVar_channel, null); } else { _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(__pigeon_channel, + .setMockDecodedMessageHandler(pigeonVar_channel, (Object? message) async { try { final CacheRetrievalResult? output = api.retrieveLostResults(); diff --git a/packages/image_picker/image_picker_ios/CHANGELOG.md b/packages/image_picker/image_picker_ios/CHANGELOG.md index 9fed2bfe128b..f31aa5c36662 100644 --- a/packages/image_picker/image_picker_ios/CHANGELOG.md +++ b/packages/image_picker/image_picker_ios/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 0.8.12+1 +* Updates Pigeon for non-nullable collection type support. * Updates UI test photo element query for iOS 18. ## 0.8.12 diff --git a/packages/image_picker/image_picker_ios/ios/image_picker_ios/Sources/image_picker_ios/include/image_picker_ios/messages.g.h b/packages/image_picker/image_picker_ios/ios/image_picker_ios/Sources/image_picker_ios/include/image_picker_ios/messages.g.h index de9a8200b82f..ccf843795064 100644 --- a/packages/image_picker/image_picker_ios/ios/image_picker_ios/Sources/image_picker_ios/include/image_picker_ios/messages.g.h +++ b/packages/image_picker/image_picker_ios/ios/image_picker_ios/Sources/image_picker_ios/include/image_picker_ios/messages.g.h @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v17.0.0), do not edit directly. +// Autogenerated from Pigeon (v22.4.1), do not edit directly. // See also: https://pub.dev/packages/pigeon #import @@ -68,8 +68,8 @@ typedef NS_ENUM(NSUInteger, FLTSourceType) { @property(nonatomic, assign) FLTSourceCamera camera; @end -/// The codec used by FLTImagePickerApi. -NSObject *FLTImagePickerApiGetCodec(void); +/// The codec used by all APIs. +NSObject *FLTGetMessagesCodec(void); @protocol FLTImagePickerApi - (void)pickImageWithSource:(FLTSourceSpecification *)source @@ -95,4 +95,8 @@ NSObject *FLTImagePickerApiGetCodec(void); extern void SetUpFLTImagePickerApi(id binaryMessenger, NSObject *_Nullable api); +extern void SetUpFLTImagePickerApiWithSuffix(id binaryMessenger, + NSObject *_Nullable api, + NSString *messageChannelSuffix); + NS_ASSUME_NONNULL_END diff --git a/packages/image_picker/image_picker_ios/ios/image_picker_ios/Sources/image_picker_ios/messages.g.m b/packages/image_picker/image_picker_ios/ios/image_picker_ios/Sources/image_picker_ios/messages.g.m index 0588aa932665..f2d8395cafff 100644 --- a/packages/image_picker/image_picker_ios/ios/image_picker_ios/Sources/image_picker_ios/messages.g.m +++ b/packages/image_picker/image_picker_ios/ios/image_picker_ios/Sources/image_picker_ios/messages.g.m @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v17.0.0), do not edit directly. +// Autogenerated from Pigeon (v22.4.1), do not edit directly. // See also: https://pub.dev/packages/pigeon #import "./include/image_picker_ios/messages.g.h" @@ -16,7 +16,7 @@ #error File requires ARC to be enabled. #endif -static NSArray *wrapResult(id result, FlutterError *error) { +static NSArray *wrapResult(id result, FlutterError *error) { if (error) { return @[ error.code ?: [NSNull null], error.message ?: [NSNull null], error.details ?: [NSNull null] @@ -25,7 +25,7 @@ return @[ result ?: [NSNull null] ]; } -static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { +static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { id result = array[key]; return (result == [NSNull null]) ? nil : result; } @@ -51,21 +51,21 @@ - (instancetype)initWithValue:(FLTSourceType)value { @end @interface FLTMaxSize () -+ (FLTMaxSize *)fromList:(NSArray *)list; -+ (nullable FLTMaxSize *)nullableFromList:(NSArray *)list; -- (NSArray *)toList; ++ (FLTMaxSize *)fromList:(NSArray *)list; ++ (nullable FLTMaxSize *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; @end @interface FLTMediaSelectionOptions () -+ (FLTMediaSelectionOptions *)fromList:(NSArray *)list; -+ (nullable FLTMediaSelectionOptions *)nullableFromList:(NSArray *)list; -- (NSArray *)toList; ++ (FLTMediaSelectionOptions *)fromList:(NSArray *)list; ++ (nullable FLTMediaSelectionOptions *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; @end @interface FLTSourceSpecification () -+ (FLTSourceSpecification *)fromList:(NSArray *)list; -+ (nullable FLTSourceSpecification *)nullableFromList:(NSArray *)list; -- (NSArray *)toList; ++ (FLTSourceSpecification *)fromList:(NSArray *)list; ++ (nullable FLTSourceSpecification *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; @end @implementation FLTMaxSize @@ -75,16 +75,16 @@ + (instancetype)makeWithWidth:(nullable NSNumber *)width height:(nullable NSNumb pigeonResult.height = height; return pigeonResult; } -+ (FLTMaxSize *)fromList:(NSArray *)list { ++ (FLTMaxSize *)fromList:(NSArray *)list { FLTMaxSize *pigeonResult = [[FLTMaxSize alloc] init]; pigeonResult.width = GetNullableObjectAtIndex(list, 0); pigeonResult.height = GetNullableObjectAtIndex(list, 1); return pigeonResult; } -+ (nullable FLTMaxSize *)nullableFromList:(NSArray *)list { ++ (nullable FLTMaxSize *)nullableFromList:(NSArray *)list { return (list) ? [FLTMaxSize fromList:list] : nil; } -- (NSArray *)toList { +- (NSArray *)toList { return @[ self.width ?: [NSNull null], self.height ?: [NSNull null], @@ -106,21 +106,21 @@ + (instancetype)makeWithMaxSize:(FLTMaxSize *)maxSize pigeonResult.limit = limit; return pigeonResult; } -+ (FLTMediaSelectionOptions *)fromList:(NSArray *)list { ++ (FLTMediaSelectionOptions *)fromList:(NSArray *)list { FLTMediaSelectionOptions *pigeonResult = [[FLTMediaSelectionOptions alloc] init]; - pigeonResult.maxSize = [FLTMaxSize nullableFromList:(GetNullableObjectAtIndex(list, 0))]; + pigeonResult.maxSize = GetNullableObjectAtIndex(list, 0); pigeonResult.imageQuality = GetNullableObjectAtIndex(list, 1); pigeonResult.requestFullMetadata = [GetNullableObjectAtIndex(list, 2) boolValue]; pigeonResult.allowMultiple = [GetNullableObjectAtIndex(list, 3) boolValue]; pigeonResult.limit = GetNullableObjectAtIndex(list, 4); return pigeonResult; } -+ (nullable FLTMediaSelectionOptions *)nullableFromList:(NSArray *)list { ++ (nullable FLTMediaSelectionOptions *)nullableFromList:(NSArray *)list { return (list) ? [FLTMediaSelectionOptions fromList:list] : nil; } -- (NSArray *)toList { +- (NSArray *)toList { return @[ - (self.maxSize ? [self.maxSize toList] : [NSNull null]), + self.maxSize ?: [NSNull null], self.imageQuality ?: [NSNull null], @(self.requestFullMetadata), @(self.allowMultiple), @@ -136,33 +136,47 @@ + (instancetype)makeWithType:(FLTSourceType)type camera:(FLTSourceCamera)camera pigeonResult.camera = camera; return pigeonResult; } -+ (FLTSourceSpecification *)fromList:(NSArray *)list { ++ (FLTSourceSpecification *)fromList:(NSArray *)list { FLTSourceSpecification *pigeonResult = [[FLTSourceSpecification alloc] init]; - pigeonResult.type = [GetNullableObjectAtIndex(list, 0) integerValue]; - pigeonResult.camera = [GetNullableObjectAtIndex(list, 1) integerValue]; + FLTSourceTypeBox *boxedFLTSourceType = GetNullableObjectAtIndex(list, 0); + pigeonResult.type = boxedFLTSourceType.value; + FLTSourceCameraBox *boxedFLTSourceCamera = GetNullableObjectAtIndex(list, 1); + pigeonResult.camera = boxedFLTSourceCamera.value; return pigeonResult; } -+ (nullable FLTSourceSpecification *)nullableFromList:(NSArray *)list { ++ (nullable FLTSourceSpecification *)nullableFromList:(NSArray *)list { return (list) ? [FLTSourceSpecification fromList:list] : nil; } -- (NSArray *)toList { +- (NSArray *)toList { return @[ - @(self.type), - @(self.camera), + [[FLTSourceTypeBox alloc] initWithValue:self.type], + [[FLTSourceCameraBox alloc] initWithValue:self.camera], ]; } @end -@interface FLTImagePickerApiCodecReader : FlutterStandardReader +@interface FLTMessagesPigeonCodecReader : FlutterStandardReader @end -@implementation FLTImagePickerApiCodecReader +@implementation FLTMessagesPigeonCodecReader - (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 129: { + NSNumber *enumAsNumber = [self readValue]; + return enumAsNumber == nil + ? nil + : [[FLTSourceCameraBox alloc] initWithValue:[enumAsNumber integerValue]]; + } + case 130: { + NSNumber *enumAsNumber = [self readValue]; + return enumAsNumber == nil + ? nil + : [[FLTSourceTypeBox alloc] initWithValue:[enumAsNumber integerValue]]; + } + case 131: return [FLTMaxSize fromList:[self readValue]]; - case 129: + case 132: return [FLTMediaSelectionOptions fromList:[self readValue]]; - case 130: + case 133: return [FLTSourceSpecification fromList:[self readValue]]; default: return [super readValueOfType:type]; @@ -170,18 +184,26 @@ - (nullable id)readValueOfType:(UInt8)type { } @end -@interface FLTImagePickerApiCodecWriter : FlutterStandardWriter +@interface FLTMessagesPigeonCodecWriter : FlutterStandardWriter @end -@implementation FLTImagePickerApiCodecWriter +@implementation FLTMessagesPigeonCodecWriter - (void)writeValue:(id)value { - if ([value isKindOfClass:[FLTMaxSize class]]) { - [self writeByte:128]; + if ([value isKindOfClass:[FLTSourceCameraBox class]]) { + FLTSourceCameraBox *box = (FLTSourceCameraBox *)value; + [self writeByte:129]; + [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; + } else if ([value isKindOfClass:[FLTSourceTypeBox class]]) { + FLTSourceTypeBox *box = (FLTSourceTypeBox *)value; + [self writeByte:130]; + [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; + } else if ([value isKindOfClass:[FLTMaxSize class]]) { + [self writeByte:131]; [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FLTMediaSelectionOptions class]]) { - [self writeByte:129]; + [self writeByte:132]; [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FLTSourceSpecification class]]) { - [self writeByte:130]; + [self writeByte:133]; [self writeValue:[value toList]]; } else { [super writeValue:value]; @@ -189,35 +211,47 @@ - (void)writeValue:(id)value { } @end -@interface FLTImagePickerApiCodecReaderWriter : FlutterStandardReaderWriter +@interface FLTMessagesPigeonCodecReaderWriter : FlutterStandardReaderWriter @end -@implementation FLTImagePickerApiCodecReaderWriter +@implementation FLTMessagesPigeonCodecReaderWriter - (FlutterStandardWriter *)writerWithData:(NSMutableData *)data { - return [[FLTImagePickerApiCodecWriter alloc] initWithData:data]; + return [[FLTMessagesPigeonCodecWriter alloc] initWithData:data]; } - (FlutterStandardReader *)readerWithData:(NSData *)data { - return [[FLTImagePickerApiCodecReader alloc] initWithData:data]; + return [[FLTMessagesPigeonCodecReader alloc] initWithData:data]; } @end -NSObject *FLTImagePickerApiGetCodec(void) { +NSObject *FLTGetMessagesCodec(void) { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - FLTImagePickerApiCodecReaderWriter *readerWriter = - [[FLTImagePickerApiCodecReaderWriter alloc] init]; + FLTMessagesPigeonCodecReaderWriter *readerWriter = + [[FLTMessagesPigeonCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } - void SetUpFLTImagePickerApi(id binaryMessenger, NSObject *api) { + SetUpFLTImagePickerApiWithSuffix(binaryMessenger, api, @""); +} + +void SetUpFLTImagePickerApiWithSuffix(id binaryMessenger, + NSObject *api, + NSString *messageChannelSuffix) { + messageChannelSuffix = messageChannelSuffix.length > 0 + ? [NSString stringWithFormat:@".%@", messageChannelSuffix] + : @""; { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickImage" + initWithName: + [NSString + stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickImage", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FLTImagePickerApiGetCodec()]; + codec:FLTGetMessagesCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector (pickImageWithSource:maxSize:quality:fullMetadata:completion:)], @@ -225,7 +259,7 @@ void SetUpFLTImagePickerApi(id binaryMessenger, @"@selector(pickImageWithSource:maxSize:quality:fullMetadata:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; + NSArray *args = message; FLTSourceSpecification *arg_source = GetNullableObjectAtIndex(args, 0); FLTMaxSize *arg_maxSize = GetNullableObjectAtIndex(args, 1); NSNumber *arg_imageQuality = GetNullableObjectAtIndex(args, 2); @@ -244,9 +278,12 @@ void SetUpFLTImagePickerApi(id binaryMessenger, } { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickMultiImage" + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.image_picker_ios." + @"ImagePickerApi.pickMultiImage", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FLTImagePickerApiGetCodec()]; + codec:FLTGetMessagesCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector (pickMultiImageWithMaxSize:quality:fullMetadata:limit:completion:)], @@ -254,7 +291,7 @@ void SetUpFLTImagePickerApi(id binaryMessenger, @"@selector(pickMultiImageWithMaxSize:quality:fullMetadata:limit:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; + NSArray *args = message; FLTMaxSize *arg_maxSize = GetNullableObjectAtIndex(args, 0); NSNumber *arg_imageQuality = GetNullableObjectAtIndex(args, 1); BOOL arg_requestFullMetadata = [GetNullableObjectAtIndex(args, 2) boolValue]; @@ -274,16 +311,20 @@ void SetUpFLTImagePickerApi(id binaryMessenger, } { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickVideo" + initWithName: + [NSString + stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickVideo", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FLTImagePickerApiGetCodec()]; + codec:FLTGetMessagesCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(pickVideoWithSource:maxDuration:completion:)], @"FLTImagePickerApi api (%@) doesn't respond to " @"@selector(pickVideoWithSource:maxDuration:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; + NSArray *args = message; FLTSourceSpecification *arg_source = GetNullableObjectAtIndex(args, 0); NSNumber *arg_maxDurationSeconds = GetNullableObjectAtIndex(args, 1); [api pickVideoWithSource:arg_source @@ -299,16 +340,20 @@ void SetUpFLTImagePickerApi(id binaryMessenger, /// Selects images and videos and returns their paths. { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickMedia" + initWithName: + [NSString + stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickMedia", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FLTImagePickerApiGetCodec()]; + codec:FLTGetMessagesCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(pickMediaWithMediaSelectionOptions:completion:)], @"FLTImagePickerApi api (%@) doesn't respond to " @"@selector(pickMediaWithMediaSelectionOptions:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; + NSArray *args = message; FLTMediaSelectionOptions *arg_mediaSelectionOptions = GetNullableObjectAtIndex(args, 0); [api pickMediaWithMediaSelectionOptions:arg_mediaSelectionOptions completion:^(NSArray *_Nullable output, diff --git a/packages/image_picker/image_picker_ios/lib/image_picker_ios.dart b/packages/image_picker/image_picker_ios/lib/image_picker_ios.dart index 96166130797d..ea188cb4ad63 100644 --- a/packages/image_picker/image_picker_ios/lib/image_picker_ios.dart +++ b/packages/image_picker/image_picker_ios/lib/image_picker_ios.dart @@ -88,7 +88,7 @@ class ImagePickerIOS extends ImagePickerPlatform { double? maxHeight, int? imageQuality, }) async { - final List paths = await _pickMultiImageAsPath( + final List paths = await _pickMultiImageAsPath( options: MultiImagePickerOptions( imageOptions: ImageOptions( maxWidth: maxWidth, @@ -103,7 +103,7 @@ class ImagePickerIOS extends ImagePickerPlatform { return null; } - return paths.map((dynamic path) => PickedFile(path as String)).toList(); + return paths.map((String path) => PickedFile(path)).toList(); } @override @@ -138,15 +138,12 @@ class ImagePickerIOS extends ImagePickerPlatform { throw ArgumentError.value(limit, 'limit', 'cannot be lower than 2'); } - // TODO(stuartmorgan): Remove the cast once Pigeon supports non-nullable - // generics, https://github.com/flutter/flutter/issues/97848 - return (await _hostApi.pickMultiImage( + return _hostApi.pickMultiImage( MaxSize(width: maxWidth, height: maxHeight), imageQuality, options.imageOptions.requestFullMetadata, limit, - )) - .cast(); + ); } Future _pickImageAsPath({ diff --git a/packages/image_picker/image_picker_ios/lib/src/messages.g.dart b/packages/image_picker/image_picker_ios/lib/src/messages.g.dart index b3e785a09dff..63a245a1a673 100644 --- a/packages/image_picker/image_picker_ios/lib/src/messages.g.dart +++ b/packages/image_picker/image_picker_ios/lib/src/messages.g.dart @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v17.0.0), do not edit directly. +// Autogenerated from Pigeon (v22.4.1), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers @@ -86,7 +86,7 @@ class MediaSelectionOptions { Object encode() { return [ - maxSize.encode(), + maxSize, imageQuality, requestFullMetadata, allowMultiple, @@ -97,7 +97,7 @@ class MediaSelectionOptions { static MediaSelectionOptions decode(Object result) { result as List; return MediaSelectionOptions( - maxSize: MaxSize.decode(result[0]! as List), + maxSize: result[0]! as MaxSize, imageQuality: result[1] as int?, requestFullMetadata: result[2]! as bool, allowMultiple: result[3]! as bool, @@ -118,32 +118,41 @@ class SourceSpecification { Object encode() { return [ - type.index, - camera.index, + type, + camera, ]; } static SourceSpecification decode(Object result) { result as List; return SourceSpecification( - type: SourceType.values[result[0]! as int], - camera: SourceCamera.values[result[1]! as int], + type: result[0]! as SourceType, + camera: result[1]! as SourceCamera, ); } } -class _ImagePickerApiCodec extends StandardMessageCodec { - const _ImagePickerApiCodec(); +class _PigeonCodec extends StandardMessageCodec { + const _PigeonCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { - if (value is MaxSize) { - buffer.putUint8(128); + if (value is int) { + buffer.putUint8(4); + buffer.putInt64(value); + } else if (value is SourceCamera) { + buffer.putUint8(129); + writeValue(buffer, value.index); + } else if (value is SourceType) { + buffer.putUint8(130); + writeValue(buffer, value.index); + } else if (value is MaxSize) { + buffer.putUint8(131); writeValue(buffer, value.encode()); } else if (value is MediaSelectionOptions) { - buffer.putUint8(129); + buffer.putUint8(132); writeValue(buffer, value.encode()); } else if (value is SourceSpecification) { - buffer.putUint8(130); + buffer.putUint8(133); writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); @@ -153,11 +162,17 @@ class _ImagePickerApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: - return MaxSize.decode(readValue(buffer)!); case 129: - return MediaSelectionOptions.decode(readValue(buffer)!); + final int? value = readValue(buffer) as int?; + return value == null ? null : SourceCamera.values[value]; case 130: + final int? value = readValue(buffer) as int?; + return value == null ? null : SourceType.values[value]; + case 131: + return MaxSize.decode(readValue(buffer)!); + case 132: + return MediaSelectionOptions.decode(readValue(buffer)!); + case 133: return SourceSpecification.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -169,123 +184,127 @@ class ImagePickerApi { /// Constructor for [ImagePickerApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - ImagePickerApi({BinaryMessenger? binaryMessenger}) - : __pigeon_binaryMessenger = binaryMessenger; - final BinaryMessenger? __pigeon_binaryMessenger; + ImagePickerApi( + {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + final BinaryMessenger? pigeonVar_binaryMessenger; + + static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - static const MessageCodec pigeonChannelCodec = - _ImagePickerApiCodec(); + final String pigeonVar_messageChannelSuffix; Future pickImage(SourceSpecification source, MaxSize maxSize, int? imageQuality, bool requestFullMetadata) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickImage'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickImage$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel + final List? pigeonVar_replyList = await pigeonVar_channel .send([source, maxSize, imageQuality, requestFullMetadata]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: __pigeon_replyList[0]! as String, - message: __pigeon_replyList[1] as String?, - details: __pigeon_replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { - return (__pigeon_replyList[0] as String?); + return (pigeonVar_replyList[0] as String?); } } - Future> pickMultiImage(MaxSize maxSize, int? imageQuality, + Future> pickMultiImage(MaxSize maxSize, int? imageQuality, bool requestFullMetadata, int? limit) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickMultiImage'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickMultiImage$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel + final List? pigeonVar_replyList = await pigeonVar_channel .send([maxSize, imageQuality, requestFullMetadata, limit]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: __pigeon_replyList[0]! as String, - message: __pigeon_replyList[1] as String?, - details: __pigeon_replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); - } else if (__pigeon_replyList[0] == null) { + } else if (pigeonVar_replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (__pigeon_replyList[0] as List?)!.cast(); + return (pigeonVar_replyList[0] as List?)!.cast(); } } Future pickVideo( SourceSpecification source, int? maxDurationSeconds) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickVideo'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickVideo$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel + final List? pigeonVar_replyList = await pigeonVar_channel .send([source, maxDurationSeconds]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: __pigeon_replyList[0]! as String, - message: __pigeon_replyList[1] as String?, - details: __pigeon_replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { - return (__pigeon_replyList[0] as String?); + return (pigeonVar_replyList[0] as String?); } } /// Selects images and videos and returns their paths. - Future> pickMedia( + Future> pickMedia( MediaSelectionOptions mediaSelectionOptions) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickMedia'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickMedia$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel + final List? pigeonVar_replyList = await pigeonVar_channel .send([mediaSelectionOptions]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: __pigeon_replyList[0]! as String, - message: __pigeon_replyList[1] as String?, - details: __pigeon_replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); - } else if (__pigeon_replyList[0] == null) { + } else if (pigeonVar_replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (__pigeon_replyList[0] as List?)!.cast(); + return (pigeonVar_replyList[0] as List?)!.cast(); } } } diff --git a/packages/image_picker/image_picker_ios/pigeons/messages.dart b/packages/image_picker/image_picker_ios/pigeons/messages.dart index 4a31ae0b6c32..c8dd34fa5697 100644 --- a/packages/image_picker/image_picker_ios/pigeons/messages.dart +++ b/packages/image_picker/image_picker_ios/pigeons/messages.dart @@ -58,7 +58,7 @@ abstract class ImagePickerApi { int? imageQuality, bool requestFullMetadata); @async @ObjCSelector('pickMultiImageWithMaxSize:quality:fullMetadata:limit:') - List pickMultiImage( + List pickMultiImage( MaxSize maxSize, int? imageQuality, bool requestFullMetadata, int? limit); @async @ObjCSelector('pickVideoWithSource:maxDuration:') @@ -67,5 +67,5 @@ abstract class ImagePickerApi { /// Selects images and videos and returns their paths. @async @ObjCSelector('pickMediaWithMediaSelectionOptions:') - List pickMedia(MediaSelectionOptions mediaSelectionOptions); + List pickMedia(MediaSelectionOptions mediaSelectionOptions); } diff --git a/packages/image_picker/image_picker_ios/pubspec.yaml b/packages/image_picker/image_picker_ios/pubspec.yaml index cf5c02111f3f..a1f752f33bce 100755 --- a/packages/image_picker/image_picker_ios/pubspec.yaml +++ b/packages/image_picker/image_picker_ios/pubspec.yaml @@ -2,7 +2,7 @@ name: image_picker_ios description: iOS implementation of the image_picker plugin. repository: https://github.com/flutter/packages/tree/main/packages/image_picker/image_picker_ios issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+image_picker%22 -version: 0.8.12 +version: 0.8.12+1 environment: sdk: ^3.3.0 @@ -25,7 +25,7 @@ dev_dependencies: flutter_test: sdk: flutter mockito: ^5.4.4 - pigeon: ^17.0.0 + pigeon: ^22.4.1 topics: - camera diff --git a/packages/image_picker/image_picker_ios/test/image_picker_ios_test.dart b/packages/image_picker/image_picker_ios/test/image_picker_ios_test.dart index c2e5f74763f2..c84b2554301d 100644 --- a/packages/image_picker/image_picker_ios/test/image_picker_ios_test.dart +++ b/packages/image_picker/image_picker_ios/test/image_picker_ios_test.dart @@ -57,7 +57,7 @@ class _ApiLogger implements TestHostImagePickerApi { } @override - Future> pickMultiImage( + Future> pickMultiImage( MaxSize maxSize, int? imageQuality, bool requestFullMetadata, @@ -70,11 +70,11 @@ class _ApiLogger implements TestHostImagePickerApi { 'requestFullMetadata': requestFullMetadata, 'limit': limit, })); - return returnValue as List; + return returnValue as List; } @override - Future> pickMedia( + Future> pickMedia( MediaSelectionOptions mediaSelectionOptions) async { calls.add(_LoggedMethodCall('pickMedia', arguments: { 'maxWidth': mediaSelectionOptions.maxSize.width, @@ -84,7 +84,7 @@ class _ApiLogger implements TestHostImagePickerApi { 'allowMultiple': mediaSelectionOptions.allowMultiple, 'limit': mediaSelectionOptions.limit, })); - return returnValue as List; + return returnValue as List; } @override @@ -107,7 +107,7 @@ void main() { setUp(() { log = _ApiLogger(); - TestHostImagePickerApi.setup(log); + TestHostImagePickerApi.setUp(log); }); test('registration', () async { diff --git a/packages/image_picker/image_picker_ios/test/test_api.g.dart b/packages/image_picker/image_picker_ios/test/test_api.g.dart index 4208c68e32f2..46dc4e4e85d8 100644 --- a/packages/image_picker/image_picker_ios/test/test_api.g.dart +++ b/packages/image_picker/image_picker_ios/test/test_api.g.dart @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v17.0.0), do not edit directly. +// Autogenerated from Pigeon (v22.4.1), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, unnecessary_import, no_leading_underscores_for_local_identifiers // ignore_for_file: avoid_relative_lib_imports @@ -13,18 +13,27 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:image_picker_ios/src/messages.g.dart'; -class _TestHostImagePickerApiCodec extends StandardMessageCodec { - const _TestHostImagePickerApiCodec(); +class _PigeonCodec extends StandardMessageCodec { + const _PigeonCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { - if (value is MaxSize) { - buffer.putUint8(128); + if (value is int) { + buffer.putUint8(4); + buffer.putInt64(value); + } else if (value is SourceCamera) { + buffer.putUint8(129); + writeValue(buffer, value.index); + } else if (value is SourceType) { + buffer.putUint8(130); + writeValue(buffer, value.index); + } else if (value is MaxSize) { + buffer.putUint8(131); writeValue(buffer, value.encode()); } else if (value is MediaSelectionOptions) { - buffer.putUint8(129); + buffer.putUint8(132); writeValue(buffer, value.encode()); } else if (value is SourceSpecification) { - buffer.putUint8(130); + buffer.putUint8(133); writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); @@ -34,11 +43,17 @@ class _TestHostImagePickerApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: - return MaxSize.decode(readValue(buffer)!); case 129: - return MediaSelectionOptions.decode(readValue(buffer)!); + final int? value = readValue(buffer) as int?; + return value == null ? null : SourceCamera.values[value]; case 130: + final int? value = readValue(buffer) as int?; + return value == null ? null : SourceType.values[value]; + case 131: + return MaxSize.decode(readValue(buffer)!); + case 132: + return MediaSelectionOptions.decode(readValue(buffer)!); + case 133: return SourceSpecification.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -49,35 +64,40 @@ class _TestHostImagePickerApiCodec extends StandardMessageCodec { abstract class TestHostImagePickerApi { static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; - static const MessageCodec pigeonChannelCodec = - _TestHostImagePickerApiCodec(); + static const MessageCodec pigeonChannelCodec = _PigeonCodec(); Future pickImage(SourceSpecification source, MaxSize maxSize, int? imageQuality, bool requestFullMetadata); - Future> pickMultiImage( + Future> pickMultiImage( MaxSize maxSize, int? imageQuality, bool requestFullMetadata, int? limit); Future pickVideo( SourceSpecification source, int? maxDurationSeconds); /// Selects images and videos and returns their paths. - Future> pickMedia(MediaSelectionOptions mediaSelectionOptions); + Future> pickMedia(MediaSelectionOptions mediaSelectionOptions); - static void setup(TestHostImagePickerApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setUp( + TestHostImagePickerApi? api, { + BinaryMessenger? binaryMessenger, + String messageChannelSuffix = '', + }) { + messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( - 'dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickImage', - pigeonChannelCodec, - binaryMessenger: binaryMessenger); + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickImage$messageChannelSuffix', + pigeonChannelCodec, + binaryMessenger: binaryMessenger); if (api == null) { _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(__pigeon_channel, null); + .setMockDecodedMessageHandler(pigeonVar_channel, null); } else { _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(__pigeon_channel, + .setMockDecodedMessageHandler(pigeonVar_channel, (Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickImage was null.'); @@ -107,17 +127,18 @@ abstract class TestHostImagePickerApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickMultiImage', + 'dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickMultiImage$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(__pigeon_channel, null); + .setMockDecodedMessageHandler(pigeonVar_channel, null); } else { _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(__pigeon_channel, + .setMockDecodedMessageHandler(pigeonVar_channel, (Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickMultiImage was null.'); @@ -131,7 +152,7 @@ abstract class TestHostImagePickerApi { 'Argument for dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickMultiImage was null, expected non-null bool.'); final int? arg_limit = (args[3] as int?); try { - final List output = await api.pickMultiImage(arg_maxSize!, + final List output = await api.pickMultiImage(arg_maxSize!, arg_imageQuality, arg_requestFullMetadata!, arg_limit); return [output]; } on PlatformException catch (e) { @@ -144,17 +165,18 @@ abstract class TestHostImagePickerApi { } } { - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( - 'dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickVideo', - pigeonChannelCodec, - binaryMessenger: binaryMessenger); + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickVideo$messageChannelSuffix', + pigeonChannelCodec, + binaryMessenger: binaryMessenger); if (api == null) { _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(__pigeon_channel, null); + .setMockDecodedMessageHandler(pigeonVar_channel, null); } else { _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(__pigeon_channel, + .setMockDecodedMessageHandler(pigeonVar_channel, (Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickVideo was null.'); @@ -178,17 +200,18 @@ abstract class TestHostImagePickerApi { } } { - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( - 'dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickMedia', - pigeonChannelCodec, - binaryMessenger: binaryMessenger); + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickMedia$messageChannelSuffix', + pigeonChannelCodec, + binaryMessenger: binaryMessenger); if (api == null) { _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(__pigeon_channel, null); + .setMockDecodedMessageHandler(pigeonVar_channel, null); } else { _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(__pigeon_channel, + .setMockDecodedMessageHandler(pigeonVar_channel, (Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickMedia was null.'); @@ -198,7 +221,7 @@ abstract class TestHostImagePickerApi { assert(arg_mediaSelectionOptions != null, 'Argument for dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickMedia was null, expected non-null MediaSelectionOptions.'); try { - final List output = + final List output = await api.pickMedia(arg_mediaSelectionOptions!); return [output]; } on PlatformException catch (e) {