diff --git a/packages/pigeon/CHANGELOG.md b/packages/pigeon/CHANGELOG.md index e7dd334e663..c5281a3469a 100644 --- a/packages/pigeon/CHANGELOG.md +++ b/packages/pigeon/CHANGELOG.md @@ -1,5 +1,10 @@ -## NEXT +## 21.2.0 +* Removes restriction on number of custom types. +* [java] Fixes bug with multiple enums. +* [java] Removes `Object` from generics. +* [objc] Fixes bug with multiple enums per data class. +* Updates `varPrefix` and `classMemberNamePrefix`. * Updates minimum supported SDK version to Flutter 3.19/Dart 3.3. ## 21.1.0 diff --git a/packages/pigeon/example/app/android/app/src/main/java/io/flutter/plugins/Messages.java b/packages/pigeon/example/app/android/app/src/main/java/io/flutter/plugins/Messages.java index 8b07206873a..7e5e839dd73 100644 --- a/packages/pigeon/example/app/android/app/src/main/java/io/flutter/plugins/Messages.java +++ b/packages/pigeon/example/app/android/app/src/main/java/io/flutter/plugins/Messages.java @@ -46,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); @@ -77,7 +77,7 @@ public enum Code { final int index; - private Code(final int index) { + Code(final int index) { this.index = index; } } @@ -199,7 +199,7 @@ public static final class Builder { @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList(4); + ArrayList toListResult = new ArrayList<>(4); toListResult.add(name); toListResult.add(description); toListResult.add(code); @@ -207,15 +207,15 @@ ArrayList toList() { return toListResult; } - static @NonNull MessageData fromList(@NonNull ArrayList __pigeon_list) { + static @NonNull MessageData fromList(@NonNull ArrayList pigeonVar_list) { MessageData pigeonResult = new MessageData(); - Object name = __pigeon_list.get(0); + Object name = pigeonVar_list.get(0); pigeonResult.setName((String) name); - Object description = __pigeon_list.get(1); + Object description = pigeonVar_list.get(1); pigeonResult.setDescription((String) description); - Object code = __pigeon_list.get(2); + Object code = pigeonVar_list.get(2); pigeonResult.setCode((Code) code); - Object data = __pigeon_list.get(3); + Object data = pigeonVar_list.get(3); pigeonResult.setData((Map) data); return pigeonResult; } @@ -230,10 +230,12 @@ private PigeonCodec() {} protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { switch (type) { case (byte) 129: - return MessageData.fromList((ArrayList) readValue(buffer)); + { + Object value = readValue(buffer); + return value == null ? null : Code.values()[(int) value]; + } case (byte) 130: - Object value = readValue(buffer); - return value == null ? null : Code.values()[(int) value]; + return MessageData.fromList((ArrayList) readValue(buffer)); default: return super.readValueOfType(type, buffer); } @@ -241,12 +243,12 @@ protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { @Override protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { - if (value instanceof MessageData) { + if (value instanceof Code) { stream.write(129); - writeValue(stream, ((MessageData) value).toList()); - } else if (value instanceof Code) { - stream.write(130); writeValue(stream, value == null ? null : ((Code) value).index); + } else if (value instanceof MessageData) { + stream.write(130); + writeValue(stream, ((MessageData) value).toList()); } else { super.writeValue(stream, value); } @@ -312,13 +314,12 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); try { String output = api.getHostLanguage(); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -336,7 +337,7 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Number aArg = (Number) args.get(0); Number bArg = (Number) args.get(1); @@ -347,8 +348,7 @@ static void setUp( (bArg == null) ? null : bArg.longValue()); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -366,7 +366,7 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; MessageData messageArg = (MessageData) args.get(0); Result resultCallback = @@ -405,8 +405,7 @@ public MessageFlutterApi( this.messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; } - /** Public interface for sending reply. */ - /** The codec used by MessageFlutterApi. */ + /** Public interface for sending reply. The codec used by MessageFlutterApi. */ static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } @@ -418,16 +417,14 @@ public void flutterMethod(@Nullable String aStringArg, @NonNull Result r BasicMessageChannel channel = new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( - new ArrayList(Collections.singletonList(aStringArg)), + new ArrayList<>(Collections.singletonList(aStringArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { result.error( new FlutterError( - (String) listReply.get(0), - (String) listReply.get(1), - (String) listReply.get(2))); + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else if (listReply.get(0) == null) { result.error( new FlutterError( diff --git a/packages/pigeon/example/app/android/app/src/main/kotlin/dev/flutter/pigeon_example_app/Messages.g.kt b/packages/pigeon/example/app/android/app/src/main/kotlin/dev/flutter/pigeon_example_app/Messages.g.kt index 6542e190e78..d96ca417a45 100644 --- a/packages/pigeon/example/app/android/app/src/main/kotlin/dev/flutter/pigeon_example_app/Messages.g.kt +++ b/packages/pigeon/example/app/android/app/src/main/kotlin/dev/flutter/pigeon_example_app/Messages.g.kt @@ -65,12 +65,11 @@ data class MessageData( val data: Map ) { companion object { - @Suppress("LocalVariableName") - fun fromList(__pigeon_list: List): MessageData { - val name = __pigeon_list[0] as String? - val description = __pigeon_list[1] as String? - val code = __pigeon_list[2] as Code - val data = __pigeon_list[3] as Map + fun fromList(pigeonVar_list: List): MessageData { + val name = pigeonVar_list[0] as String? + val description = pigeonVar_list[1] as String? + val code = pigeonVar_list[2] as Code + val data = pigeonVar_list[3] as Map return MessageData(name, description, code, data) } } @@ -89,10 +88,10 @@ private object MessagesPigeonCodec : StandardMessageCodec() { override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { return when (type) { 129.toByte() -> { - return (readValue(buffer) as? List)?.let { MessageData.fromList(it) } + return (readValue(buffer) as Int?)?.let { Code.ofRaw(it) } } 130.toByte() -> { - return (readValue(buffer) as Int?)?.let { Code.ofRaw(it) } + return (readValue(buffer) as? List)?.let { MessageData.fromList(it) } } else -> super.readValueOfType(type, buffer) } @@ -100,13 +99,13 @@ private object MessagesPigeonCodec : StandardMessageCodec() { override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { when (value) { - is MessageData -> { + is Code -> { stream.write(129) - writeValue(stream, value.toList()) + writeValue(stream, value.raw) } - is Code -> { + is MessageData -> { stream.write(130) - writeValue(stream, value.raw) + writeValue(stream, value.toList()) } else -> super.writeValue(stream, value) } diff --git a/packages/pigeon/example/app/ios/Runner/Messages.g.swift b/packages/pigeon/example/app/ios/Runner/Messages.g.swift index 3d5362cc4f1..0198cd783b1 100644 --- a/packages/pigeon/example/app/ios/Runner/Messages.g.swift +++ b/packages/pigeon/example/app/ios/Runner/Messages.g.swift @@ -86,11 +86,11 @@ struct MessageData { var data: [String?: String?] // swift-format-ignore: AlwaysUseLowerCamelCase - static func fromList(_ __pigeon_list: [Any?]) -> MessageData? { - let name: String? = nilOrValue(__pigeon_list[0]) - let description: String? = nilOrValue(__pigeon_list[1]) - let code = __pigeon_list[2] as! Code - let data = __pigeon_list[3] as! [String?: String?] + static func fromList(_ pigeonVar_list: [Any?]) -> MessageData? { + let name: String? = nilOrValue(pigeonVar_list[0]) + let description: String? = nilOrValue(pigeonVar_list[1]) + let code = pigeonVar_list[2] as! Code + let data = pigeonVar_list[3] as! [String?: String?] return MessageData( name: name, @@ -108,18 +108,18 @@ struct MessageData { ] } } + private class MessagesPigeonCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { case 129: - return MessageData.fromList(self.readValue() as! [Any?]) - case 130: - var enumResult: Code? = nil let enumResultAsInt: Int? = nilOrValue(self.readValue() as? Int) if let enumResultAsInt = enumResultAsInt { - enumResult = Code(rawValue: enumResultAsInt) + return Code(rawValue: enumResultAsInt) } - return enumResult + return nil + case 130: + return MessageData.fromList(self.readValue() as! [Any?]) default: return super.readValue(ofType: type) } @@ -128,12 +128,12 @@ private class MessagesPigeonCodecReader: FlutterStandardReader { private class MessagesPigeonCodecWriter: FlutterStandardWriter { override func writeValue(_ value: Any) { - if let value = value as? MessageData { + if let value = value as? Code { super.writeByte(129) - super.writeValue(value.toList()) - } else if let value = value as? Code { - super.writeByte(130) super.writeValue(value.rawValue) + } else if let value = value as? MessageData { + super.writeByte(130) + super.writeValue(value.toList()) } else { super.writeValue(value) } diff --git a/packages/pigeon/example/app/lib/src/messages.g.dart b/packages/pigeon/example/app/lib/src/messages.g.dart index d8d4fde551c..4eaf6bccecd 100644 --- a/packages/pigeon/example/app/lib/src/messages.g.dart +++ b/packages/pigeon/example/app/lib/src/messages.g.dart @@ -74,12 +74,12 @@ class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { - if (value is MessageData) { + if (value is Code) { buffer.putUint8(129); - writeValue(buffer, value.encode()); - } else if (value is Code) { - buffer.putUint8(130); writeValue(buffer, value.index); + } else if (value is MessageData) { + buffer.putUint8(130); + writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -89,10 +89,10 @@ class _PigeonCodec extends StandardMessageCodec { Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { case 129: - return MessageData.decode(readValue(buffer)!); - case 130: final int? value = readValue(buffer) as int?; return value == null ? null : Code.values[value]; + case 130: + return MessageData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); } @@ -105,99 +105,99 @@ class ExampleHostApi { /// BinaryMessenger will be used which routes to the host platform. ExampleHostApi( {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) - : __pigeon_binaryMessenger = binaryMessenger, - __pigeon_messageChannelSuffix = + : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; - final BinaryMessenger? __pigeon_binaryMessenger; + final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - final String __pigeon_messageChannelSuffix; + final String pigeonVar_messageChannelSuffix; Future getHostLanguage() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_example_package.ExampleHostApi.getHostLanguage$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_example_package.ExampleHostApi.getHostLanguage$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 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 String?)!; + return (pigeonVar_replyList[0] as String?)!; } } Future add(int a, int b) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_example_package.ExampleHostApi.add$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_example_package.ExampleHostApi.add$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([a, b]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([a, b]) 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 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 int?)!; + return (pigeonVar_replyList[0] as int?)!; } } Future sendMessage(MessageData message) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_example_package.ExampleHostApi.sendMessage$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_example_package.ExampleHostApi.sendMessage$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([message]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([message]) 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 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 bool?)!; + return (pigeonVar_replyList[0] as bool?)!; } } } @@ -215,15 +215,16 @@ abstract class MessageFlutterApi { messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_example_package.MessageFlutterApi.flutterMethod$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_example_package.MessageFlutterApi.flutterMethod was null.'); final List args = (message as List?)!; diff --git a/packages/pigeon/example/app/linux/messages.g.cc b/packages/pigeon/example/app/linux/messages.g.cc index 2d9ede7877d..a9ee2105989 100644 --- a/packages/pigeon/example/app/linux/messages.g.cc +++ b/packages/pigeon/example/app/linux/messages.g.cc @@ -91,7 +91,7 @@ static FlValue* pigeon_example_package_message_data_to_list( ? fl_value_new_string(self->description) : fl_value_new_null()); fl_value_append_take(values, - fl_value_new_custom(130, fl_value_new_int(self->code), + fl_value_new_custom(129, fl_value_new_int(self->code), (GDestroyNotify)fl_value_unref)); fl_value_append_take(values, fl_value_ref(self->data)); return values; @@ -132,23 +132,23 @@ G_DEFINE_TYPE(PigeonExamplePackageMessageCodec, fl_standard_message_codec_get_type()) static gboolean -pigeon_example_package_message_codec_write_pigeon_example_package_message_data( - FlStandardMessageCodec* codec, GByteArray* buffer, - PigeonExamplePackageMessageData* value, GError** error) { +pigeon_example_package_message_codec_write_pigeon_example_package_code( + FlStandardMessageCodec* codec, GByteArray* buffer, FlValue* value, + GError** error) { uint8_t type = 129; g_byte_array_append(buffer, &type, sizeof(uint8_t)); - g_autoptr(FlValue) values = - pigeon_example_package_message_data_to_list(value); - return fl_standard_message_codec_write_value(codec, buffer, values, error); + return fl_standard_message_codec_write_value(codec, buffer, value, error); } static gboolean -pigeon_example_package_message_codec_write_pigeon_example_package_code( - FlStandardMessageCodec* codec, GByteArray* buffer, FlValue* value, - GError** error) { +pigeon_example_package_message_codec_write_pigeon_example_package_message_data( + FlStandardMessageCodec* codec, GByteArray* buffer, + PigeonExamplePackageMessageData* value, GError** error) { uint8_t type = 130; g_byte_array_append(buffer, &type, sizeof(uint8_t)); - return fl_standard_message_codec_write_value(codec, buffer, value, error); + g_autoptr(FlValue) values = + pigeon_example_package_message_data_to_list(value); + return fl_standard_message_codec_write_value(codec, buffer, values, error); } static gboolean pigeon_example_package_message_codec_write_value( @@ -157,17 +157,17 @@ static gboolean pigeon_example_package_message_codec_write_value( if (fl_value_get_type(value) == FL_VALUE_TYPE_CUSTOM) { switch (fl_value_get_custom_type(value)) { case 129: - return pigeon_example_package_message_codec_write_pigeon_example_package_message_data( - codec, buffer, - PIGEON_EXAMPLE_PACKAGE_MESSAGE_DATA( - fl_value_get_custom_value_object(value)), - error); - case 130: return pigeon_example_package_message_codec_write_pigeon_example_package_code( codec, buffer, reinterpret_cast( const_cast(fl_value_get_custom_value(value))), error); + case 130: + return pigeon_example_package_message_codec_write_pigeon_example_package_message_data( + codec, buffer, + PIGEON_EXAMPLE_PACKAGE_MESSAGE_DATA( + fl_value_get_custom_value_object(value)), + error); } } @@ -176,6 +176,15 @@ static gboolean pigeon_example_package_message_codec_write_value( ->write_value(codec, buffer, value, error); } +static FlValue* +pigeon_example_package_message_codec_read_pigeon_example_package_code( + FlStandardMessageCodec* codec, GBytes* buffer, size_t* offset, + GError** error) { + return fl_value_new_custom( + 129, fl_standard_message_codec_read_value(codec, buffer, offset, error), + (GDestroyNotify)fl_value_unref); +} + static FlValue* pigeon_example_package_message_codec_read_pigeon_example_package_message_data( FlStandardMessageCodec* codec, GBytes* buffer, size_t* offset, @@ -194,16 +203,7 @@ pigeon_example_package_message_codec_read_pigeon_example_package_message_data( return nullptr; } - return fl_value_new_custom_object(129, G_OBJECT(value)); -} - -static FlValue* -pigeon_example_package_message_codec_read_pigeon_example_package_code( - FlStandardMessageCodec* codec, GBytes* buffer, size_t* offset, - GError** error) { - return fl_value_new_custom( - 130, fl_standard_message_codec_read_value(codec, buffer, offset, error), - (GDestroyNotify)fl_value_unref); + return fl_value_new_custom_object(130, G_OBJECT(value)); } static FlValue* pigeon_example_package_message_codec_read_value_of_type( @@ -211,10 +211,10 @@ static FlValue* pigeon_example_package_message_codec_read_value_of_type( GError** error) { switch (type) { case 129: - return pigeon_example_package_message_codec_read_pigeon_example_package_message_data( + return pigeon_example_package_message_codec_read_pigeon_example_package_code( codec, buffer, offset, error); case 130: - return pigeon_example_package_message_codec_read_pigeon_example_package_code( + return pigeon_example_package_message_codec_read_pigeon_example_package_message_data( codec, buffer, offset, error); default: return FL_STANDARD_MESSAGE_CODEC_CLASS( diff --git a/packages/pigeon/example/app/macos/Runner/messages.g.m b/packages/pigeon/example/app/macos/Runner/messages.g.m index 1471345b880..cdf19a2849b 100644 --- a/packages/pigeon/example/app/macos/Runner/messages.g.m +++ b/packages/pigeon/example/app/macos/Runner/messages.g.m @@ -71,8 +71,8 @@ + (PGNMessageData *)fromList:(NSArray *)list { PGNMessageData *pigeonResult = [[PGNMessageData alloc] init]; pigeonResult.name = GetNullableObjectAtIndex(list, 0); pigeonResult.description = GetNullableObjectAtIndex(list, 1); - PGNCodeBox *enumBox = GetNullableObjectAtIndex(list, 2); - pigeonResult.code = enumBox.value; + PGNCodeBox *boxedPGNCode = GetNullableObjectAtIndex(list, 2); + pigeonResult.code = boxedPGNCode.value; pigeonResult.data = GetNullableObjectAtIndex(list, 3); return pigeonResult; } @@ -94,13 +94,13 @@ @interface PGNMessagesPigeonCodecReader : FlutterStandardReader @implementation PGNMessagesPigeonCodecReader - (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 129: - return [PGNMessageData fromList:[self readValue]]; - case 130: { + case 129: { NSNumber *enumAsNumber = [self readValue]; return enumAsNumber == nil ? nil : [[PGNCodeBox alloc] initWithValue:[enumAsNumber integerValue]]; } + case 130: + return [PGNMessageData fromList:[self readValue]]; default: return [super readValueOfType:type]; } @@ -111,13 +111,13 @@ @interface PGNMessagesPigeonCodecWriter : FlutterStandardWriter @end @implementation PGNMessagesPigeonCodecWriter - (void)writeValue:(id)value { - if ([value isKindOfClass:[PGNMessageData class]]) { - [self writeByte:129]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[PGNCodeBox class]]) { + if ([value isKindOfClass:[PGNCodeBox class]]) { PGNCodeBox *box = (PGNCodeBox *)value; - [self writeByte:130]; + [self writeByte:129]; [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; + } else if ([value isKindOfClass:[PGNMessageData class]]) { + [self writeByte:130]; + [self writeValue:[value toList]]; } else { [super writeValue:value]; } diff --git a/packages/pigeon/example/app/windows/runner/messages.g.cpp b/packages/pigeon/example/app/windows/runner/messages.g.cpp index 7a43ec397a3..f1643f87edc 100644 --- a/packages/pigeon/example/app/windows/runner/messages.g.cpp +++ b/packages/pigeon/example/app/windows/runner/messages.g.cpp @@ -102,15 +102,12 @@ MessageData MessageData::FromEncodableList(const EncodableList& list) { return decoded; } -PigeonCodecSerializer::PigeonCodecSerializer() {} +PigeonInternalCodecSerializer::PigeonInternalCodecSerializer() {} -EncodableValue PigeonCodecSerializer::ReadValueOfType( +EncodableValue PigeonInternalCodecSerializer::ReadValueOfType( uint8_t type, flutter::ByteStreamReader* stream) const { switch (type) { - case 129: - return CustomEncodableValue(MessageData::FromEncodableList( - std::get(ReadValue(stream)))); - case 130: { + case 129: { const auto& encodable_enum_arg = ReadValue(stream); const int64_t enum_arg_value = encodable_enum_arg.IsNull() ? 0 : encodable_enum_arg.LongValue(); @@ -118,27 +115,31 @@ EncodableValue PigeonCodecSerializer::ReadValueOfType( ? EncodableValue() : CustomEncodableValue(static_cast(enum_arg_value)); } + case 130: { + return CustomEncodableValue(MessageData::FromEncodableList( + std::get(ReadValue(stream)))); + } default: return flutter::StandardCodecSerializer::ReadValueOfType(type, stream); } } -void PigeonCodecSerializer::WriteValue( +void PigeonInternalCodecSerializer::WriteValue( const EncodableValue& value, flutter::ByteStreamWriter* stream) const { if (const CustomEncodableValue* custom_value = std::get_if(&value)) { - if (custom_value->type() == typeid(MessageData)) { + if (custom_value->type() == typeid(Code)) { stream->WriteByte(129); WriteValue( - EncodableValue( - std::any_cast(*custom_value).ToEncodableList()), + EncodableValue(static_cast(std::any_cast(*custom_value))), stream); return; } - if (custom_value->type() == typeid(Code)) { + if (custom_value->type() == typeid(MessageData)) { stream->WriteByte(130); WriteValue( - EncodableValue(static_cast(std::any_cast(*custom_value))), + EncodableValue( + std::any_cast(*custom_value).ToEncodableList()), stream); return; } @@ -149,7 +150,7 @@ void PigeonCodecSerializer::WriteValue( /// The codec used by ExampleHostApi. const flutter::StandardMessageCodec& ExampleHostApi::GetCodec() { return flutter::StandardMessageCodec::GetInstance( - &PigeonCodecSerializer::GetInstance()); + &PigeonInternalCodecSerializer::GetInstance()); } // Sets up an instance of `ExampleHostApi` to handle messages through the @@ -298,7 +299,7 @@ MessageFlutterApi::MessageFlutterApi(flutter::BinaryMessenger* binary_messenger, const flutter::StandardMessageCodec& MessageFlutterApi::GetCodec() { return flutter::StandardMessageCodec::GetInstance( - &PigeonCodecSerializer::GetInstance()); + &PigeonInternalCodecSerializer::GetInstance()); } void MessageFlutterApi::FlutterMethod( diff --git a/packages/pigeon/example/app/windows/runner/messages.g.h b/packages/pigeon/example/app/windows/runner/messages.g.h index 3218b702d9b..7e0e261eb0c 100644 --- a/packages/pigeon/example/app/windows/runner/messages.g.h +++ b/packages/pigeon/example/app/windows/runner/messages.g.h @@ -90,18 +90,18 @@ class MessageData { flutter::EncodableList ToEncodableList() const; friend class ExampleHostApi; friend class MessageFlutterApi; - friend class PigeonCodecSerializer; + friend class PigeonInternalCodecSerializer; std::optional name_; std::optional description_; Code code_; flutter::EncodableMap data_; }; -class PigeonCodecSerializer : public flutter::StandardCodecSerializer { +class PigeonInternalCodecSerializer : public flutter::StandardCodecSerializer { public: - PigeonCodecSerializer(); - inline static PigeonCodecSerializer& GetInstance() { - static PigeonCodecSerializer sInstance; + PigeonInternalCodecSerializer(); + inline static PigeonInternalCodecSerializer& GetInstance() { + static PigeonInternalCodecSerializer sInstance; return sInstance; } diff --git a/packages/pigeon/lib/ast.dart b/packages/pigeon/lib/ast.dart index b3469b03295..8151ef9f092 100644 --- a/packages/pigeon/lib/ast.dart +++ b/packages/pigeon/lib/ast.dart @@ -4,6 +4,7 @@ import 'package:collection/collection.dart' show ListEquality; import 'package:meta/meta.dart'; +import 'generator_tools.dart'; import 'pigeon_lib.dart'; typedef _ListEquals = bool Function(List, List); @@ -755,6 +756,11 @@ class Root extends Node { /// All of the enums contained in the AST. List enums; + /// Returns true if the number of custom types would exceed the available enumerations + /// on the standard codec. + bool get requiresOverflowClass => + classes.length + enums.length >= totalCustomCodecKeysAllowed; + @override String toString() { return '(Root classes:$classes apis:$apis enums:$enums)'; diff --git a/packages/pigeon/lib/cpp_generator.dart b/packages/pigeon/lib/cpp_generator.dart index b8d1fbb5d23..425c5a29768 100644 --- a/packages/pigeon/lib/cpp_generator.dart +++ b/packages/pigeon/lib/cpp_generator.dart @@ -21,7 +21,25 @@ const DocumentCommentSpecification _docCommentSpec = const String _standardCodecSerializer = 'flutter::StandardCodecSerializer'; /// The name of the codec serializer. -const String _codecSerializerName = 'PigeonCodecSerializer'; +const String _codecSerializerName = '${classNamePrefix}CodecSerializer'; + +const String _overflowClassName = '${classNamePrefix}CodecOverflow'; + +final NamedType _overflowType = NamedType( + name: 'type', + type: const TypeDeclaration(baseName: 'int', isNullable: false)); +final NamedType _overflowObject = NamedType( + name: 'wrapped', + type: const TypeDeclaration(baseName: 'Object', isNullable: false)); +final List _overflowFields = [ + _overflowType, + _overflowObject, +]; +final Class _overflowClass = + Class(name: _overflowClassName, fields: _overflowFields); +final EnumeratedType _enumeratedOverflow = EnumeratedType( + _overflowClassName, maximumCodecFieldKey, CustomTypes.customClass, + associatedClass: _overflowClass); /// Options that control how C++ code will be generated. class CppOptions { @@ -216,6 +234,32 @@ class CppHeaderGenerator extends StructuredGenerator { } } + @override + void writeDataClasses( + CppOptions generatorOptions, + Root root, + Indent indent, { + required String dartPackageName, + }) { + indent.newln(); + super.writeDataClasses( + generatorOptions, + root, + indent, + dartPackageName: dartPackageName, + ); + if (root.requiresOverflowClass) { + writeDataClass( + generatorOptions, + root, + indent, + _overflowClass, + dartPackageName: dartPackageName, + isOverflowClass: true, + ); + } + } + @override void writeDataClass( CppOptions generatorOptions, @@ -223,6 +267,7 @@ class CppHeaderGenerator extends StructuredGenerator { Indent indent, Class classDefinition, { required String dartPackageName, + bool isOverflowClass = false, }) { // When generating for a Pigeon unit test, add a test fixture friend class to // allow unit testing private methods, since testing serialization via public @@ -319,11 +364,20 @@ class CppHeaderGenerator extends StructuredGenerator { _writeAccessBlock(indent, _ClassAccess.private, () { _writeFunctionDeclaration(indent, 'FromEncodableList', - returnType: classDefinition.name, + returnType: isOverflowClass + ? 'flutter::EncodableValue' + : classDefinition.name, parameters: ['const flutter::EncodableList& list'], isStatic: true); _writeFunctionDeclaration(indent, 'ToEncodableList', returnType: 'flutter::EncodableList', isConst: true); + if (isOverflowClass) { + _writeFunctionDeclaration(indent, 'Unwrap', + returnType: 'flutter::EncodableValue'); + } + if (!isOverflowClass && root.requiresOverflowClass) { + indent.writeln('friend class $_overflowClassName;'); + } for (final Class friend in root.classes) { if (friend != classDefinition && friend.fields.any((NamedType element) => @@ -360,6 +414,7 @@ class CppHeaderGenerator extends StructuredGenerator { Indent indent, { required String dartPackageName, }) { + indent.newln(); indent.write( 'class $_codecSerializerName : public $_standardCodecSerializer '); indent.addScoped('{', '};', () { @@ -875,6 +930,72 @@ class CppSourceGenerator extends StructuredGenerator { }); } + void _writeCodecOverflowUtilities( + CppOptions generatorOptions, + Root root, + Indent indent, + List types, { + required String dartPackageName, + }) { + _writeClassConstructor(root, indent, _overflowClass, _overflowFields); + // Getters and setters. + for (final NamedType field in _overflowFields) { + _writeCppSourceClassField( + generatorOptions, root, indent, _overflowClass, field); + } + // Serialization. + writeClassEncode( + generatorOptions, + root, + indent, + _overflowClass, + dartPackageName: dartPackageName, + ); + + indent.format(''' +EncodableValue $_overflowClassName::FromEncodableList( + const EncodableList& list) { + return $_overflowClassName(list[0].LongValue(), + list[1].IsNull() ? EncodableValue() : list[1]) + .Unwrap(); +}'''); + + indent.writeScoped('EncodableValue $_overflowClassName::Unwrap() {', '}', + () { + indent.writeScoped('if (wrapped_.IsNull()) {', '}', () { + indent.writeln('return EncodableValue();'); + }); + indent.writeScoped('switch(type_) {', '}', () { + for (int i = totalCustomCodecKeysAllowed; i < types.length; i++) { + indent.write('case ${types[i].enumeration - maximumCodecFieldKey}: '); + _writeCodecDecode(indent, types[i], 'wrapped_'); + } + }); + indent.writeln('return EncodableValue();'); + }); + } + + void _writeCodecDecode( + Indent indent, EnumeratedType customType, String value) { + indent.addScoped('{', '}', () { + if (customType.type == CustomTypes.customClass) { + if (customType.name == _overflowClassName) { + indent.writeln( + 'return ${customType.name}::FromEncodableList(std::get($value));'); + } else { + indent.writeln( + 'return CustomEncodableValue(${customType.name}::FromEncodableList(std::get($value)));'); + } + } else if (customType.type == CustomTypes.customEnum) { + indent.writeln('const auto& encodable_enum_arg = $value;'); + indent.writeln( + 'const int64_t enum_arg_value = encodable_enum_arg.IsNull() ? 0 : encodable_enum_arg.LongValue();'); + indent.writeln( + 'return encodable_enum_arg.IsNull() ? EncodableValue() : CustomEncodableValue(static_cast<${customType.name}>(enum_arg_value));'); + } + }); + } + @override void writeGeneralCodec( CppOptions generatorOptions, @@ -882,8 +1003,14 @@ class CppSourceGenerator extends StructuredGenerator { Indent indent, { required String dartPackageName, }) { - final Iterable customTypes = getEnumeratedTypes(root); + final List enumeratedTypes = + getEnumeratedTypes(root).toList(); indent.newln(); + if (root.requiresOverflowClass) { + _writeCodecOverflowUtilities( + generatorOptions, root, indent, enumeratedTypes, + dartPackageName: dartPackageName); + } _writeFunctionDefinition(indent, _codecSerializerName, scope: _codecSerializerName); _writeFunctionDefinition(indent, 'ReadValueOfType', @@ -894,33 +1021,27 @@ class CppSourceGenerator extends StructuredGenerator { 'flutter::ByteStreamReader* stream', ], isConst: true, body: () { - if (customTypes.isNotEmpty) { + if (enumeratedTypes.isNotEmpty) { indent.writeln('switch (type) {'); indent.inc(); - for (final EnumeratedType customType in customTypes) { - indent.writeln('case ${customType.enumeration}:'); - indent.nest(1, () { - if (customType.type == CustomTypes.customClass) { - indent.writeln( - 'return CustomEncodableValue(${customType.name}::FromEncodableList(std::get(ReadValue(stream))));'); - } else if (customType.type == CustomTypes.customEnum) { - indent.writeScoped('{', '}', () { - indent.writeln( - 'const auto& encodable_enum_arg = ReadValue(stream);'); - indent.writeln( - 'const int64_t enum_arg_value = encodable_enum_arg.IsNull() ? 0 : encodable_enum_arg.LongValue();'); - indent.writeln( - 'return encodable_enum_arg.IsNull() ? EncodableValue() : CustomEncodableValue(static_cast<${customType.name}>(enum_arg_value));'); - }); - } - }); + for (final EnumeratedType customType in enumeratedTypes) { + if (customType.enumeration < maximumCodecFieldKey) { + indent.write('case ${customType.enumeration}: '); + indent.nest(1, () { + _writeCodecDecode(indent, customType, 'ReadValue(stream)'); + }); + } + } + if (root.requiresOverflowClass) { + indent.write('case $maximumCodecFieldKey:'); + _writeCodecDecode(indent, _enumeratedOverflow, 'ReadValue(stream)'); } indent.writeln('default:'); indent.inc(); } indent.writeln( 'return $_standardCodecSerializer::ReadValueOfType(type, stream);'); - if (customTypes.isNotEmpty) { + if (enumeratedTypes.isNotEmpty) { indent.dec(); indent.writeln('}'); indent.dec(); @@ -934,22 +1055,33 @@ class CppSourceGenerator extends StructuredGenerator { 'flutter::ByteStreamWriter* stream', ], isConst: true, body: () { - if (customTypes.isNotEmpty) { + if (enumeratedTypes.isNotEmpty) { indent.write( 'if (const CustomEncodableValue* custom_value = std::get_if(&value)) '); indent.addScoped('{', '}', () { - for (final EnumeratedType customType in customTypes) { + for (final EnumeratedType customType in enumeratedTypes) { + final String encodeString = customType.type == + CustomTypes.customClass + ? 'std::any_cast<${customType.name}>(*custom_value).ToEncodableList()' + : 'static_cast(std::any_cast<${customType.name}>(*custom_value))'; + final String valueString = + customType.enumeration < maximumCodecFieldKey + ? encodeString + : 'wrap.ToEncodableList()'; + final int enumeration = + customType.enumeration < maximumCodecFieldKey + ? customType.enumeration + : maximumCodecFieldKey; indent.write( 'if (custom_value->type() == typeid(${customType.name})) '); indent.addScoped('{', '}', () { - indent.writeln('stream->WriteByte(${customType.enumeration});'); - if (customType.type == CustomTypes.customClass) { - indent.writeln( - 'WriteValue(EncodableValue(std::any_cast<${customType.name}>(*custom_value).ToEncodableList()), stream);'); - } else if (customType.type == CustomTypes.customEnum) { + indent.writeln('stream->WriteByte($enumeration);'); + if (enumeration == maximumCodecFieldKey) { indent.writeln( - 'WriteValue(EncodableValue(static_cast(std::any_cast<${customType.name}>(*custom_value))), stream);'); + 'const auto wrap = $_overflowClassName(${customType.enumeration - maximumCodecFieldKey}, $encodeString);'); } + indent + .writeln('WriteValue(EncodableValue($valueString), stream);'); indent.writeln('return;'); }); } diff --git a/packages/pigeon/lib/dart_generator.dart b/packages/pigeon/lib/dart_generator.dart index b5c0e42d365..df9f3175929 100644 --- a/packages/pigeon/lib/dart_generator.dart +++ b/packages/pigeon/lib/dart_generator.dart @@ -32,6 +32,8 @@ const DocumentCommentSpecification _docCommentSpec = /// The custom codec used for all pigeon APIs. const String _pigeonCodec = '_PigeonCodec'; +const String _overflowClassName = '_PigeonCodecOverflow'; + /// Options that control how Dart code will be generated. class DartOptions { /// Constructor for DartOptions. @@ -283,8 +285,56 @@ class DartGenerator extends StructuredGenerator { Indent indent, { required String dartPackageName, }) { + void writeEncodeLogic(EnumeratedType customType) { + indent.writeScoped('if (value is ${customType.name}) {', '} else ', () { + if (customType.enumeration < maximumCodecFieldKey) { + indent.writeln('buffer.putUint8(${customType.enumeration});'); + if (customType.type == CustomTypes.customClass) { + indent.writeln('writeValue(buffer, value.encode());'); + } else if (customType.type == CustomTypes.customEnum) { + indent.writeln('writeValue(buffer, value.index);'); + } + } else { + final String encodeString = customType.type == CustomTypes.customClass + ? '.encode()' + : '.index'; + indent.writeln( + 'final $_overflowClassName wrap = $_overflowClassName(type: ${customType.enumeration - maximumCodecFieldKey}, wrapped: value$encodeString);'); + indent.writeln('buffer.putUint8($maximumCodecFieldKey);'); + indent.writeln('writeValue(buffer, wrap.encode());'); + } + }, addTrailingNewline: false); + } + + void writeDecodeLogic(EnumeratedType customType) { + indent.writeln('case ${customType.enumeration}: '); + indent.nest(1, () { + if (customType.type == CustomTypes.customClass) { + if (customType.enumeration == maximumCodecFieldKey) { + indent.writeln( + 'final ${customType.name} wrapper = ${customType.name}.decode(readValue(buffer)!);'); + indent.writeln('return wrapper.unwrap();'); + } else { + indent.writeln( + 'return ${customType.name}.decode(readValue(buffer)!);'); + } + } else if (customType.type == CustomTypes.customEnum) { + indent.writeln('final int? value = readValue(buffer) as int?;'); + indent.writeln( + 'return value == null ? null : ${customType.name}.values[value];'); + } + }); + } + + final EnumeratedType overflowClass = EnumeratedType( + _overflowClassName, maximumCodecFieldKey, CustomTypes.customClass); + indent.newln(); - final Iterable enumeratedTypes = getEnumeratedTypes(root); + final List enumeratedTypes = + getEnumeratedTypes(root).toList(); + if (root.requiresOverflowClass) { + _writeCodecOverflowUtilities(indent, enumeratedTypes); + } indent.newln(); indent.write('class $_pigeonCodec extends StandardMessageCodec'); indent.addScoped(' {', '}', () { @@ -295,15 +345,7 @@ class DartGenerator extends StructuredGenerator { indent.addScoped('{', '}', () { enumerate(enumeratedTypes, (int index, final EnumeratedType customType) { - indent.writeScoped('if (value is ${customType.name}) {', '} else ', - () { - indent.writeln('buffer.putUint8(${customType.enumeration});'); - if (customType.type == CustomTypes.customClass) { - indent.writeln('writeValue(buffer, value.encode());'); - } else if (customType.type == CustomTypes.customEnum) { - indent.writeln('writeValue(buffer, value.index);'); - } - }, addTrailingNewline: false); + writeEncodeLogic(customType); }); indent.addScoped('{', '}', () { indent.writeln('super.writeValue(buffer, value);'); @@ -316,18 +358,12 @@ class DartGenerator extends StructuredGenerator { indent.write('switch (type) '); indent.addScoped('{', '}', () { for (final EnumeratedType customType in enumeratedTypes) { - indent.writeln('case ${customType.enumeration}: '); - indent.nest(1, () { - if (customType.type == CustomTypes.customClass) { - indent.writeln( - 'return ${customType.name}.decode(readValue(buffer)!);'); - } else if (customType.type == CustomTypes.customEnum) { - indent - .writeln('final int? value = readValue(buffer) as int?;'); - indent.writeln( - 'return value == null ? null : ${customType.name}.values[value];'); - } - }); + if (customType.enumeration < maximumCodecFieldKey) { + writeDecodeLogic(customType); + } + } + if (root.requiresOverflowClass) { + writeDecodeLogic(overflowClass); } indent.writeln('default:'); indent.nest(1, () { @@ -720,7 +756,7 @@ final BinaryMessenger? ${varNamePrefix}binaryMessenger; // Each API has a private codec instance used by every host method, // constructor, or non-static field. - final String codecInstanceName = '${varNamePrefix}codec${api.name}'; + final String codecInstanceName = '_${varNamePrefix}codec${api.name}'; // AST class used by code_builder to generate the code. final cb.Class proxyApi = cb.Class( @@ -955,6 +991,52 @@ PlatformException _createConnectionError(String channelName) { }'''); } + void _writeCodecOverflowUtilities(Indent indent, List types) { + indent.newln(); + indent.writeln('// ignore: camel_case_types'); + indent.writeScoped('class $_overflowClassName {', '}', () { + indent.format(''' +$_overflowClassName({required this.type, required this.wrapped}); + +int type; +Object? wrapped; + +Object encode() { + return [type, wrapped]; +} + +static $_overflowClassName decode(Object result) { + result as List; + return $_overflowClassName( + type: result[0]! as int, + wrapped: result[1], + ); +} +'''); + indent.writeScoped('Object? unwrap() {', '}', () { + indent.format(''' +if (wrapped == null) { + return null; +} +'''); + indent.writeScoped('switch (type) {', '}', () { + for (int i = totalCustomCodecKeysAllowed; i < types.length; i++) { + indent.writeScoped('case ${i - totalCustomCodecKeysAllowed}:', '', + () { + if (types[i].type == CustomTypes.customClass) { + indent.writeln('return ${types[i].name}.decode(wrapped!);'); + } else if (types[i].type == CustomTypes.customEnum) { + indent.writeln( + 'return ${types[i].name}.values[wrapped! as int];'); + } + }); + } + }); + indent.writeln('return null;'); + }); + }); + } + void _writeHostMethod( Indent indent, { required String name, @@ -1812,8 +1894,8 @@ if (${varNamePrefix}replyList == null) { if (!field.isStatic) ...[ cb.Code( 'final $type $instanceName = $type.${classMemberNamePrefix}detached(\n' - ' pigeon_binaryMessenger: pigeon_binaryMessenger,\n' - ' pigeon_instanceManager: pigeon_instanceManager,\n' + ' ${classMemberNamePrefix}binaryMessenger: ${classMemberNamePrefix}binaryMessenger,\n' + ' ${classMemberNamePrefix}instanceManager: ${classMemberNamePrefix}instanceManager,\n' ');', ), cb.Code('final $codecName $_pigeonChannelCodec =\n' diff --git a/packages/pigeon/lib/generator_tools.dart b/packages/pigeon/lib/generator_tools.dart index 8771001ca6a..0f02dd980d7 100644 --- a/packages/pigeon/lib/generator_tools.dart +++ b/packages/pigeon/lib/generator_tools.dart @@ -13,13 +13,7 @@ import 'ast.dart'; /// The current version of pigeon. /// /// This must match the version in pubspec.yaml. -const String pigeonVersion = '21.1.0'; - -/// Prefix for all local variables in methods. -/// -/// This lowers the chances of variable name collisions with -/// user defined parameters. -const String varNamePrefix = '__pigeon_'; +const String pigeonVersion = '21.2.0'; /// Read all the content from [stdin] to a String. String readStdin() { @@ -102,8 +96,6 @@ class Indent { bool addTrailingNewline = true, int nestCount = 1, }) { - assert(begin != '' || end != '', - 'Use nest for indentation without any decoration'); if (begin != null) { _sink.write(begin + newline); } @@ -123,8 +115,6 @@ class Indent { Function func, { bool addTrailingNewline = true, }) { - assert(begin != '' || end != '', - 'Use nest for indentation without any decoration'); addScoped(str() + (begin ?? ''), end, func, addTrailingNewline: addTrailingNewline); } @@ -301,11 +291,11 @@ String getGeneratedCodeWarning() { /// String to be printed after `getGeneratedCodeWarning()'s warning`. const String seeAlsoWarning = 'See also: https://pub.dev/packages/pigeon'; -/// Prefix for utility classes generated for ProxyApis. +/// Prefix for generated internal classes. /// /// This lowers the chances of variable name collisions with user defined /// parameters. -const String classNamePrefix = 'Pigeon'; +const String classNamePrefix = 'PigeonInternal'; /// Name for the generated InstanceManager for ProxyApis. /// @@ -319,6 +309,20 @@ const String instanceManagerClassName = '${classNamePrefix}InstanceManager'; /// parameters. const String classMemberNamePrefix = 'pigeon_'; +/// Prefix for variable names not defined by the user. +/// +/// This lowers the chances of variable name collisions with user defined +/// parameters. +const String varNamePrefix = 'pigeonVar_'; + +/// Prefixes that are not allowed for any names of any types or methods. +const List disallowedPrefixes = [ + classNamePrefix, + classMemberNamePrefix, + varNamePrefix, + 'pigeonChannelCodec' +]; + /// Collection of keys used in dictionaries across generators. class Keys { /// The key in the result hash for the 'result' value. @@ -418,9 +422,16 @@ const List validTypes = [ 'Object', ]; -/// Custom codecs' custom types are enumerated from 255 down to this number to +/// Custom codecs' custom types are enumerations begin at this number to /// avoid collisions with the StandardMessageCodec. -const int _minimumCodecFieldKey = 129; +const int minimumCodecFieldKey = 129; + +/// The maximum codec enumeration allowed. +const int maximumCodecFieldKey = 255; + +/// The total number of keys allowed in the custom codec. +const int totalCustomCodecKeysAllowed = + maximumCodecFieldKey - minimumCodecFieldKey; Iterable _getTypeArguments(TypeDeclaration type) sync* { for (final TypeDeclaration typeArg in type.typeArguments) { @@ -516,31 +527,33 @@ enum CustomTypes { /// Return the enumerated types that must exist in the codec /// where the enumeration should be the key used in the buffer. Iterable getEnumeratedTypes(Root root) sync* { - const int maxCustomClassesPerApi = 255 - _minimumCodecFieldKey; - if (root.classes.length + root.enums.length > maxCustomClassesPerApi) { - throw Exception( - "Pigeon doesn't currently support more than $maxCustomClassesPerApi referenced custom classes per file."); - } int index = 0; - for (final Class customClass in root.classes) { - yield EnumeratedType( - customClass.name, - index + _minimumCodecFieldKey, - CustomTypes.customClass, - associatedClass: customClass, - ); - index += 1; - } for (final Enum customEnum in root.enums) { yield EnumeratedType( customEnum.name, - index + _minimumCodecFieldKey, + index + minimumCodecFieldKey, CustomTypes.customEnum, associatedEnum: customEnum, ); index += 1; } + + for (final Class customClass in root.classes) { + yield EnumeratedType( + customClass.name, + index + minimumCodecFieldKey, + CustomTypes.customClass, + associatedClass: customClass, + ); + index += 1; + } +} + +/// Checks if [root] contains enough custom types to require overflow codec tools. +bool customTypeOverflowCheck(Root root) { + return root.classes.length + root.enums.length > + maximumCodecFieldKey - minimumCodecFieldKey; } /// Describes how to format a document comment. @@ -708,3 +721,11 @@ String toUpperCamelCase(String text) { : word.substring(0, 1).toUpperCase() + word.substring(1); }).join(); } + +/// Converts string to SCREAMING_SNAKE_CASE. +String toScreamingSnakeCase(String string) { + return string + .replaceAllMapped( + RegExp(r'(?<=[a-z])[A-Z]'), (Match m) => '_${m.group(0)}') + .toUpperCase(); +} diff --git a/packages/pigeon/lib/java_generator.dart b/packages/pigeon/lib/java_generator.dart index 329bf37dab0..1d4c83d6003 100644 --- a/packages/pigeon/lib/java_generator.dart +++ b/packages/pigeon/lib/java_generator.dart @@ -28,6 +28,11 @@ const DocumentCommentSpecification _docCommentSpec = /// The standard codec for Flutter, used for any non custom codecs and extended for custom codecs. const String _codecName = 'PigeonCodec'; +const String _overflowClassName = '${classNamePrefix}CodecOverflow'; + +// Used to create classes with type Int rather than long. +const String _forceInt = '${varNamePrefix}forceInt'; + /// Options that control how Java code will be generated. class JavaOptions { /// Creates a [JavaOptions] object @@ -195,7 +200,7 @@ class JavaGenerator extends StructuredGenerator { // SyntheticAccessor warnings in the serialization code. indent.writeln('final int index;'); indent.newln(); - indent.write('private ${anEnum.name}(final int index) '); + indent.write('${anEnum.name}(final int index) '); indent.addScoped('{', '}', () { indent.writeln('this.index = index;'); }); @@ -218,14 +223,7 @@ class JavaGenerator extends StructuredGenerator { indent, classDefinition.documentationComments, _docCommentSpec, generatorComments: generatedMessages); - indent.write('public static final class ${classDefinition.name} '); - indent.addScoped('{', '}', () { - for (final NamedType field - in getFieldsInSerializationOrder(classDefinition)) { - _writeClassField(generatorOptions, root, indent, field); - indent.newln(); - } - + _writeDataClassSignature(generatorOptions, indent, classDefinition, () { if (getFieldsInSerializationOrder(classDefinition) .map((NamedType e) => !e.type.isNullable) .any((bool e) => e)) { @@ -255,26 +253,34 @@ class JavaGenerator extends StructuredGenerator { } void _writeClassField( - JavaOptions generatorOptions, Root root, Indent indent, NamedType field) { + JavaOptions generatorOptions, + Indent indent, + NamedType field, { + bool isPrimitive = false, + }) { final HostDatatype hostDatatype = getFieldHostDatatype( field, (TypeDeclaration x) => _javaTypeForBuiltinDartType(x)); - final String nullability = field.type.isNullable ? '@Nullable' : '@NonNull'; + final String nullability = isPrimitive + ? '' + : field.type.isNullable + ? '@Nullable ' + : '@NonNull '; addDocumentationComments( indent, field.documentationComments, _docCommentSpec); - indent.writeln( - 'private $nullability ${hostDatatype.datatype} ${field.name};'); + indent + .writeln('private $nullability${hostDatatype.datatype} ${field.name};'); indent.newln(); indent.write( - 'public $nullability ${hostDatatype.datatype} ${_makeGetter(field)}() '); + 'public $nullability${hostDatatype.datatype} ${_makeGetter(field)}() '); indent.addScoped('{', '}', () { indent.writeln('return ${field.name};'); }); indent.newln(); indent.writeScoped( - 'public void ${_makeSetter(field)}($nullability ${hostDatatype.datatype} setterArg) {', + 'public void ${_makeSetter(field)}($nullability${hostDatatype.datatype} setterArg) {', '}', () { - if (!field.type.isNullable) { + if (!field.type.isNullable && !isPrimitive) { indent.writeScoped('if (setterArg == null) {', '}', () { indent.writeln( 'throw new IllegalStateException("Nonnull field \\"${field.name}\\" is null.");'); @@ -284,6 +290,30 @@ class JavaGenerator extends StructuredGenerator { }); } + void _writeDataClassSignature( + JavaOptions generatorOptions, + Indent indent, + Class classDefinition, + void Function() dataClassBody, { + bool private = false, + }) { + indent.write( + '${private ? 'private' : 'public'} static final class ${classDefinition.name} '); + indent.addScoped('{', '}', () { + for (final NamedType field + in getFieldsInSerializationOrder(classDefinition)) { + _writeClassField( + generatorOptions, + indent, + field, + isPrimitive: field.type.baseName == _forceInt, + ); + indent.newln(); + } + dataClassBody(); + }); + } + void _writeEquality(Indent indent, Class classDefinition) { // Implement equals(...). indent.writeln('@Override'); @@ -394,7 +424,7 @@ class JavaGenerator extends StructuredGenerator { indent.write('ArrayList toList() '); indent.addScoped('{', '}', () { indent.writeln( - 'ArrayList toListResult = new ArrayList(${classDefinition.fields.length});'); + 'ArrayList toListResult = new ArrayList<>(${classDefinition.fields.length});'); for (final NamedType field in getFieldsInSerializationOrder(classDefinition)) { indent.writeln('toListResult.add(${field.name});'); @@ -438,7 +468,66 @@ class JavaGenerator extends StructuredGenerator { Indent indent, { required String dartPackageName, }) { - final Iterable enumeratedTypes = getEnumeratedTypes(root); + final List enumeratedTypes = + getEnumeratedTypes(root).toList(); + + void writeEncodeLogic(EnumeratedType customType) { + final String encodeString = + customType.type == CustomTypes.customClass ? 'toList()' : 'index'; + final String nullCheck = customType.type == CustomTypes.customEnum + ? 'value == null ? null : ' + : ''; + final String valueString = customType.enumeration < maximumCodecFieldKey + ? '$nullCheck((${customType.name}) value).$encodeString' + : 'wrap.toList()'; + final int enumeration = customType.enumeration < maximumCodecFieldKey + ? customType.enumeration + : maximumCodecFieldKey; + + indent.add('if (value instanceof ${customType.name}) '); + indent.addScoped('{', '} else ', () { + if (customType.enumeration >= maximumCodecFieldKey) { + indent + .writeln('$_overflowClassName wrap = new $_overflowClassName();'); + indent.writeln( + 'wrap.setType(${customType.enumeration - maximumCodecFieldKey});'); + indent.writeln( + 'wrap.setWrapped($nullCheck((${customType.name}) value).$encodeString);'); + } + indent.writeln('stream.write($enumeration);'); + indent.writeln('writeValue(stream, $valueString);'); + }, addTrailingNewline: false); + } + + void writeDecodeLogic(EnumeratedType customType) { + indent.write('case (byte) ${customType.enumeration}:'); + if (customType.type == CustomTypes.customClass) { + indent.newln(); + indent.nest(1, () { + indent.writeln( + 'return ${customType.name}.fromList((ArrayList) readValue(buffer));'); + }); + } else if (customType.type == CustomTypes.customEnum) { + indent.addScoped(' {', '}', () { + indent.writeln('Object value = readValue(buffer);'); + indent + .writeln('return ${_intToEnum('value', customType.name, true)};'); + }); + } + } + + final EnumeratedType overflowClass = EnumeratedType( + _overflowClassName, maximumCodecFieldKey, CustomTypes.customClass); + + if (root.requiresOverflowClass) { + _writeCodecOverflowUtilities( + generatorOptions, + root, + indent, + enumeratedTypes, + dartPackageName: dartPackageName, + ); + } indent.newln(); indent.write( 'private static class $_codecName extends StandardMessageCodec '); @@ -449,23 +538,17 @@ class JavaGenerator extends StructuredGenerator { indent.writeln('private $_codecName() {}'); indent.newln(); indent.writeln('@Override'); - indent.write( - 'protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) '); - indent.addScoped('{', '}', () { - indent.write('switch (type) '); - indent.addScoped('{', '}', () { + indent.writeScoped( + 'protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) {', + '}', () { + indent.writeScoped('switch (type) {', '}', () { for (final EnumeratedType customType in enumeratedTypes) { - indent.writeln('case (byte) ${customType.enumeration}:'); - indent.nest(1, () { - if (customType.type == CustomTypes.customClass) { - indent.writeln( - 'return ${customType.name}.fromList((ArrayList) readValue(buffer));'); - } else if (customType.type == CustomTypes.customEnum) { - indent.writeln('Object value = readValue(buffer);'); - indent.writeln( - 'return ${_intToEnum('value', customType.name, true)};'); - } - }); + if (customType.enumeration < maximumCodecFieldKey) { + writeDecodeLogic(customType); + } + } + if (root.requiresOverflowClass) { + writeDecodeLogic(overflowClass); } indent.writeln('default:'); indent.nest(1, () { @@ -478,24 +561,8 @@ class JavaGenerator extends StructuredGenerator { indent.write( 'protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) '); indent.addScoped('{', '}', () { - bool firstClass = true; - for (final EnumeratedType customType in enumeratedTypes) { - if (firstClass) { - indent.write(''); - firstClass = false; - } - indent.add('if (value instanceof ${customType.name}) '); - indent.addScoped('{', '} else ', () { - indent.writeln('stream.write(${customType.enumeration});'); - if (customType.type == CustomTypes.customClass) { - indent.writeln( - 'writeValue(stream, ((${customType.name}) value).toList());'); - } else { - indent.writeln( - 'writeValue(stream, value == null ? null : ((${customType.name}) value).index);'); - } - }, addTrailingNewline: false); - } + indent.write(''); + enumeratedTypes.forEach(writeEncodeLogic); indent.addScoped('{', '}', () { indent.writeln('super.writeValue(stream, value);'); }); @@ -504,6 +571,75 @@ class JavaGenerator extends StructuredGenerator { indent.newln(); } + void _writeCodecOverflowUtilities( + JavaOptions generatorOptions, + Root root, + Indent indent, + List types, { + required String dartPackageName, + }) { + final NamedType overflowInteration = NamedType( + name: 'type', + type: const TypeDeclaration(baseName: _forceInt, isNullable: false)); + final NamedType overflowObject = NamedType( + name: 'wrapped', + type: const TypeDeclaration(baseName: 'Object', isNullable: true)); + final List overflowFields = [ + overflowInteration, + overflowObject, + ]; + final Class overflowClass = + Class(name: _overflowClassName, fields: overflowFields); + + _writeDataClassSignature( + generatorOptions, + indent, + overflowClass, + () { + writeClassEncode( + generatorOptions, + root, + indent, + overflowClass, + dartPackageName: dartPackageName, + ); + + indent.format(''' +static @Nullable Object fromList(@NonNull ArrayList ${varNamePrefix}list) { + $_overflowClassName wrapper = new $_overflowClassName(); + wrapper.setType((int) ${varNamePrefix}list.get(0)); + wrapper.setWrapped(${varNamePrefix}list.get(1)); + return wrapper.unwrap(); +} +'''); + + indent.writeScoped('@Nullable Object unwrap() {', '}', () { + indent.format(''' +if (wrapped == null) { + return null; +} + '''); + indent.writeScoped('switch (type) {', '}', () { + for (int i = totalCustomCodecKeysAllowed; i < types.length; i++) { + indent.writeln('case ${i - totalCustomCodecKeysAllowed}:'); + indent.nest(1, () { + if (types[i].type == CustomTypes.customClass) { + indent.writeln( + 'return ${types[i].name}.fromList((ArrayList) wrapped);'); + } else if (types[i].type == CustomTypes.customEnum) { + indent.writeln( + 'return ${types[i].name}.values()[(int) wrapped];'); + } + }); + } + }); + indent.writeln('return null;'); + }); + }, + private: true, + ); + } + /// Writes the code for a flutter [Api], [api]. /// Example: /// public static final class Foo { @@ -550,8 +686,11 @@ class JavaGenerator extends StructuredGenerator { 'this.messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix;'); }); indent.newln(); - indent.writeln('/** Public interface for sending reply. */ '); - indent.writeln('/** The codec used by ${api.name}. */'); + addDocumentationComments(indent, [], _docCommentSpec, + generatorComments: [ + 'Public interface for sending reply.', + 'The codec used by ${api.name}.' + ]); indent.write('static @NonNull MessageCodec getCodec() '); indent.addScoped('{', '}', () { indent.writeln('return $_codecName.INSTANCE;'); @@ -578,10 +717,10 @@ class JavaGenerator extends StructuredGenerator { indexMap(func.parameters, getSafeArgumentExpression); if (func.parameters.length == 1) { sendArgument = - 'new ArrayList(Collections.singletonList(${enumSafeArgNames.first}))'; + 'new ArrayList<>(Collections.singletonList(${enumSafeArgNames.first}))'; } else { sendArgument = - 'new ArrayList(Arrays.asList(${enumSafeArgNames.join(', ')}))'; + 'new ArrayList<>(Arrays.asList(${enumSafeArgNames.join(', ')}))'; } final String argsSignature = map2(argTypes, argNames, (String x, String y) => '$x $y') @@ -611,7 +750,7 @@ class JavaGenerator extends StructuredGenerator { 'List listReply = (List) channelReply;'); indent.writeScoped('if (listReply.size() > 1) {', '} ', () { indent.writeln( - 'result.error(new FlutterError((String) listReply.get(0), (String) listReply.get(1), (String) listReply.get(2)));'); + 'result.error(new FlutterError((String) listReply.get(0), (String) listReply.get(1), listReply.get(2)));'); }, addTrailingNewline: false); if (!func.returnType.isNullable && !func.returnType.isVoid) { indent.addScoped('else if (listReply.get(0) == null) {', '} ', @@ -806,8 +945,7 @@ class JavaGenerator extends StructuredGenerator { final String returnType = method.returnType.isVoid ? 'Void' : _javaTypeForDartType(method.returnType); - indent.writeln( - 'ArrayList wrapped = new ArrayList();'); + indent.writeln('ArrayList wrapped = new ArrayList<>();'); final List methodArgument = []; if (method.parameters.isNotEmpty) { indent.writeln( @@ -873,12 +1011,10 @@ $resultType $resultName = }); indent.add(' catch (Throwable exception) '); indent.addScoped('{', '}', () { - indent.writeln( - 'ArrayList wrappedError = wrapError(exception);'); if (method.isAsynchronous) { - indent.writeln('reply.reply(wrappedError);'); + indent.writeln('reply.reply(wrapError(exception));'); } else { - indent.writeln('wrapped = wrappedError;'); + indent.writeln('wrapped = wrapError(exception);'); } }); indent.writeln('reply.reply(wrapped);'); @@ -960,7 +1096,7 @@ $resultType $resultName = indent.format(''' @NonNull protected static ArrayList wrapError(@NonNull Throwable exception) { -\tArrayList errorList = new ArrayList(3); +\tArrayList errorList = new ArrayList<>(3); \tif (exception instanceof FlutterError) { \t\tFlutterError error = (FlutterError) exception; \t\terrorList.add(error.code); @@ -1095,6 +1231,8 @@ String? _javaTypeForBuiltinDartType(TypeDeclaration type) { 'Int64List': 'long[]', 'Float64List': 'double[]', 'Object': 'Object', + // This is used to allow the creation of true `int`s for the codec overflow class. + _forceInt: 'int', }; if (javaTypeForDartTypeMap.containsKey(type.baseName)) { return javaTypeForDartTypeMap[type.baseName]; diff --git a/packages/pigeon/lib/kotlin_generator.dart b/packages/pigeon/lib/kotlin_generator.dart index 1d827aff164..4656f2bc16a 100644 --- a/packages/pigeon/lib/kotlin_generator.dart +++ b/packages/pigeon/lib/kotlin_generator.dart @@ -27,6 +27,8 @@ const DocumentCommentSpecification _docCommentSpec = String _codecName = 'PigeonCodec'; +const String _overflowClassName = '${classNamePrefix}CodecOverflow'; + /// Options that control how Kotlin code will be generated. class KotlinOptions { /// Creates a [KotlinOptions] object @@ -147,10 +149,7 @@ class KotlinGenerator extends StructuredGenerator { enumerate(anEnum.members, (int index, final EnumMember member) { addDocumentationComments( indent, member.documentationComments, _docCommentSpec); - final String nameScreamingSnakeCase = member.name - .replaceAllMapped( - RegExp(r'(?<=[a-z])[A-Z]'), (Match m) => '_${m.group(0)}') - .toUpperCase(); + final String nameScreamingSnakeCase = toScreamingSnakeCase(member.name); indent.write('$nameScreamingSnakeCase($index)'); if (index != anEnum.members.length - 1) { indent.addln(','); @@ -185,20 +184,8 @@ class KotlinGenerator extends StructuredGenerator { addDocumentationComments( indent, classDefinition.documentationComments, _docCommentSpec, generatorComments: generatedMessages); - indent.write('data class ${classDefinition.name} '); - indent.addScoped('(', '', () { - for (final NamedType element - in getFieldsInSerializationOrder(classDefinition)) { - _writeClassField(indent, element); - if (getFieldsInSerializationOrder(classDefinition).last != element) { - indent.addln(','); - } else { - indent.newln(); - } - } - }); - - indent.addScoped(') {', '}', () { + _writeDataClassSignature(indent, classDefinition); + indent.addScoped(' {', '}', () { writeClassDecode( generatorOptions, root, @@ -216,6 +203,26 @@ class KotlinGenerator extends StructuredGenerator { }); } + void _writeDataClassSignature( + Indent indent, + Class classDefinition, { + bool private = false, + }) { + indent.write( + '${private ? 'private ' : ''}data class ${classDefinition.name} '); + indent.addScoped('(', ')', () { + for (final NamedType element + in getFieldsInSerializationOrder(classDefinition)) { + _writeClassField(indent, element); + if (getFieldsInSerializationOrder(classDefinition).last != element) { + indent.addln(','); + } else { + indent.newln(); + } + } + }); + } + @override void writeClassEncode( KotlinOptions generatorOptions, @@ -249,7 +256,6 @@ class KotlinGenerator extends StructuredGenerator { indent.write('companion object '); indent.addScoped('{', '}', () { - indent.writeln('@Suppress("LocalVariableName")'); indent .write('fun fromList(${varNamePrefix}list: List): $className '); @@ -307,7 +313,60 @@ class KotlinGenerator extends StructuredGenerator { Indent indent, { required String dartPackageName, }) { - final Iterable enumeratedTypes = getEnumeratedTypes(root); + final List enumeratedTypes = + getEnumeratedTypes(root).toList(); + + void writeEncodeLogic(EnumeratedType customType) { + final String encodeString = + customType.type == CustomTypes.customClass ? 'toList()' : 'raw'; + final String valueString = customType.enumeration < maximumCodecFieldKey + ? 'value.$encodeString' + : 'wrap.toList()'; + final int enumeration = customType.enumeration < maximumCodecFieldKey + ? customType.enumeration + : maximumCodecFieldKey; + indent.writeScoped('is ${customType.name} -> {', '}', () { + if (customType.enumeration >= maximumCodecFieldKey) { + indent.writeln( + 'val wrap = ${generatorOptions.fileSpecificClassNameComponent}$_overflowClassName(type = ${customType.enumeration - maximumCodecFieldKey}, wrapped = value.$encodeString)'); + } + indent.writeln('stream.write($enumeration)'); + indent.writeln('writeValue(stream, $valueString)'); + }); + } + + void writeDecodeLogic(EnumeratedType customType) { + indent.write('${customType.enumeration}.toByte() -> '); + indent.addScoped('{', '}', () { + if (customType.type == CustomTypes.customClass) { + indent.write('return (readValue(buffer) as? List)?.let '); + indent.addScoped('{', '}', () { + indent.writeln('${customType.name}.fromList(it)'); + }); + } else if (customType.type == CustomTypes.customEnum) { + indent.write('return (readValue(buffer) as Int?)?.let '); + indent.addScoped('{', '}', () { + indent.writeln('${customType.name}.ofRaw(it)'); + }); + } + }); + } + + final EnumeratedType overflowClass = EnumeratedType( + '${generatorOptions.fileSpecificClassNameComponent}$_overflowClassName', + maximumCodecFieldKey, + CustomTypes.customClass); + + if (root.requiresOverflowClass) { + _writeCodecOverflowUtilities( + generatorOptions, + root, + indent, + enumeratedTypes, + dartPackageName: dartPackageName, + ); + } + indent.write( 'private object ${generatorOptions.fileSpecificClassNameComponent}$_codecName : StandardMessageCodec() '); indent.addScoped('{', '}', () { @@ -319,21 +378,12 @@ class KotlinGenerator extends StructuredGenerator { indent.add('when (type) '); indent.addScoped('{', '}', () { for (final EnumeratedType customType in enumeratedTypes) { - indent.write('${customType.enumeration}.toByte() -> '); - indent.addScoped('{', '}', () { - if (customType.type == CustomTypes.customClass) { - indent - .write('return (readValue(buffer) as? List)?.let '); - indent.addScoped('{', '}', () { - indent.writeln('${customType.name}.fromList(it)'); - }); - } else if (customType.type == CustomTypes.customEnum) { - indent.write('return (readValue(buffer) as Int?)?.let '); - indent.addScoped('{', '}', () { - indent.writeln('${customType.name}.ofRaw(it)'); - }); - } - }); + if (customType.enumeration < maximumCodecFieldKey) { + writeDecodeLogic(customType); + } + } + if (root.requiresOverflowClass) { + writeDecodeLogic(overflowClass); } indent.writeln('else -> super.readValueOfType(type, buffer)'); }); @@ -348,17 +398,7 @@ class KotlinGenerator extends StructuredGenerator { if (root.classes.isNotEmpty || root.enums.isNotEmpty) { indent.write('when (value) '); indent.addScoped('{', '}', () { - for (final EnumeratedType customType in enumeratedTypes) { - indent.write('is ${customType.name} -> '); - indent.addScoped('{', '}', () { - indent.writeln('stream.write(${customType.enumeration})'); - if (customType.type == CustomTypes.customClass) { - indent.writeln('writeValue(stream, value.toList())'); - } else if (customType.type == CustomTypes.customEnum) { - indent.writeln('writeValue(stream, value.raw)'); - } - }); - } + enumeratedTypes.forEach(writeEncodeLogic); indent.writeln('else -> super.writeValue(stream, value)'); }); } else { @@ -369,6 +409,73 @@ class KotlinGenerator extends StructuredGenerator { indent.newln(); } + void _writeCodecOverflowUtilities( + KotlinOptions generatorOptions, + Root root, + Indent indent, + List types, { + required String dartPackageName, + }) { + final NamedType overflowInt = NamedType( + name: 'type', + type: const TypeDeclaration(baseName: 'Int', isNullable: false)); + final NamedType overflowObject = NamedType( + name: 'wrapped', + type: const TypeDeclaration(baseName: 'Object', isNullable: true)); + final List overflowFields = [ + overflowInt, + overflowObject, + ]; + final Class overflowClass = Class( + name: + '${generatorOptions.fileSpecificClassNameComponent}$_overflowClassName', + fields: overflowFields); + + _writeDataClassSignature(indent, overflowClass, private: true); + indent.addScoped(' {', '}', () { + writeClassEncode( + generatorOptions, + root, + indent, + overflowClass, + dartPackageName: dartPackageName, + ); + + indent.format(''' +companion object { + fun fromList(${varNamePrefix}list: List): Any? { + val wrapper = ${generatorOptions.fileSpecificClassNameComponent}$_overflowClassName( + type = ${varNamePrefix}list[0] as Int, + wrapped = ${varNamePrefix}list[1], + ); + return wrapper.unwrap() + } +} +'''); + + indent.writeScoped('fun unwrap(): Any? {', '}', () { + indent.format(''' +if (wrapped == null) { + return null +} + '''); + indent.writeScoped('when (type) {', '}', () { + for (int i = totalCustomCodecKeysAllowed; i < types.length; i++) { + indent.writeScoped('${i - totalCustomCodecKeysAllowed} ->', '', () { + if (types[i].type == CustomTypes.customClass) { + indent.writeln( + 'return ${types[i].name}.fromList(wrapped as List)'); + } else if (types[i].type == CustomTypes.customEnum) { + indent.writeln('return ${types[i].name}.ofRaw(wrapped as Int)'); + } + }); + } + }); + indent.writeln('return null'); + }); + }); + } + /// Writes the code for a flutter [Api], [api]. /// Example: /// class Foo(private val binaryMessenger: BinaryMessenger) { diff --git a/packages/pigeon/lib/objc_generator.dart b/packages/pigeon/lib/objc_generator.dart index e378fbac1c2..6489b5d4e0e 100644 --- a/packages/pigeon/lib/objc_generator.dart +++ b/packages/pigeon/lib/objc_generator.dart @@ -15,6 +15,24 @@ const String _docCommentPrefix = '///'; const DocumentCommentSpecification _docCommentSpec = DocumentCommentSpecification(_docCommentPrefix); +const String _overflowClassName = '${classNamePrefix}CodecOverflow'; + +final NamedType _overflowInt = NamedType( + name: 'type', + type: const TypeDeclaration(baseName: 'int', isNullable: false)); +final NamedType _overflowObject = NamedType( + name: 'wrapped', + type: const TypeDeclaration(baseName: 'Object', isNullable: true)); +final List _overflowFields = [ + _overflowInt, + _overflowObject, +]; +final Class _overflowClass = + Class(name: _overflowClassName, fields: _overflowFields); +final EnumeratedType _enumeratedOverflow = EnumeratedType( + _overflowClassName, maximumCodecFieldKey, CustomTypes.customClass, + associatedClass: _overflowClass); + /// Options that control how Objective-C code will be generated. class ObjcOptions { /// Parametric constructor for ObjcOptions. @@ -207,56 +225,12 @@ class ObjcHeaderGenerator extends StructuredGenerator { Class classDefinition, { required String dartPackageName, }) { - final String? prefix = generatorOptions.prefix; - - addDocumentationComments( - indent, classDefinition.documentationComments, _docCommentSpec); - - indent.writeln( - '@interface ${_className(prefix, classDefinition.name)} : NSObject'); - if (getFieldsInSerializationOrder(classDefinition).isNotEmpty) { - if (getFieldsInSerializationOrder(classDefinition) - .map((NamedType e) => !e.type.isNullable) - .any((bool e) => e)) { - indent.writeln( - '$_docCommentPrefix `init` unavailable to enforce nonnull fields, see the `make` class method.'); - indent.writeln('- (instancetype)init NS_UNAVAILABLE;'); - } - _writeObjcSourceClassInitializerDeclaration( - indent, - generatorOptions, - root, - classDefinition, - prefix, - ); - indent.addln(';'); - } - for (final NamedType field - in getFieldsInSerializationOrder(classDefinition)) { - final HostDatatype hostDatatype = getFieldHostDatatype( - field, - (TypeDeclaration x) => _objcTypeStringForPrimitiveDartType(prefix, x, - beforeString: true), - customResolver: field.type.isEnum - ? (String x) => _enumName(x, prefix: prefix) - : (String x) => '${_className(prefix, x)} *'); - late final String propertyType; - addDocumentationComments( - indent, field.documentationComments, _docCommentSpec); - propertyType = _propertyTypeForDartType(field.type, - isNullable: field.type.isNullable, isEnum: field.type.isEnum); - final String nullability = field.type.isNullable ? ', nullable' : ''; - final String fieldType = field.type.isEnum && field.type.isNullable - ? _enumName(field.type.baseName, - suffix: ' *', - prefix: generatorOptions.prefix, - box: field.type.isNullable) - : hostDatatype.datatype; - indent.writeln( - '@property(nonatomic, $propertyType$nullability) $fieldType ${field.name};'); - } - indent.writeln('@end'); - indent.newln(); + _writeDataClassDeclaration( + generatorOptions, + root, + indent, + classDefinition, + ); } @override @@ -505,7 +479,10 @@ class ObjcSourceGenerator extends StructuredGenerator { }) { for (final Class classDefinition in root.classes) { _writeObjcSourceDataClassExtension( - generatorOptions, indent, classDefinition); + generatorOptions, + indent, + classDefinition, + ); } indent.newln(); super.writeDataClasses( @@ -524,16 +501,12 @@ class ObjcSourceGenerator extends StructuredGenerator { Class classDefinition, { required String dartPackageName, }) { - final Set customClassNames = - root.classes.map((Class x) => x.name).toSet(); - final Set customEnumNames = - root.enums.map((Enum x) => x.name).toSet(); final String className = _className(generatorOptions.prefix, classDefinition.name); indent.writeln('@implementation $className'); - _writeObjcSourceClassInitializer(generatorOptions, root, indent, - classDefinition, customClassNames, customEnumNames, className); + _writeObjcSourceClassInitializer( + generatorOptions, root, indent, classDefinition, className); writeClassDecode( generatorOptions, root, @@ -592,13 +565,16 @@ class ObjcSourceGenerator extends StructuredGenerator { _nsnumberExtractionMethod(field.type); final String ivarValueExpression; if (field.type.isEnum && !field.type.isNullable) { + final String varName = + 'boxed${_enumName(field.type.baseName, prefix: generatorOptions.prefix)}'; _writeEnumBoxToEnum( indent, field, + varName, valueGetter, prefix: generatorOptions.prefix, ); - ivarValueExpression = 'enumBox.value'; + ivarValueExpression = '$varName.value'; } else if (primitiveExtractionMethod != null) { ivarValueExpression = '[$valueGetter $primitiveExtractionMethod]'; } else { @@ -616,6 +592,100 @@ class ObjcSourceGenerator extends StructuredGenerator { }); } + void _writeCodecOverflowUtilities( + ObjcOptions generatorOptions, + Root root, + Indent indent, + List types, { + required String dartPackageName, + }) { + _writeObjcSourceDataClassExtension( + generatorOptions, + indent, + _overflowClass, + returnType: 'id', + isOverflowClass: true, + ); + indent.newln(); + indent.writeln( + '@implementation ${_className(generatorOptions.prefix, _overflowClassName)}'); + + _writeObjcSourceClassInitializer( + generatorOptions, + root, + indent, + _overflowClass, + _className(generatorOptions.prefix, _overflowClassName)); + writeClassEncode( + generatorOptions, + root, + indent, + _overflowClass, + dartPackageName: dartPackageName, + ); + + indent.format(''' ++ (id)fromList:(NSArray *)list { + ${_className(generatorOptions.prefix, _overflowClassName)} *wrapper = [[${_className(generatorOptions.prefix, _overflowClassName)} alloc] init]; + wrapper.type = [GetNullableObjectAtIndex(list, 0) integerValue]; + wrapper.wrapped = GetNullableObjectAtIndex(list, 1); + return [wrapper unwrap]; +} +'''); + + indent.writeScoped('- (id) unwrap {', '}', () { + indent.format(''' +if (self.wrapped == nil) { + return nil; +} + '''); + indent.writeScoped('switch (self.type) {', '}', () { + for (int i = totalCustomCodecKeysAllowed; i < types.length; i++) { + indent.write('case ${i - totalCustomCodecKeysAllowed}:'); + _writeCodecDecode( + indent, + types[i], + generatorOptions.prefix ?? '', + isOverflowClass: true, + ); + } + indent.writeScoped('default: ', '', () { + indent.writeln('return nil;'); + }, addTrailingNewline: false); + }); + }); + indent.writeln('@end'); + } + + void _writeCodecDecode( + Indent indent, EnumeratedType customType, String? prefix, + {bool isOverflowClass = false}) { + String readValue = '[self readValue]'; + if (isOverflowClass) { + readValue = 'self.wrapped'; + } + if (customType.type == CustomTypes.customClass) { + indent.addScoped('', null, () { + indent.writeln( + 'return [${_className(prefix, customType.name)} fromList:$readValue];'); + }, addTrailingNewline: false); + } else if (customType.type == CustomTypes.customEnum) { + indent.addScoped( + !isOverflowClass ? '{' : '', !isOverflowClass ? '}' : null, () { + String enumAsNumber = 'enumAsNumber'; + if (!isOverflowClass) { + indent.writeln('NSNumber *$enumAsNumber = $readValue;'); + indent.write('return $enumAsNumber == nil ? nil : '); + } else { + enumAsNumber = 'self.wrapped'; + indent.write('return '); + } + indent.addln( + '[[${_enumName(customType.name, prefix: prefix, box: true)} alloc] initWithValue:[$enumAsNumber integerValue]];'); + }, addTrailingNewline: !isOverflowClass); + } + } + @override void writeGeneralCodec( ObjcOptions generatorOptions, @@ -624,34 +694,41 @@ class ObjcSourceGenerator extends StructuredGenerator { required String dartPackageName, }) { const String codecName = 'PigeonCodec'; - final Iterable codecClasses = getEnumeratedTypes(root); + final List enumeratedTypes = + getEnumeratedTypes(root).toList(); final String readerWriterName = '${generatorOptions.prefix}${toUpperCamelCase(generatorOptions.fileSpecificClassNameComponent ?? '')}${codecName}ReaderWriter'; final String readerName = '${generatorOptions.prefix}${toUpperCamelCase(generatorOptions.fileSpecificClassNameComponent ?? '')}${codecName}Reader'; final String writerName = '${generatorOptions.prefix}${toUpperCamelCase(generatorOptions.fileSpecificClassNameComponent ?? '')}${codecName}Writer'; + + if (root.requiresOverflowClass) { + _writeCodecOverflowUtilities( + generatorOptions, root, indent, enumeratedTypes, + dartPackageName: dartPackageName); + } + indent.writeln('@interface $readerName : FlutterStandardReader'); indent.writeln('@end'); indent.writeln('@implementation $readerName'); indent.write('- (nullable id)readValueOfType:(UInt8)type '); indent.addScoped('{', '}', () { - indent.write('switch (type) '); - indent.addScoped('{', '}', () { - for (final EnumeratedType customType in codecClasses) { - indent.writeln('case ${customType.enumeration}: '); - indent.nest(1, () { - if (customType.type == CustomTypes.customClass) { - indent.writeln( - 'return [${_className(generatorOptions.prefix, customType.name)} fromList:[self readValue]];'); - } else if (customType.type == CustomTypes.customEnum) { - indent.writeScoped('{', '}', () { - indent.writeln('NSNumber *enumAsNumber = [self readValue];'); - indent.writeln( - 'return enumAsNumber == nil ? nil : [[${_enumName(customType.name, prefix: generatorOptions.prefix, box: true)} alloc] initWithValue:[enumAsNumber integerValue]];'); - }); - } - }); + indent.writeScoped('switch (type) {', '}', () { + for (final EnumeratedType customType in enumeratedTypes) { + if (customType.enumeration < maximumCodecFieldKey) { + indent.write('case ${customType.enumeration}: '); + _writeCodecDecode( + indent, customType, generatorOptions.prefix ?? ''); + } + } + if (root.requiresOverflowClass) { + indent.write('case $maximumCodecFieldKey: '); + _writeCodecDecode( + indent, + _enumeratedOverflow, + generatorOptions.prefix, + ); } indent.writeln('default:'); indent.nest(1, () { @@ -666,30 +743,33 @@ class ObjcSourceGenerator extends StructuredGenerator { indent.writeln('@implementation $writerName'); indent.write('- (void)writeValue:(id)value '); indent.addScoped('{', '}', () { - bool firstClass = true; - for (final EnumeratedType customClass in codecClasses) { - if (firstClass) { - indent.write(''); - firstClass = false; - } - if (customClass.type == CustomTypes.customClass) { - indent.add( - 'if ([value isKindOfClass:[${_className(generatorOptions.prefix, customClass.name)} class]]) '); - indent.addScoped('{', '} else ', () { - indent.writeln('[self writeByte:${customClass.enumeration}];'); - indent.writeln('[self writeValue:[value toList]];'); - }, addTrailingNewline: false); - } else if (customClass.type == CustomTypes.customEnum) { - final String boxName = _enumName(customClass.name, - prefix: generatorOptions.prefix, box: true); - indent.add('if ([value isKindOfClass:[$boxName class]]) '); - indent.addScoped('{', '} else ', () { - indent.writeln('$boxName * box = ($boxName *)value;'); - indent.writeln('[self writeByte:${customClass.enumeration}];'); + indent.write(''); + for (final EnumeratedType customType in enumeratedTypes) { + final String encodeString = customType.type == CustomTypes.customClass + ? '[value toList]' + : '(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])'; + final String valueString = customType.enumeration < maximumCodecFieldKey + ? encodeString + : '[wrap toList]'; + final String className = customType.type == CustomTypes.customClass + ? _className(generatorOptions.prefix, customType.name) + : _enumName(customType.name, + prefix: generatorOptions.prefix, box: true); + indent.addScoped( + 'if ([value isKindOfClass:[$className class]]) {', '} else ', () { + if (customType.type == CustomTypes.customEnum) { + indent.writeln('$className *box = ($className *)value;'); + } + final int enumeration = customType.enumeration < maximumCodecFieldKey + ? customType.enumeration + : maximumCodecFieldKey; + if (customType.enumeration >= maximumCodecFieldKey) { indent.writeln( - '[self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])];'); - }, addTrailingNewline: false); - } + '${_className(generatorOptions.prefix, _overflowClassName)} *wrap = [${_className(generatorOptions.prefix, _overflowClassName)} makeWithType:${customType.enumeration - maximumCodecFieldKey} wrapped:$encodeString];'); + } + indent.writeln('[self writeByte:$enumeration];'); + indent.writeln('[self writeValue:$valueString];'); + }, addTrailingNewline: false); } indent.addScoped('{', '}', () { indent.writeln('[super writeValue:value];'); @@ -840,6 +920,15 @@ class ObjcSourceGenerator extends StructuredGenerator { if (hasHostApi || hasFlutterApi) { _writeGetNullableObjectAtIndex(indent); } + + if (root.requiresOverflowClass) { + _writeDataClassDeclaration( + generatorOptions, + root, + indent, + _overflowClass, + ); + } } void _writeWrapError(Indent indent) { @@ -886,13 +975,16 @@ static FlutterError *createConnectionError(NSString *channelName) { final String ivarValueExpression; String beforeString = objcArgType.beforeString; if (arg.type.isEnum && !arg.type.isNullable) { + final String varName = + 'boxed${_enumName(arg.type.baseName, prefix: generatorOptions.prefix)}'; _writeEnumBoxToEnum( indent, arg, + varName, valueGetter, prefix: generatorOptions.prefix, ); - ivarValueExpression = 'enumBox.value'; + ivarValueExpression = '$varName.value'; } else if (primitiveExtractionMethod != null) { ivarValueExpression = '[$valueGetter $primitiveExtractionMethod]'; } else { @@ -1036,14 +1128,23 @@ static FlutterError *createConnectionError(NSString *channelName) { } void _writeObjcSourceDataClassExtension( - ObjcOptions languageOptions, Indent indent, Class classDefinition) { + ObjcOptions languageOptions, + Indent indent, + Class classDefinition, { + String? returnType, + bool isOverflowClass = false, + }) { final String className = _className(languageOptions.prefix, classDefinition.name); + returnType = returnType ?? className; indent.newln(); indent.writeln('@interface $className ()'); - indent.writeln('+ ($className *)fromList:(NSArray *)list;'); indent.writeln( - '+ (nullable $className *)nullableFromList:(NSArray *)list;'); + '+ ($returnType${isOverflowClass ? '' : ' *'})fromList:(NSArray *)list;'); + if (!isOverflowClass) { + indent.writeln( + '+ (nullable $returnType *)nullableFromList:(NSArray *)list;'); + } indent.writeln('- (NSArray *)toList;'); indent.writeln('@end'); } @@ -1053,8 +1154,6 @@ static FlutterError *createConnectionError(NSString *channelName) { Root root, Indent indent, Class classDefinition, - Set customClassNames, - Set customEnumNames, String className, ) { _writeObjcSourceClassInitializerDeclaration( @@ -1572,11 +1671,12 @@ List validateObjc(ObjcOptions options, Root root) { void _writeEnumBoxToEnum( Indent indent, NamedType field, + String varName, String valueGetter, { String? prefix = '', }) { indent.writeln( - '${_enumName(field.type.baseName, prefix: prefix, box: true, suffix: ' *')}enumBox = $valueGetter;'); + '${_enumName(field.type.baseName, prefix: prefix, box: true, suffix: ' *')}$varName = $valueGetter;'); } String _getEnumToEnumBox( @@ -1586,3 +1686,61 @@ String _getEnumToEnumBox( }) { return '[[${_enumName(field.type.baseName, prefix: prefix, box: true)} alloc] initWithValue:$valueSetter]'; } + +void _writeDataClassDeclaration( + ObjcOptions generatorOptions, + Root root, + Indent indent, + Class classDefinition, +) { + final String? prefix = generatorOptions.prefix; + + addDocumentationComments( + indent, classDefinition.documentationComments, _docCommentSpec); + + indent.writeln( + '@interface ${_className(prefix, classDefinition.name)} : NSObject'); + if (getFieldsInSerializationOrder(classDefinition).isNotEmpty) { + if (getFieldsInSerializationOrder(classDefinition) + .map((NamedType e) => !e.type.isNullable) + .any((bool e) => e)) { + indent.writeln( + '$_docCommentPrefix `init` unavailable to enforce nonnull fields, see the `make` class method.'); + indent.writeln('- (instancetype)init NS_UNAVAILABLE;'); + } + _writeObjcSourceClassInitializerDeclaration( + indent, + generatorOptions, + root, + classDefinition, + prefix, + ); + indent.addln(';'); + } + for (final NamedType field + in getFieldsInSerializationOrder(classDefinition)) { + final HostDatatype hostDatatype = getFieldHostDatatype( + field, + (TypeDeclaration x) => + _objcTypeStringForPrimitiveDartType(prefix, x, beforeString: true), + customResolver: field.type.isEnum + ? (String x) => _enumName(x, prefix: prefix) + : (String x) => '${_className(prefix, x)} *'); + late final String propertyType; + addDocumentationComments( + indent, field.documentationComments, _docCommentSpec); + propertyType = _propertyTypeForDartType(field.type, + isNullable: field.type.isNullable, isEnum: field.type.isEnum); + final String nullability = field.type.isNullable ? ', nullable' : ''; + final String fieldType = field.type.isEnum && field.type.isNullable + ? _enumName(field.type.baseName, + suffix: ' *', + prefix: generatorOptions.prefix, + box: field.type.isNullable) + : hostDatatype.datatype; + indent.writeln( + '@property(nonatomic, $propertyType$nullability) $fieldType ${field.name};'); + } + indent.writeln('@end'); + indent.newln(); +} diff --git a/packages/pigeon/lib/pigeon_lib.dart b/packages/pigeon/lib/pigeon_lib.dart index af2618e47e6..d5623a29581 100644 --- a/packages/pigeon/lib/pigeon_lib.dart +++ b/packages/pigeon/lib/pigeon_lib.dart @@ -66,7 +66,7 @@ const Object async = _Asynchronous(); /// /// ```dart /// class MyProxyApi { -/// final MyOtherProxyApi myField = __pigeon_myField(). +/// final MyOtherProxyApi myField = pigeon_myField(). /// } /// ``` /// @@ -843,7 +843,17 @@ class GObjectGeneratorAdapter implements GeneratorAdapter { } @override - List validate(PigeonOptions options, Root root) => []; + List validate(PigeonOptions options, Root root) { + final List errors = []; + // TODO(tarrinneal): Remove once overflow class is added to gobject generator. + // https://github.com/flutter/flutter/issues/152916 + if (root.classes.length + root.enums.length > totalCustomCodecKeysAllowed) { + errors.add(Error( + message: + 'GObject generator does not yet support more than $totalCustomCodecKeysAllowed custom types.')); + } + return errors; + } } /// A [GeneratorAdapter] that generates Kotlin source code. @@ -909,9 +919,54 @@ List _validateAst(Root root, String source) { final List customClasses = root.classes.map((Class x) => x.name).toList(); final Iterable customEnums = root.enums.map((Enum x) => x.name); + for (final Enum enumDefinition in root.enums) { + final String? matchingPrefix = _findMatchingPrefixOrNull( + enumDefinition.name, + prefixes: disallowedPrefixes, + ); + if (matchingPrefix != null) { + result.add(Error( + message: + 'Enum name must not begin with "$matchingPrefix" in enum "${enumDefinition.name}"', + )); + } + for (final EnumMember enumMember in enumDefinition.members) { + final String? matchingPrefix = _findMatchingPrefixOrNull( + enumMember.name, + prefixes: disallowedPrefixes, + ); + if (matchingPrefix != null) { + result.add(Error( + message: + 'Enum member name must not begin with "$matchingPrefix" in enum member "${enumMember.name}" of enum "${enumDefinition.name}"', + )); + } + } + } for (final Class classDefinition in root.classes) { + final String? matchingPrefix = _findMatchingPrefixOrNull( + classDefinition.name, + prefixes: disallowedPrefixes, + ); + if (matchingPrefix != null) { + result.add(Error( + message: + 'Class name must not begin with "$matchingPrefix" in class "${classDefinition.name}"', + )); + } for (final NamedType field in getFieldsInSerializationOrder(classDefinition)) { + final String? matchingPrefix = _findMatchingPrefixOrNull( + field.name, + prefixes: disallowedPrefixes, + ); + if (matchingPrefix != null) { + result.add(Error( + message: + 'Class field name must not begin with "$matchingPrefix" in field "${field.name}" of class "${classDefinition.name}"', + lineNumber: _calculateLineNumberNullable(source, field.offset), + )); + } for (final TypeDeclaration typeArgument in field.type.typeArguments) { if (!typeArgument.isNullable) { result.add(Error( @@ -941,6 +996,16 @@ List _validateAst(Root root, String source) { } for (final Api api in root.apis) { + final String? matchingPrefix = _findMatchingPrefixOrNull( + api.name, + prefixes: disallowedPrefixes, + ); + if (matchingPrefix != null) { + result.add(Error( + message: + 'API name must not begin with "$matchingPrefix" in API "${api.name}"', + )); + } if (api is AstProxyApi) { result.addAll(_validateProxyApi( api, @@ -950,6 +1015,17 @@ List _validateAst(Root root, String source) { )); } for (final Method method in api.methods) { + final String? matchingPrefix = _findMatchingPrefixOrNull( + method.name, + prefixes: disallowedPrefixes, + ); + if (matchingPrefix != null) { + result.add(Error( + message: + 'Method name must not begin with "$matchingPrefix" in method "${method.name}" in API: "${api.name}"', + lineNumber: _calculateLineNumberNullable(source, method.offset), + )); + } for (final Parameter param in method.parameters) { if (param.type.baseName.isEmpty) { result.add(Error( @@ -959,13 +1035,13 @@ List _validateAst(Root root, String source) { )); } else { final String? matchingPrefix = _findMatchingPrefixOrNull( - method.name, - prefixes: ['__pigeon_', 'pigeonChannelCodec'], + param.name, + prefixes: disallowedPrefixes, ); if (matchingPrefix != null) { result.add(Error( message: - 'Parameter name must not begin with "$matchingPrefix" in method "${method.name} in API: "${api.name}"', + 'Parameter name must not begin with "$matchingPrefix" in method "${method.name}" in API: "${api.name}"', lineNumber: _calculateLineNumberNullable(source, param.offset), )); } @@ -1163,12 +1239,7 @@ List _validateProxyApi( } else { final String? matchingPrefix = _findMatchingPrefixOrNull( parameter.name, - prefixes: [ - '__pigeon_', - 'pigeonChannelCodec', - classNamePrefix, - classMemberNamePrefix, - ], + prefixes: disallowedPrefixes, ); if (matchingPrefix != null) { result.add(Error( @@ -1203,7 +1274,7 @@ List _validateProxyApi( parameter.name, prefixes: [ classNamePrefix, - classMemberNamePrefix, + varNamePrefix, ], ); if (matchingPrefix != null) { @@ -1256,23 +1327,6 @@ List _validateProxyApi( )); } } - - final String? matchingPrefix = _findMatchingPrefixOrNull( - field.name, - prefixes: [ - '__pigeon_', - 'pigeonChannelCodec', - classNamePrefix, - classMemberNamePrefix, - ], - ); - if (matchingPrefix != null) { - result.add(Error( - message: - 'Field name must not begin with "$matchingPrefix" in API: "${api.name}"', - lineNumber: _calculateLineNumberNullable(source, field.offset), - )); - } } return result; @@ -2284,8 +2338,12 @@ ${_argParser.usage}'''; /// used when running the code generator. The optional parameter [adapters] allows you to /// customize the generators that pigeon will use. The optional parameter /// [sdkPath] allows you to specify the Dart SDK path. - static Future runWithOptions(PigeonOptions options, - {List? adapters, String? sdkPath}) async { + static Future runWithOptions( + PigeonOptions options, { + List? adapters, + String? sdkPath, + bool injectOverflowTypes = false, + }) async { final Pigeon pigeon = Pigeon.setup(); if (options.debugGenerators ?? false) { generator_tools.debugGenerators = true; @@ -2312,6 +2370,19 @@ ${_argParser.usage}'''; final ParseResults parseResults = pigeon.parseFile(options.input!, sdkPath: sdkPath); + if (injectOverflowTypes) { + final List addedEnums = List.generate( + totalCustomCodecKeysAllowed - 1, + (final int tag) { + return Enum( + name: 'FillerEnum$tag', + members: [EnumMember(name: 'FillerMember$tag')]); + }, + ); + addedEnums.addAll(parseResults.root.enums); + parseResults.root.enums = addedEnums; + } + final List errors = []; errors.addAll(parseResults.errors); @@ -2323,6 +2394,9 @@ ${_argParser.usage}'''; } for (final GeneratorAdapter adapter in safeGeneratorAdapters) { + if (injectOverflowTypes && adapter is GObjectGeneratorAdapter) { + continue; + } final IOSink? sink = adapter.shouldGenerate(options, FileType.source); if (sink != null) { final List adapterErrors = diff --git a/packages/pigeon/lib/swift_generator.dart b/packages/pigeon/lib/swift_generator.dart index 99ad77f39e7..f1c49353484 100644 --- a/packages/pigeon/lib/swift_generator.dart +++ b/packages/pigeon/lib/swift_generator.dart @@ -14,6 +14,8 @@ const String _docCommentPrefix = '///'; const DocumentCommentSpecification _docCommentSpec = DocumentCommentSpecification(_docCommentPrefix); +const String _overflowClassName = '${classNamePrefix}CodecOverflow'; + /// Options that control how Swift code will be generated. class SwiftOptions { /// Creates a [SwiftOptions] object @@ -135,33 +137,54 @@ class SwiftGenerator extends StructuredGenerator { final String readerName = '${codecName}Reader'; final String writerName = '${codecName}Writer'; - final Iterable allTypes = getEnumeratedTypes(root); + final List enumeratedTypes = + getEnumeratedTypes(root).toList(); + + void writeDecodeLogic(EnumeratedType customType) { + indent.writeln('case ${customType.enumeration}:'); + indent.nest(1, () { + if (customType.type == CustomTypes.customEnum) { + indent.writeln( + 'let enumResultAsInt: Int? = nilOrValue(self.readValue() as? Int)'); + indent.writeScoped('if let enumResultAsInt = enumResultAsInt {', '}', + () { + indent.writeln( + 'return ${customType.name}(rawValue: enumResultAsInt)'); + }); + indent.writeln('return nil'); + } else { + indent.writeln( + 'return ${customType.name}.fromList(self.readValue() as! [Any?])'); + } + }); + } + + final EnumeratedType overflowClass = EnumeratedType( + _overflowClassName, maximumCodecFieldKey, CustomTypes.customClass); + + if (root.requiresOverflowClass) { + indent.newln(); + _writeCodecOverflowUtilities( + generatorOptions, root, indent, enumeratedTypes, + dartPackageName: dartPackageName); + } + + indent.newln(); // Generate Reader indent.write('private class $readerName: FlutterStandardReader '); indent.addScoped('{', '}', () { - if (allTypes.isNotEmpty) { + if (enumeratedTypes.isNotEmpty) { indent.write('override func readValue(ofType type: UInt8) -> Any? '); indent.addScoped('{', '}', () { indent.write('switch type '); indent.addScoped('{', '}', nestCount: 0, () { - for (final EnumeratedType customType in allTypes) { - indent.writeln('case ${customType.enumeration}:'); - indent.nest(1, () { - if (customType.type == CustomTypes.customEnum) { - indent.writeln('var enumResult: ${customType.name}? = nil'); - indent.writeln( - 'let enumResultAsInt: Int? = nilOrValue(self.readValue() as? Int)'); - indent.writeScoped( - 'if let enumResultAsInt = enumResultAsInt {', '}', () { - indent.writeln( - 'enumResult = ${customType.name}(rawValue: enumResultAsInt)'); - }); - indent.writeln('return enumResult'); - } else { - indent.writeln( - 'return ${customType.name}.fromList(self.readValue() as! [Any?])'); - } - }); + for (final EnumeratedType customType in enumeratedTypes) { + if (customType.enumeration < maximumCodecFieldKey) { + writeDecodeLogic(customType); + } + } + if (root.requiresOverflowClass) { + writeDecodeLogic(overflowClass); } indent.writeln('default:'); indent.nest(1, () { @@ -176,19 +199,31 @@ class SwiftGenerator extends StructuredGenerator { indent.newln(); indent.write('private class $writerName: FlutterStandardWriter '); indent.addScoped('{', '}', () { - if (allTypes.isNotEmpty) { + if (enumeratedTypes.isNotEmpty) { indent.write('override func writeValue(_ value: Any) '); indent.addScoped('{', '}', () { indent.write(''); - for (final EnumeratedType customType in allTypes) { + for (final EnumeratedType customType in enumeratedTypes) { indent.add('if let value = value as? ${customType.name} '); indent.addScoped('{', '} else ', () { - indent.writeln('super.writeByte(${customType.enumeration})'); - if (customType.type == CustomTypes.customEnum) { - indent.writeln('super.writeValue(value.rawValue)'); - } else if (customType.type == CustomTypes.customClass) { - indent.writeln('super.writeValue(value.toList())'); + final String encodeString = + customType.type == CustomTypes.customClass + ? 'toList()' + : 'rawValue'; + final String valueString = + customType.enumeration < maximumCodecFieldKey + ? 'value.$encodeString' + : 'wrap.toList()'; + final int enumeration = + customType.enumeration < maximumCodecFieldKey + ? customType.enumeration + : maximumCodecFieldKey; + if (customType.enumeration >= maximumCodecFieldKey) { + indent.writeln( + 'let wrap = $_overflowClassName(type: ${customType.enumeration - maximumCodecFieldKey}, wrapped: value.$encodeString)'); } + indent.writeln('super.writeByte($enumeration)'); + indent.writeln('super.writeValue($valueString)'); }, addTrailingNewline: false); } indent.addScoped('{', '}', () { @@ -227,28 +262,19 @@ class SwiftGenerator extends StructuredGenerator { indent.newln(); } - @override - void writeDataClass( - SwiftOptions generatorOptions, - Root root, + void _writeDataClassSignature( Indent indent, Class classDefinition, { - required String dartPackageName, + bool private = false, }) { - const List generatedComments = [ - ' Generated class from Pigeon that represents data sent in messages.' - ]; - indent.newln(); - addDocumentationComments( - indent, classDefinition.documentationComments, _docCommentSpec, - generatorComments: generatedComments); - + final String privateString = private ? 'private ' : ''; if (classDefinition.isSwiftClass) { - indent.write('class ${classDefinition.name} '); + indent.write('${privateString}class ${classDefinition.name} '); } else { - indent.write('struct ${classDefinition.name} '); + indent.write('${privateString}struct ${classDefinition.name} '); } - indent.addScoped('{', '}', () { + + indent.addScoped('{', '', () { final Iterable fields = getFieldsInSerializationOrder(classDefinition); @@ -263,7 +289,98 @@ class SwiftGenerator extends StructuredGenerator { _writeClassField(indent, field, addNil: !classDefinition.isSwiftClass); indent.newln(); } + }); + } + + void _writeCodecOverflowUtilities( + SwiftOptions generatorOptions, + Root root, + Indent indent, + List types, { + required String dartPackageName, + }) { + final NamedType overflowInt = NamedType( + name: 'type', + type: const TypeDeclaration(baseName: 'Int', isNullable: false)); + final NamedType overflowObject = NamedType( + name: 'wrapped', + type: const TypeDeclaration(baseName: 'Object', isNullable: true)); + final List overflowFields = [ + overflowInt, + overflowObject, + ]; + final Class overflowClass = + Class(name: _overflowClassName, fields: overflowFields); + indent.newln(); + _writeDataClassSignature(indent, overflowClass, private: true); + indent.addScoped('', '}', () { + writeClassEncode( + generatorOptions, + root, + indent, + overflowClass, + dartPackageName: dartPackageName, + ); + indent.format(''' +// swift-format-ignore: AlwaysUseLowerCamelCase +static func fromList(_ ${varNamePrefix}list: [Any?]) -> Any? { + let type = ${varNamePrefix}list[0] as! Int + let wrapped: Any? = ${varNamePrefix}list[1] + + let wrapper = $_overflowClassName( + type: type, + wrapped: wrapped + ) + + return wrapper.unwrap() +} +'''); + + indent.writeScoped('func unwrap() -> Any? {', '}', () { + indent.format(''' +if (wrapped == nil) { + return nil; +} + '''); + indent.writeScoped('switch type {', '}', () { + for (int i = totalCustomCodecKeysAllowed; i < types.length; i++) { + indent.writeScoped('case ${i - totalCustomCodecKeysAllowed}:', '', + () { + if (types[i].type == CustomTypes.customClass) { + indent.writeln( + 'return ${types[i].name}.fromList(wrapped as! [Any?]);'); + } else if (types[i].type == CustomTypes.customEnum) { + indent.writeln( + 'return ${types[i].name}(rawValue: wrapped as! Int);'); + } + }, addTrailingNewline: false); + } + indent.writeScoped('default: ', '', () { + indent.writeln('return nil'); + }, addTrailingNewline: false); + }); + }); + }); + } + + @override + void writeDataClass( + SwiftOptions generatorOptions, + Root root, + Indent indent, + Class classDefinition, { + required String dartPackageName, + }) { + const List generatedComments = [ + ' Generated class from Pigeon that represents data sent in messages.' + ]; + indent.newln(); + addDocumentationComments( + indent, classDefinition.documentationComments, _docCommentSpec, + generatorComments: generatedComments); + _writeDataClassSignature(indent, classDefinition); + indent.writeScoped('', '}', () { indent.newln(); writeClassDecode( generatorOptions, diff --git a/packages/pigeon/pigeons/core_tests.dart b/packages/pigeon/pigeons/core_tests.dart index b4dc3fdfb02..626992c0a65 100644 --- a/packages/pigeon/pigeons/core_tests.dart +++ b/packages/pigeon/pigeons/core_tests.dart @@ -12,6 +12,22 @@ enum AnEnum { fourHundredTwentyTwo, } +// Enums require special logic, having multiple ensures that the logic can be +// replicated without collision. +enum AnotherEnum { + justInCase, +} + +class SimpleClass { + SimpleClass({ + this.aString, + this.aBool = true, + }); + + String? aString; + bool aBool; +} + /// A class containing all supported types. class AllTypes { AllTypes({ @@ -24,6 +40,7 @@ class AllTypes { required this.a8ByteArray, required this.aFloatArray, this.anEnum = AnEnum.one, + this.anotherEnum = AnotherEnum.justInCase, this.aString = '', this.anObject = 0, @@ -49,6 +66,7 @@ class AllTypes { Int64List a8ByteArray; Float64List aFloatArray; AnEnum anEnum; + AnotherEnum anotherEnum; String aString; Object anObject; @@ -81,6 +99,7 @@ class AllNullableTypes { this.nullableMapWithAnnotations, this.nullableMapWithObject, this.aNullableEnum, + this.anotherNullableEnum, this.aNullableString, this.aNullableObject, this.allNullableTypes, @@ -109,6 +128,7 @@ class AllNullableTypes { Map? nullableMapWithAnnotations; Map? nullableMapWithObject; AnEnum? aNullableEnum; + AnotherEnum? anotherNullableEnum; String? aNullableString; Object? aNullableObject; AllNullableTypes? allNullableTypes; @@ -144,6 +164,7 @@ class AllNullableTypesWithoutRecursion { this.nullableMapWithAnnotations, this.nullableMapWithObject, this.aNullableEnum, + this.anotherNullableEnum, this.aNullableString, this.aNullableObject, @@ -170,6 +191,7 @@ class AllNullableTypesWithoutRecursion { Map? nullableMapWithAnnotations; Map? nullableMapWithObject; AnEnum? aNullableEnum; + AnotherEnum? anotherNullableEnum; String? aNullableString; Object? aNullableObject; @@ -273,6 +295,11 @@ abstract class HostIntegrationCoreApi { @SwiftFunction('echo(_:)') AnEnum echoEnum(AnEnum anEnum); + /// Returns the passed enum to test serialization and deserialization. + @ObjCSelector('echoAnotherEnum:') + @SwiftFunction('echo(_:)') + AnotherEnum echoAnotherEnum(AnotherEnum anotherEnum); + /// Returns the default string. @ObjCSelector('echoNamedDefaultString:') @SwiftFunction('echoNamedDefault(_:)') @@ -370,6 +397,10 @@ abstract class HostIntegrationCoreApi { @SwiftFunction('echoNullable(_:)') AnEnum? echoNullableEnum(AnEnum? anEnum); + @ObjCSelector('echoAnotherNullableEnum:') + @SwiftFunction('echoNullable(_:)') + AnotherEnum? echoAnotherNullableEnum(AnotherEnum? anotherEnum); + /// Returns passed in int. @ObjCSelector('echoOptionalNullableInt:') @SwiftFunction('echoOptional(_:)') @@ -441,6 +472,12 @@ abstract class HostIntegrationCoreApi { @SwiftFunction('echoAsync(_:)') AnEnum echoAsyncEnum(AnEnum anEnum); + /// Returns the passed enum, to test asynchronous serialization and deserialization. + @async + @ObjCSelector('echoAnotherAsyncEnum:') + @SwiftFunction('echoAsync(_:)') + AnotherEnum echoAnotherAsyncEnum(AnotherEnum anotherEnum); + /// Responds with an error from an async function returning a value. @async Object? throwAsyncError(); @@ -528,6 +565,12 @@ abstract class HostIntegrationCoreApi { @SwiftFunction('echoAsyncNullable(_:)') AnEnum? echoAsyncNullableEnum(AnEnum? anEnum); + /// Returns the passed enum, to test asynchronous serialization and deserialization. + @async + @ObjCSelector('echoAnotherAsyncNullableEnum:') + @SwiftFunction('echoAsyncNullable(_:)') + AnotherEnum? echoAnotherAsyncNullableEnum(AnotherEnum? anotherEnum); + // ========== Flutter API test wrappers ========== @async @@ -612,6 +655,11 @@ abstract class HostIntegrationCoreApi { @SwiftFunction('callFlutterEcho(_:)') AnEnum callFlutterEchoEnum(AnEnum anEnum); + @async + @ObjCSelector('callFlutterEchoAnotherEnum:') + @SwiftFunction('callFlutterEcho(_:)') + AnotherEnum callFlutterEchoAnotherEnum(AnotherEnum anotherEnum); + @async @ObjCSelector('callFlutterEchoNullableBool:') @SwiftFunction('callFlutterEchoNullable(_:)') @@ -650,9 +698,14 @@ abstract class HostIntegrationCoreApi { @async @ObjCSelector('callFlutterEchoNullableEnum:') - @SwiftFunction('callFlutterNullableEcho(_:)') + @SwiftFunction('callFlutterEchoNullable(_:)') AnEnum? callFlutterEchoNullableEnum(AnEnum? anEnum); + @async + @ObjCSelector('callFlutterEchoAnotherNullableEnum:') + @SwiftFunction('callFlutterEchoNullable(_:)') + AnotherEnum? callFlutterEchoAnotherNullableEnum(AnotherEnum? anotherEnum); + @async @ObjCSelector('callFlutterSmallApiEchoString:') @SwiftFunction('callFlutterSmallApiEcho(_:)') @@ -748,6 +801,11 @@ abstract class FlutterIntegrationCoreApi { @SwiftFunction('echo(_:)') AnEnum echoEnum(AnEnum anEnum); + /// Returns the passed enum to test serialization and deserialization. + @ObjCSelector('echoAnotherEnum:') + @SwiftFunction('echo(_:)') + AnotherEnum echoAnotherEnum(AnotherEnum anotherEnum); + // ========== Nullable argument/return type tests ========== /// Returns the passed boolean, to test serialization and deserialization. @@ -790,6 +848,11 @@ abstract class FlutterIntegrationCoreApi { @SwiftFunction('echoNullable(_:)') AnEnum? echoNullableEnum(AnEnum? anEnum); + /// Returns the passed enum to test serialization and deserialization. + @ObjCSelector('echoAnotherNullableEnum:') + @SwiftFunction('echoNullable(_:)') + AnotherEnum? echoAnotherNullableEnum(AnotherEnum? anotherEnum); + // ========== Async tests ========== // These are minimal since async FlutterApi only changes Dart generation. // Currently they aren't integration tested, but having them here ensures diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/AlternateLanguageTestPlugin.java b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/AlternateLanguageTestPlugin.java index ef8c5787338..9f5b079fa33 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/AlternateLanguageTestPlugin.java +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/AlternateLanguageTestPlugin.java @@ -11,6 +11,7 @@ import com.example.alternate_language_test_plugin.CoreTests.AllNullableTypesWithoutRecursion; import com.example.alternate_language_test_plugin.CoreTests.AllTypes; import com.example.alternate_language_test_plugin.CoreTests.AnEnum; +import com.example.alternate_language_test_plugin.CoreTests.AnotherEnum; import com.example.alternate_language_test_plugin.CoreTests.FlutterIntegrationCoreApi; import com.example.alternate_language_test_plugin.CoreTests.FlutterSmallApi; import com.example.alternate_language_test_plugin.CoreTests.HostIntegrationCoreApi; @@ -128,6 +129,11 @@ public void throwErrorFromVoid() { return anEnum; } + @Override + public @NonNull AnotherEnum echoAnotherEnum(@NonNull AnotherEnum anotherEnum) { + return anotherEnum; + } + @Override public @NonNull String echoNamedDefaultString(@NonNull String aString) { return aString; @@ -224,6 +230,11 @@ public void throwErrorFromVoid() { return anEnum; } + @Override + public @Nullable AnotherEnum echoAnotherNullableEnum(@Nullable AnotherEnum anotherEnum) { + return anotherEnum; + } + @Override public @Nullable Long echoOptionalNullableInt(@Nullable Long aNullableInt) { return aNullableInt; @@ -318,6 +329,12 @@ public void echoAsyncEnum(@NonNull AnEnum anEnum, @NonNull Result result result.success(anEnum); } + @Override + public void echoAnotherAsyncEnum( + @NonNull AnotherEnum anotherEnum, @NonNull Result result) { + result.success(anotherEnum); + } + @Override public void echoAsyncNullableInt(@Nullable Long anInt, @NonNull NullableResult result) { result.success(anInt); @@ -371,6 +388,12 @@ public void echoAsyncNullableEnum( result.success(anEnum); } + @Override + public void echoAnotherAsyncNullableEnum( + @Nullable AnotherEnum anotherEnum, @NonNull NullableResult result) { + result.success(anotherEnum); + } + @Override public void callFlutterNoop(@NonNull VoidResult result) { assert flutterApi != null; @@ -482,6 +505,13 @@ public void callFlutterEchoEnum(@NonNull AnEnum anEnum, @NonNull Result flutterApi.echoEnum(anEnum, result); } + @Override + public void callFlutterEchoAnotherEnum( + @NonNull AnotherEnum anotherEnum, @NonNull Result result) { + assert flutterApi != null; + flutterApi.echoAnotherEnum(anotherEnum, result); + } + @Override public void callFlutterEchoNullableBool( @Nullable Boolean aBool, @NonNull NullableResult result) { @@ -538,6 +568,13 @@ public void callFlutterEchoNullableEnum( flutterApi.echoNullableEnum(anEnum, result); } + @Override + public void callFlutterEchoAnotherNullableEnum( + @Nullable AnotherEnum anotherEnum, @NonNull NullableResult result) { + assert flutterApi != null; + flutterApi.echoAnotherNullableEnum(anotherEnum, result); + } + @Override public void callFlutterSmallApiEchoString( @NonNull String aString, @NonNull Result result) { diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java index d7c5ea64ff1..3f2ae2af2c6 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java @@ -50,7 +50,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); @@ -84,7 +84,17 @@ public enum AnEnum { final int index; - private AnEnum(final int index) { + AnEnum(final int index) { + this.index = index; + } + } + + public enum AnotherEnum { + JUST_IN_CASE(0); + + final int index; + + AnotherEnum(final int index) { this.index = index; } } @@ -212,6 +222,19 @@ public void setAnEnum(@NonNull AnEnum setterArg) { this.anEnum = setterArg; } + private @NonNull AnotherEnum anotherEnum; + + public @NonNull AnotherEnum getAnotherEnum() { + return anotherEnum; + } + + public void setAnotherEnum(@NonNull AnotherEnum setterArg) { + if (setterArg == null) { + throw new IllegalStateException("Nonnull field \"anotherEnum\" is null."); + } + this.anotherEnum = setterArg; + } + private @NonNull String aString; public @NonNull String getAString() { @@ -337,6 +360,7 @@ public boolean equals(Object o) { && Arrays.equals(a8ByteArray, that.a8ByteArray) && Arrays.equals(aFloatArray, that.aFloatArray) && anEnum.equals(that.anEnum) + && anotherEnum.equals(that.anotherEnum) && aString.equals(that.aString) && anObject.equals(that.anObject) && list.equals(that.list) @@ -349,13 +373,14 @@ public boolean equals(Object o) { @Override public int hashCode() { - int __pigeon_result = + int pigeonVar_result = Objects.hash( aBool, anInt, anInt64, aDouble, anEnum, + anotherEnum, aString, anObject, list, @@ -364,11 +389,11 @@ public int hashCode() { doubleList, boolList, map); - __pigeon_result = 31 * __pigeon_result + Arrays.hashCode(aByteArray); - __pigeon_result = 31 * __pigeon_result + Arrays.hashCode(a4ByteArray); - __pigeon_result = 31 * __pigeon_result + Arrays.hashCode(a8ByteArray); - __pigeon_result = 31 * __pigeon_result + Arrays.hashCode(aFloatArray); - return __pigeon_result; + pigeonVar_result = 31 * pigeonVar_result + Arrays.hashCode(aByteArray); + pigeonVar_result = 31 * pigeonVar_result + Arrays.hashCode(a4ByteArray); + pigeonVar_result = 31 * pigeonVar_result + Arrays.hashCode(a8ByteArray); + pigeonVar_result = 31 * pigeonVar_result + Arrays.hashCode(aFloatArray); + return pigeonVar_result; } public static final class Builder { @@ -445,6 +470,14 @@ public static final class Builder { return this; } + private @Nullable AnotherEnum anotherEnum; + + @CanIgnoreReturnValue + public @NonNull Builder setAnotherEnum(@NonNull AnotherEnum setterArg) { + this.anotherEnum = setterArg; + return this; + } + private @Nullable String aString; @CanIgnoreReturnValue @@ -520,6 +553,7 @@ public static final class Builder { pigeonReturn.setA8ByteArray(a8ByteArray); pigeonReturn.setAFloatArray(aFloatArray); pigeonReturn.setAnEnum(anEnum); + pigeonReturn.setAnotherEnum(anotherEnum); pigeonReturn.setAString(aString); pigeonReturn.setAnObject(anObject); pigeonReturn.setList(list); @@ -534,7 +568,7 @@ public static final class Builder { @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList(17); + ArrayList toListResult = new ArrayList<>(18); toListResult.add(aBool); toListResult.add(anInt); toListResult.add(anInt64); @@ -544,6 +578,7 @@ ArrayList toList() { toListResult.add(a8ByteArray); toListResult.add(aFloatArray); toListResult.add(anEnum); + toListResult.add(anotherEnum); toListResult.add(aString); toListResult.add(anObject); toListResult.add(list); @@ -555,45 +590,47 @@ ArrayList toList() { return toListResult; } - static @NonNull AllTypes fromList(@NonNull ArrayList __pigeon_list) { + static @NonNull AllTypes fromList(@NonNull ArrayList pigeonVar_list) { AllTypes pigeonResult = new AllTypes(); - Object aBool = __pigeon_list.get(0); + Object aBool = pigeonVar_list.get(0); pigeonResult.setABool((Boolean) aBool); - Object anInt = __pigeon_list.get(1); + Object anInt = pigeonVar_list.get(1); pigeonResult.setAnInt( (anInt == null) ? null : ((anInt instanceof Integer) ? (Integer) anInt : (Long) anInt)); - Object anInt64 = __pigeon_list.get(2); + Object anInt64 = pigeonVar_list.get(2); pigeonResult.setAnInt64( (anInt64 == null) ? null : ((anInt64 instanceof Integer) ? (Integer) anInt64 : (Long) anInt64)); - Object aDouble = __pigeon_list.get(3); + Object aDouble = pigeonVar_list.get(3); pigeonResult.setADouble((Double) aDouble); - Object aByteArray = __pigeon_list.get(4); + Object aByteArray = pigeonVar_list.get(4); pigeonResult.setAByteArray((byte[]) aByteArray); - Object a4ByteArray = __pigeon_list.get(5); + Object a4ByteArray = pigeonVar_list.get(5); pigeonResult.setA4ByteArray((int[]) a4ByteArray); - Object a8ByteArray = __pigeon_list.get(6); + Object a8ByteArray = pigeonVar_list.get(6); pigeonResult.setA8ByteArray((long[]) a8ByteArray); - Object aFloatArray = __pigeon_list.get(7); + Object aFloatArray = pigeonVar_list.get(7); pigeonResult.setAFloatArray((double[]) aFloatArray); - Object anEnum = __pigeon_list.get(8); + Object anEnum = pigeonVar_list.get(8); pigeonResult.setAnEnum((AnEnum) anEnum); - Object aString = __pigeon_list.get(9); + Object anotherEnum = pigeonVar_list.get(9); + pigeonResult.setAnotherEnum((AnotherEnum) anotherEnum); + Object aString = pigeonVar_list.get(10); pigeonResult.setAString((String) aString); - Object anObject = __pigeon_list.get(10); + Object anObject = pigeonVar_list.get(11); pigeonResult.setAnObject(anObject); - Object list = __pigeon_list.get(11); + Object list = pigeonVar_list.get(12); pigeonResult.setList((List) list); - Object stringList = __pigeon_list.get(12); + Object stringList = pigeonVar_list.get(13); pigeonResult.setStringList((List) stringList); - Object intList = __pigeon_list.get(13); + Object intList = pigeonVar_list.get(14); pigeonResult.setIntList((List) intList); - Object doubleList = __pigeon_list.get(14); + Object doubleList = pigeonVar_list.get(15); pigeonResult.setDoubleList((List) doubleList); - Object boolList = __pigeon_list.get(15); + Object boolList = pigeonVar_list.get(16); pigeonResult.setBoolList((List) boolList); - Object map = __pigeon_list.get(16); + Object map = pigeonVar_list.get(17); pigeonResult.setMap((Map) map); return pigeonResult; } @@ -725,6 +762,16 @@ public void setANullableEnum(@Nullable AnEnum setterArg) { this.aNullableEnum = setterArg; } + private @Nullable AnotherEnum anotherNullableEnum; + + public @Nullable AnotherEnum getAnotherNullableEnum() { + return anotherNullableEnum; + } + + public void setAnotherNullableEnum(@Nullable AnotherEnum setterArg) { + this.anotherNullableEnum = setterArg; + } + private @Nullable String aNullableString; public @Nullable String getANullableString() { @@ -846,6 +893,7 @@ public boolean equals(Object o) { && Objects.equals(nullableMapWithAnnotations, that.nullableMapWithAnnotations) && Objects.equals(nullableMapWithObject, that.nullableMapWithObject) && Objects.equals(aNullableEnum, that.aNullableEnum) + && Objects.equals(anotherNullableEnum, that.anotherNullableEnum) && Objects.equals(aNullableString, that.aNullableString) && Objects.equals(aNullableObject, that.aNullableObject) && Objects.equals(allNullableTypes, that.allNullableTypes) @@ -860,7 +908,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - int __pigeon_result = + int pigeonVar_result = Objects.hash( aNullableBool, aNullableInt, @@ -870,6 +918,7 @@ public int hashCode() { nullableMapWithAnnotations, nullableMapWithObject, aNullableEnum, + anotherNullableEnum, aNullableString, aNullableObject, allNullableTypes, @@ -880,11 +929,11 @@ public int hashCode() { boolList, nestedClassList, map); - __pigeon_result = 31 * __pigeon_result + Arrays.hashCode(aNullableByteArray); - __pigeon_result = 31 * __pigeon_result + Arrays.hashCode(aNullable4ByteArray); - __pigeon_result = 31 * __pigeon_result + Arrays.hashCode(aNullable8ByteArray); - __pigeon_result = 31 * __pigeon_result + Arrays.hashCode(aNullableFloatArray); - return __pigeon_result; + pigeonVar_result = 31 * pigeonVar_result + Arrays.hashCode(aNullableByteArray); + pigeonVar_result = 31 * pigeonVar_result + Arrays.hashCode(aNullable4ByteArray); + pigeonVar_result = 31 * pigeonVar_result + Arrays.hashCode(aNullable8ByteArray); + pigeonVar_result = 31 * pigeonVar_result + Arrays.hashCode(aNullableFloatArray); + return pigeonVar_result; } public static final class Builder { @@ -986,6 +1035,14 @@ public static final class Builder { return this; } + private @Nullable AnotherEnum anotherNullableEnum; + + @CanIgnoreReturnValue + public @NonNull Builder setAnotherNullableEnum(@Nullable AnotherEnum setterArg) { + this.anotherNullableEnum = setterArg; + return this; + } + private @Nullable String aNullableString; @CanIgnoreReturnValue @@ -1080,6 +1137,7 @@ public static final class Builder { pigeonReturn.setNullableMapWithAnnotations(nullableMapWithAnnotations); pigeonReturn.setNullableMapWithObject(nullableMapWithObject); pigeonReturn.setANullableEnum(aNullableEnum); + pigeonReturn.setAnotherNullableEnum(anotherNullableEnum); pigeonReturn.setANullableString(aNullableString); pigeonReturn.setANullableObject(aNullableObject); pigeonReturn.setAllNullableTypes(allNullableTypes); @@ -1096,7 +1154,7 @@ public static final class Builder { @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList(22); + ArrayList toListResult = new ArrayList<>(23); toListResult.add(aNullableBool); toListResult.add(aNullableInt); toListResult.add(aNullableInt64); @@ -1109,6 +1167,7 @@ ArrayList toList() { toListResult.add(nullableMapWithAnnotations); toListResult.add(nullableMapWithObject); toListResult.add(aNullableEnum); + toListResult.add(anotherNullableEnum); toListResult.add(aNullableString); toListResult.add(aNullableObject); toListResult.add(allNullableTypes); @@ -1122,59 +1181,61 @@ ArrayList toList() { return toListResult; } - static @NonNull AllNullableTypes fromList(@NonNull ArrayList __pigeon_list) { + static @NonNull AllNullableTypes fromList(@NonNull ArrayList pigeonVar_list) { AllNullableTypes pigeonResult = new AllNullableTypes(); - Object aNullableBool = __pigeon_list.get(0); + Object aNullableBool = pigeonVar_list.get(0); pigeonResult.setANullableBool((Boolean) aNullableBool); - Object aNullableInt = __pigeon_list.get(1); + Object aNullableInt = pigeonVar_list.get(1); pigeonResult.setANullableInt( (aNullableInt == null) ? null : ((aNullableInt instanceof Integer) ? (Integer) aNullableInt : (Long) aNullableInt)); - Object aNullableInt64 = __pigeon_list.get(2); + Object aNullableInt64 = pigeonVar_list.get(2); pigeonResult.setANullableInt64( (aNullableInt64 == null) ? null : ((aNullableInt64 instanceof Integer) ? (Integer) aNullableInt64 : (Long) aNullableInt64)); - Object aNullableDouble = __pigeon_list.get(3); + Object aNullableDouble = pigeonVar_list.get(3); pigeonResult.setANullableDouble((Double) aNullableDouble); - Object aNullableByteArray = __pigeon_list.get(4); + Object aNullableByteArray = pigeonVar_list.get(4); pigeonResult.setANullableByteArray((byte[]) aNullableByteArray); - Object aNullable4ByteArray = __pigeon_list.get(5); + Object aNullable4ByteArray = pigeonVar_list.get(5); pigeonResult.setANullable4ByteArray((int[]) aNullable4ByteArray); - Object aNullable8ByteArray = __pigeon_list.get(6); + Object aNullable8ByteArray = pigeonVar_list.get(6); pigeonResult.setANullable8ByteArray((long[]) aNullable8ByteArray); - Object aNullableFloatArray = __pigeon_list.get(7); + Object aNullableFloatArray = pigeonVar_list.get(7); pigeonResult.setANullableFloatArray((double[]) aNullableFloatArray); - Object nullableNestedList = __pigeon_list.get(8); + Object nullableNestedList = pigeonVar_list.get(8); pigeonResult.setNullableNestedList((List>) nullableNestedList); - Object nullableMapWithAnnotations = __pigeon_list.get(9); + Object nullableMapWithAnnotations = pigeonVar_list.get(9); pigeonResult.setNullableMapWithAnnotations((Map) nullableMapWithAnnotations); - Object nullableMapWithObject = __pigeon_list.get(10); + Object nullableMapWithObject = pigeonVar_list.get(10); pigeonResult.setNullableMapWithObject((Map) nullableMapWithObject); - Object aNullableEnum = __pigeon_list.get(11); + Object aNullableEnum = pigeonVar_list.get(11); pigeonResult.setANullableEnum((AnEnum) aNullableEnum); - Object aNullableString = __pigeon_list.get(12); + Object anotherNullableEnum = pigeonVar_list.get(12); + pigeonResult.setAnotherNullableEnum((AnotherEnum) anotherNullableEnum); + Object aNullableString = pigeonVar_list.get(13); pigeonResult.setANullableString((String) aNullableString); - Object aNullableObject = __pigeon_list.get(13); + Object aNullableObject = pigeonVar_list.get(14); pigeonResult.setANullableObject(aNullableObject); - Object allNullableTypes = __pigeon_list.get(14); + Object allNullableTypes = pigeonVar_list.get(15); pigeonResult.setAllNullableTypes((AllNullableTypes) allNullableTypes); - Object list = __pigeon_list.get(15); + Object list = pigeonVar_list.get(16); pigeonResult.setList((List) list); - Object stringList = __pigeon_list.get(16); + Object stringList = pigeonVar_list.get(17); pigeonResult.setStringList((List) stringList); - Object intList = __pigeon_list.get(17); + Object intList = pigeonVar_list.get(18); pigeonResult.setIntList((List) intList); - Object doubleList = __pigeon_list.get(18); + Object doubleList = pigeonVar_list.get(19); pigeonResult.setDoubleList((List) doubleList); - Object boolList = __pigeon_list.get(19); + Object boolList = pigeonVar_list.get(20); pigeonResult.setBoolList((List) boolList); - Object nestedClassList = __pigeon_list.get(20); + Object nestedClassList = pigeonVar_list.get(21); pigeonResult.setNestedClassList((List) nestedClassList); - Object map = __pigeon_list.get(21); + Object map = pigeonVar_list.get(22); pigeonResult.setMap((Map) map); return pigeonResult; } @@ -1307,6 +1368,16 @@ public void setANullableEnum(@Nullable AnEnum setterArg) { this.aNullableEnum = setterArg; } + private @Nullable AnotherEnum anotherNullableEnum; + + public @Nullable AnotherEnum getAnotherNullableEnum() { + return anotherNullableEnum; + } + + public void setAnotherNullableEnum(@Nullable AnotherEnum setterArg) { + this.anotherNullableEnum = setterArg; + } + private @Nullable String aNullableString; public @Nullable String getANullableString() { @@ -1408,6 +1479,7 @@ public boolean equals(Object o) { && Objects.equals(nullableMapWithAnnotations, that.nullableMapWithAnnotations) && Objects.equals(nullableMapWithObject, that.nullableMapWithObject) && Objects.equals(aNullableEnum, that.aNullableEnum) + && Objects.equals(anotherNullableEnum, that.anotherNullableEnum) && Objects.equals(aNullableString, that.aNullableString) && Objects.equals(aNullableObject, that.aNullableObject) && Objects.equals(list, that.list) @@ -1420,7 +1492,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - int __pigeon_result = + int pigeonVar_result = Objects.hash( aNullableBool, aNullableInt, @@ -1430,6 +1502,7 @@ public int hashCode() { nullableMapWithAnnotations, nullableMapWithObject, aNullableEnum, + anotherNullableEnum, aNullableString, aNullableObject, list, @@ -1438,11 +1511,11 @@ public int hashCode() { doubleList, boolList, map); - __pigeon_result = 31 * __pigeon_result + Arrays.hashCode(aNullableByteArray); - __pigeon_result = 31 * __pigeon_result + Arrays.hashCode(aNullable4ByteArray); - __pigeon_result = 31 * __pigeon_result + Arrays.hashCode(aNullable8ByteArray); - __pigeon_result = 31 * __pigeon_result + Arrays.hashCode(aNullableFloatArray); - return __pigeon_result; + pigeonVar_result = 31 * pigeonVar_result + Arrays.hashCode(aNullableByteArray); + pigeonVar_result = 31 * pigeonVar_result + Arrays.hashCode(aNullable4ByteArray); + pigeonVar_result = 31 * pigeonVar_result + Arrays.hashCode(aNullable8ByteArray); + pigeonVar_result = 31 * pigeonVar_result + Arrays.hashCode(aNullableFloatArray); + return pigeonVar_result; } public static final class Builder { @@ -1544,6 +1617,14 @@ public static final class Builder { return this; } + private @Nullable AnotherEnum anotherNullableEnum; + + @CanIgnoreReturnValue + public @NonNull Builder setAnotherNullableEnum(@Nullable AnotherEnum setterArg) { + this.anotherNullableEnum = setterArg; + return this; + } + private @Nullable String aNullableString; @CanIgnoreReturnValue @@ -1622,6 +1703,7 @@ public static final class Builder { pigeonReturn.setNullableMapWithAnnotations(nullableMapWithAnnotations); pigeonReturn.setNullableMapWithObject(nullableMapWithObject); pigeonReturn.setANullableEnum(aNullableEnum); + pigeonReturn.setAnotherNullableEnum(anotherNullableEnum); pigeonReturn.setANullableString(aNullableString); pigeonReturn.setANullableObject(aNullableObject); pigeonReturn.setList(list); @@ -1636,7 +1718,7 @@ public static final class Builder { @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList(20); + ArrayList toListResult = new ArrayList<>(21); toListResult.add(aNullableBool); toListResult.add(aNullableInt); toListResult.add(aNullableInt64); @@ -1649,6 +1731,7 @@ ArrayList toList() { toListResult.add(nullableMapWithAnnotations); toListResult.add(nullableMapWithObject); toListResult.add(aNullableEnum); + toListResult.add(anotherNullableEnum); toListResult.add(aNullableString); toListResult.add(aNullableObject); toListResult.add(list); @@ -1661,55 +1744,57 @@ ArrayList toList() { } static @NonNull AllNullableTypesWithoutRecursion fromList( - @NonNull ArrayList __pigeon_list) { + @NonNull ArrayList pigeonVar_list) { AllNullableTypesWithoutRecursion pigeonResult = new AllNullableTypesWithoutRecursion(); - Object aNullableBool = __pigeon_list.get(0); + Object aNullableBool = pigeonVar_list.get(0); pigeonResult.setANullableBool((Boolean) aNullableBool); - Object aNullableInt = __pigeon_list.get(1); + Object aNullableInt = pigeonVar_list.get(1); pigeonResult.setANullableInt( (aNullableInt == null) ? null : ((aNullableInt instanceof Integer) ? (Integer) aNullableInt : (Long) aNullableInt)); - Object aNullableInt64 = __pigeon_list.get(2); + Object aNullableInt64 = pigeonVar_list.get(2); pigeonResult.setANullableInt64( (aNullableInt64 == null) ? null : ((aNullableInt64 instanceof Integer) ? (Integer) aNullableInt64 : (Long) aNullableInt64)); - Object aNullableDouble = __pigeon_list.get(3); + Object aNullableDouble = pigeonVar_list.get(3); pigeonResult.setANullableDouble((Double) aNullableDouble); - Object aNullableByteArray = __pigeon_list.get(4); + Object aNullableByteArray = pigeonVar_list.get(4); pigeonResult.setANullableByteArray((byte[]) aNullableByteArray); - Object aNullable4ByteArray = __pigeon_list.get(5); + Object aNullable4ByteArray = pigeonVar_list.get(5); pigeonResult.setANullable4ByteArray((int[]) aNullable4ByteArray); - Object aNullable8ByteArray = __pigeon_list.get(6); + Object aNullable8ByteArray = pigeonVar_list.get(6); pigeonResult.setANullable8ByteArray((long[]) aNullable8ByteArray); - Object aNullableFloatArray = __pigeon_list.get(7); + Object aNullableFloatArray = pigeonVar_list.get(7); pigeonResult.setANullableFloatArray((double[]) aNullableFloatArray); - Object nullableNestedList = __pigeon_list.get(8); + Object nullableNestedList = pigeonVar_list.get(8); pigeonResult.setNullableNestedList((List>) nullableNestedList); - Object nullableMapWithAnnotations = __pigeon_list.get(9); + Object nullableMapWithAnnotations = pigeonVar_list.get(9); pigeonResult.setNullableMapWithAnnotations((Map) nullableMapWithAnnotations); - Object nullableMapWithObject = __pigeon_list.get(10); + Object nullableMapWithObject = pigeonVar_list.get(10); pigeonResult.setNullableMapWithObject((Map) nullableMapWithObject); - Object aNullableEnum = __pigeon_list.get(11); + Object aNullableEnum = pigeonVar_list.get(11); pigeonResult.setANullableEnum((AnEnum) aNullableEnum); - Object aNullableString = __pigeon_list.get(12); + Object anotherNullableEnum = pigeonVar_list.get(12); + pigeonResult.setAnotherNullableEnum((AnotherEnum) anotherNullableEnum); + Object aNullableString = pigeonVar_list.get(13); pigeonResult.setANullableString((String) aNullableString); - Object aNullableObject = __pigeon_list.get(13); + Object aNullableObject = pigeonVar_list.get(14); pigeonResult.setANullableObject(aNullableObject); - Object list = __pigeon_list.get(14); + Object list = pigeonVar_list.get(15); pigeonResult.setList((List) list); - Object stringList = __pigeon_list.get(15); + Object stringList = pigeonVar_list.get(16); pigeonResult.setStringList((List) stringList); - Object intList = __pigeon_list.get(16); + Object intList = pigeonVar_list.get(17); pigeonResult.setIntList((List) intList); - Object doubleList = __pigeon_list.get(17); + Object doubleList = pigeonVar_list.get(18); pigeonResult.setDoubleList((List) doubleList); - Object boolList = __pigeon_list.get(18); + Object boolList = pigeonVar_list.get(19); pigeonResult.setBoolList((List) boolList); - Object map = __pigeon_list.get(19); + Object map = pigeonVar_list.get(20); pigeonResult.setMap((Map) map); return pigeonResult; } @@ -1819,21 +1904,21 @@ public static final class Builder { @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList(3); + ArrayList toListResult = new ArrayList<>(3); toListResult.add(allNullableTypes); toListResult.add(allNullableTypesWithoutRecursion); toListResult.add(allTypes); return toListResult; } - static @NonNull AllClassesWrapper fromList(@NonNull ArrayList __pigeon_list) { + static @NonNull AllClassesWrapper fromList(@NonNull ArrayList pigeonVar_list) { AllClassesWrapper pigeonResult = new AllClassesWrapper(); - Object allNullableTypes = __pigeon_list.get(0); + Object allNullableTypes = pigeonVar_list.get(0); pigeonResult.setAllNullableTypes((AllNullableTypes) allNullableTypes); - Object allNullableTypesWithoutRecursion = __pigeon_list.get(1); + Object allNullableTypesWithoutRecursion = pigeonVar_list.get(1); pigeonResult.setAllNullableTypesWithoutRecursion( (AllNullableTypesWithoutRecursion) allNullableTypesWithoutRecursion); - Object allTypes = __pigeon_list.get(2); + Object allTypes = pigeonVar_list.get(2); pigeonResult.setAllTypes((AllTypes) allTypes); return pigeonResult; } @@ -1891,14 +1976,14 @@ public static final class Builder { @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList(1); + ArrayList toListResult = new ArrayList<>(1); toListResult.add(testList); return toListResult; } - static @NonNull TestMessage fromList(@NonNull ArrayList __pigeon_list) { + static @NonNull TestMessage fromList(@NonNull ArrayList pigeonVar_list) { TestMessage pigeonResult = new TestMessage(); - Object testList = __pigeon_list.get(0); + Object testList = pigeonVar_list.get(0); pigeonResult.setTestList((List) testList); return pigeonResult; } @@ -1913,18 +1998,25 @@ private PigeonCodec() {} protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { switch (type) { case (byte) 129: - return AllTypes.fromList((ArrayList) readValue(buffer)); + { + Object value = readValue(buffer); + return value == null ? null : AnEnum.values()[(int) value]; + } case (byte) 130: - return AllNullableTypes.fromList((ArrayList) readValue(buffer)); + { + Object value = readValue(buffer); + return value == null ? null : AnotherEnum.values()[(int) value]; + } case (byte) 131: - return AllNullableTypesWithoutRecursion.fromList((ArrayList) readValue(buffer)); + return AllTypes.fromList((ArrayList) readValue(buffer)); case (byte) 132: - return AllClassesWrapper.fromList((ArrayList) readValue(buffer)); + return AllNullableTypes.fromList((ArrayList) readValue(buffer)); case (byte) 133: - return TestMessage.fromList((ArrayList) readValue(buffer)); + return AllNullableTypesWithoutRecursion.fromList((ArrayList) readValue(buffer)); case (byte) 134: - Object value = readValue(buffer); - return value == null ? null : AnEnum.values()[(int) value]; + return AllClassesWrapper.fromList((ArrayList) readValue(buffer)); + case (byte) 135: + return TestMessage.fromList((ArrayList) readValue(buffer)); default: return super.readValueOfType(type, buffer); } @@ -1932,24 +2024,27 @@ protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { @Override protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { - if (value instanceof AllTypes) { + if (value instanceof AnEnum) { stream.write(129); + writeValue(stream, value == null ? null : ((AnEnum) value).index); + } else if (value instanceof AnotherEnum) { + stream.write(130); + writeValue(stream, value == null ? null : ((AnotherEnum) value).index); + } else if (value instanceof AllTypes) { + stream.write(131); writeValue(stream, ((AllTypes) value).toList()); } else if (value instanceof AllNullableTypes) { - stream.write(130); + stream.write(132); writeValue(stream, ((AllNullableTypes) value).toList()); } else if (value instanceof AllNullableTypesWithoutRecursion) { - stream.write(131); + stream.write(133); writeValue(stream, ((AllNullableTypesWithoutRecursion) value).toList()); } else if (value instanceof AllClassesWrapper) { - stream.write(132); + stream.write(134); writeValue(stream, ((AllClassesWrapper) value).toList()); } else if (value instanceof TestMessage) { - stream.write(133); + stream.write(135); writeValue(stream, ((TestMessage) value).toList()); - } else if (value instanceof AnEnum) { - stream.write(134); - writeValue(stream, value == null ? null : ((AnEnum) value).index); } else { super.writeValue(stream, value); } @@ -2032,6 +2127,9 @@ public interface HostIntegrationCoreApi { /** Returns the passed enum to test serialization and deserialization. */ @NonNull AnEnum echoEnum(@NonNull AnEnum anEnum); + /** Returns the passed enum to test serialization and deserialization. */ + @NonNull + AnotherEnum echoAnotherEnum(@NonNull AnotherEnum anotherEnum); /** Returns the default string. */ @NonNull String echoNamedDefaultString(@NonNull String aString); @@ -2097,6 +2195,9 @@ AllNullableTypesWithoutRecursion sendMultipleNullableTypesWithoutRecursion( @Nullable AnEnum echoNullableEnum(@Nullable AnEnum anEnum); + + @Nullable + AnotherEnum echoAnotherNullableEnum(@Nullable AnotherEnum anotherEnum); /** Returns passed in int. */ @Nullable Long echoOptionalNullableInt(@Nullable Long aNullableInt); @@ -2127,6 +2228,9 @@ void echoAsyncMap( @NonNull Map aMap, @NonNull Result> result); /** Returns the passed enum, to test asynchronous serialization and deserialization. */ void echoAsyncEnum(@NonNull AnEnum anEnum, @NonNull Result result); + /** Returns the passed enum, to test asynchronous serialization and deserialization. */ + void echoAnotherAsyncEnum( + @NonNull AnotherEnum anotherEnum, @NonNull Result result); /** Responds with an error from an async function returning a value. */ void throwAsyncError(@NonNull NullableResult result); /** Responds with an error from an async void function. */ @@ -2163,6 +2267,9 @@ void echoAsyncNullableMap( @Nullable Map aMap, @NonNull NullableResult> result); /** Returns the passed enum, to test asynchronous serialization and deserialization. */ void echoAsyncNullableEnum(@Nullable AnEnum anEnum, @NonNull NullableResult result); + /** Returns the passed enum, to test asynchronous serialization and deserialization. */ + void echoAnotherAsyncNullableEnum( + @Nullable AnotherEnum anotherEnum, @NonNull NullableResult result); void callFlutterNoop(@NonNull VoidResult result); @@ -2208,6 +2315,9 @@ void callFlutterEchoMap( void callFlutterEchoEnum(@NonNull AnEnum anEnum, @NonNull Result result); + void callFlutterEchoAnotherEnum( + @NonNull AnotherEnum anotherEnum, @NonNull Result result); + void callFlutterEchoNullableBool( @Nullable Boolean aBool, @NonNull NullableResult result); @@ -2231,6 +2341,9 @@ void callFlutterEchoNullableMap( void callFlutterEchoNullableEnum( @Nullable AnEnum anEnum, @NonNull NullableResult result); + void callFlutterEchoAnotherNullableEnum( + @Nullable AnotherEnum anotherEnum, @NonNull NullableResult result); + void callFlutterSmallApiEchoString(@NonNull String aString, @NonNull Result result); /** The codec used by HostIntegrationCoreApi. */ @@ -2261,13 +2374,12 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); try { api.noop(); wrapped.add(0, null); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -2285,15 +2397,14 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; AllTypes everythingArg = (AllTypes) args.get(0); try { AllTypes output = api.echoAllTypes(everythingArg); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -2311,13 +2422,12 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); try { Object output = api.throwError(); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -2335,13 +2445,12 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); try { api.throwErrorFromVoid(); wrapped.add(0, null); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -2359,13 +2468,12 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); try { Object output = api.throwFlutterError(); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -2383,15 +2491,14 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Number anIntArg = (Number) args.get(0); try { Long output = api.echoInt((anIntArg == null) ? null : anIntArg.longValue()); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -2409,15 +2516,14 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Double aDoubleArg = (Double) args.get(0); try { Double output = api.echoDouble(aDoubleArg); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -2435,15 +2541,14 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Boolean aBoolArg = (Boolean) args.get(0); try { Boolean output = api.echoBool(aBoolArg); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -2461,15 +2566,14 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; String aStringArg = (String) args.get(0); try { String output = api.echoString(aStringArg); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -2487,15 +2591,14 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; byte[] aUint8ListArg = (byte[]) args.get(0); try { byte[] output = api.echoUint8List(aUint8ListArg); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -2513,15 +2616,14 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Object anObjectArg = args.get(0); try { Object output = api.echoObject(anObjectArg); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -2539,15 +2641,14 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; List listArg = (List) args.get(0); try { List output = api.echoList(listArg); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -2565,15 +2666,14 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Map aMapArg = (Map) args.get(0); try { Map output = api.echoMap(aMapArg); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -2591,15 +2691,14 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; AllClassesWrapper wrapperArg = (AllClassesWrapper) args.get(0); try { AllClassesWrapper output = api.echoClassWrapper(wrapperArg); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -2617,15 +2716,39 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; AnEnum anEnumArg = (AnEnum) args.get(0); try { AnEnum output = api.echoEnum(anEnumArg); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAnotherEnum" + + messageChannelSuffix, + getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + ArrayList args = (ArrayList) message; + AnotherEnum anotherEnumArg = (AnotherEnum) args.get(0); + try { + AnotherEnum output = api.echoAnotherEnum(anotherEnumArg); + wrapped.add(0, output); + } catch (Throwable exception) { + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -2643,15 +2766,14 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; String aStringArg = (String) args.get(0); try { String output = api.echoNamedDefaultString(aStringArg); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -2669,15 +2791,14 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Double aDoubleArg = (Double) args.get(0); try { Double output = api.echoOptionalDefaultDouble(aDoubleArg); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -2695,7 +2816,7 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Number anIntArg = (Number) args.get(0); try { @@ -2703,8 +2824,7 @@ static void setUp( api.echoRequiredInt((anIntArg == null) ? null : anIntArg.longValue()); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -2722,15 +2842,14 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; AllNullableTypes everythingArg = (AllNullableTypes) args.get(0); try { AllNullableTypes output = api.echoAllNullableTypes(everythingArg); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -2748,7 +2867,7 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; AllNullableTypesWithoutRecursion everythingArg = (AllNullableTypesWithoutRecursion) args.get(0); @@ -2757,8 +2876,7 @@ static void setUp( api.echoAllNullableTypesWithoutRecursion(everythingArg); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -2776,15 +2894,14 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; AllClassesWrapper wrapperArg = (AllClassesWrapper) args.get(0); try { String output = api.extractNestedNullableString(wrapperArg); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -2802,15 +2919,14 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; String nullableStringArg = (String) args.get(0); try { AllClassesWrapper output = api.createNestedNullableString(nullableStringArg); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -2828,7 +2944,7 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Boolean aNullableBoolArg = (Boolean) args.get(0); Number aNullableIntArg = (Number) args.get(1); @@ -2841,8 +2957,7 @@ static void setUp( aNullableStringArg); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -2860,7 +2975,7 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Boolean aNullableBoolArg = (Boolean) args.get(0); Number aNullableIntArg = (Number) args.get(1); @@ -2873,8 +2988,7 @@ static void setUp( aNullableStringArg); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -2892,7 +3006,7 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Number aNullableIntArg = (Number) args.get(0); try { @@ -2901,8 +3015,7 @@ static void setUp( (aNullableIntArg == null) ? null : aNullableIntArg.longValue()); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -2920,15 +3033,14 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Double aNullableDoubleArg = (Double) args.get(0); try { Double output = api.echoNullableDouble(aNullableDoubleArg); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -2946,15 +3058,14 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Boolean aNullableBoolArg = (Boolean) args.get(0); try { Boolean output = api.echoNullableBool(aNullableBoolArg); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -2972,15 +3083,14 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; String aNullableStringArg = (String) args.get(0); try { String output = api.echoNullableString(aNullableStringArg); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -2998,15 +3108,14 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; byte[] aNullableUint8ListArg = (byte[]) args.get(0); try { byte[] output = api.echoNullableUint8List(aNullableUint8ListArg); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -3024,15 +3133,14 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Object aNullableObjectArg = args.get(0); try { Object output = api.echoNullableObject(aNullableObjectArg); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -3050,15 +3158,14 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; List aNullableListArg = (List) args.get(0); try { List output = api.echoNullableList(aNullableListArg); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -3076,15 +3183,14 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Map aNullableMapArg = (Map) args.get(0); try { Map output = api.echoNullableMap(aNullableMapArg); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -3102,15 +3208,39 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; AnEnum anEnumArg = (AnEnum) args.get(0); try { AnEnum output = api.echoNullableEnum(anEnumArg); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAnotherNullableEnum" + + messageChannelSuffix, + getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + ArrayList args = (ArrayList) message; + AnotherEnum anotherEnumArg = (AnotherEnum) args.get(0); + try { + AnotherEnum output = api.echoAnotherNullableEnum(anotherEnumArg); + wrapped.add(0, output); + } catch (Throwable exception) { + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -3128,7 +3258,7 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Number aNullableIntArg = (Number) args.get(0); try { @@ -3137,8 +3267,7 @@ static void setUp( (aNullableIntArg == null) ? null : aNullableIntArg.longValue()); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -3156,15 +3285,14 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; String aNullableStringArg = (String) args.get(0); try { String output = api.echoNamedNullableString(aNullableStringArg); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -3182,7 +3310,7 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); VoidResult resultCallback = new VoidResult() { public void success() { @@ -3212,7 +3340,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Number anIntArg = (Number) args.get(0); Result resultCallback = @@ -3244,7 +3372,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Double aDoubleArg = (Double) args.get(0); Result resultCallback = @@ -3276,7 +3404,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Boolean aBoolArg = (Boolean) args.get(0); Result resultCallback = @@ -3308,7 +3436,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; String aStringArg = (String) args.get(0); Result resultCallback = @@ -3340,7 +3468,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; byte[] aUint8ListArg = (byte[]) args.get(0); Result resultCallback = @@ -3372,7 +3500,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Object anObjectArg = args.get(0); Result resultCallback = @@ -3404,7 +3532,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; List listArg = (List) args.get(0); Result> resultCallback = @@ -3436,7 +3564,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Map aMapArg = (Map) args.get(0); Result> resultCallback = @@ -3468,7 +3596,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; AnEnum anEnumArg = (AnEnum) args.get(0); Result resultCallback = @@ -3490,6 +3618,38 @@ public void error(Throwable error) { channel.setMessageHandler(null); } } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAnotherAsyncEnum" + + messageChannelSuffix, + getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + ArrayList args = (ArrayList) message; + AnotherEnum anotherEnumArg = (AnotherEnum) args.get(0); + Result resultCallback = + new Result() { + public void success(AnotherEnum result) { + wrapped.add(0, result); + reply.reply(wrapped); + } + + public void error(Throwable error) { + ArrayList wrappedError = wrapError(error); + reply.reply(wrappedError); + } + }; + + api.echoAnotherAsyncEnum(anotherEnumArg, resultCallback); + }); + } else { + channel.setMessageHandler(null); + } + } { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -3500,7 +3660,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); NullableResult resultCallback = new NullableResult() { public void success(Object result) { @@ -3530,7 +3690,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); VoidResult resultCallback = new VoidResult() { public void success() { @@ -3560,7 +3720,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); NullableResult resultCallback = new NullableResult() { public void success(Object result) { @@ -3590,7 +3750,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; AllTypes everythingArg = (AllTypes) args.get(0); Result resultCallback = @@ -3622,7 +3782,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; AllNullableTypes everythingArg = (AllNullableTypes) args.get(0); NullableResult resultCallback = @@ -3654,7 +3814,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; AllNullableTypesWithoutRecursion everythingArg = (AllNullableTypesWithoutRecursion) args.get(0); @@ -3688,7 +3848,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Number anIntArg = (Number) args.get(0); NullableResult resultCallback = @@ -3721,7 +3881,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Double aDoubleArg = (Double) args.get(0); NullableResult resultCallback = @@ -3753,7 +3913,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Boolean aBoolArg = (Boolean) args.get(0); NullableResult resultCallback = @@ -3785,7 +3945,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; String aStringArg = (String) args.get(0); NullableResult resultCallback = @@ -3817,7 +3977,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; byte[] aUint8ListArg = (byte[]) args.get(0); NullableResult resultCallback = @@ -3849,7 +4009,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Object anObjectArg = args.get(0); NullableResult resultCallback = @@ -3881,7 +4041,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; List listArg = (List) args.get(0); NullableResult> resultCallback = @@ -3913,7 +4073,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Map aMapArg = (Map) args.get(0); NullableResult> resultCallback = @@ -3945,7 +4105,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; AnEnum anEnumArg = (AnEnum) args.get(0); NullableResult resultCallback = @@ -3967,6 +4127,38 @@ public void error(Throwable error) { channel.setMessageHandler(null); } } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAnotherAsyncNullableEnum" + + messageChannelSuffix, + getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + ArrayList args = (ArrayList) message; + AnotherEnum anotherEnumArg = (AnotherEnum) args.get(0); + NullableResult resultCallback = + new NullableResult() { + public void success(AnotherEnum result) { + wrapped.add(0, result); + reply.reply(wrapped); + } + + public void error(Throwable error) { + ArrayList wrappedError = wrapError(error); + reply.reply(wrappedError); + } + }; + + api.echoAnotherAsyncNullableEnum(anotherEnumArg, resultCallback); + }); + } else { + channel.setMessageHandler(null); + } + } { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -3977,7 +4169,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); VoidResult resultCallback = new VoidResult() { public void success() { @@ -4007,7 +4199,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); NullableResult resultCallback = new NullableResult() { public void success(Object result) { @@ -4037,7 +4229,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); VoidResult resultCallback = new VoidResult() { public void success() { @@ -4067,7 +4259,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; AllTypes everythingArg = (AllTypes) args.get(0); Result resultCallback = @@ -4099,7 +4291,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; AllNullableTypes everythingArg = (AllNullableTypes) args.get(0); NullableResult resultCallback = @@ -4131,7 +4323,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Boolean aNullableBoolArg = (Boolean) args.get(0); Number aNullableIntArg = (Number) args.get(1); @@ -4169,7 +4361,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; AllNullableTypesWithoutRecursion everythingArg = (AllNullableTypesWithoutRecursion) args.get(0); @@ -4202,7 +4394,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Boolean aNullableBoolArg = (Boolean) args.get(0); Number aNullableIntArg = (Number) args.get(1); @@ -4240,7 +4432,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Boolean aBoolArg = (Boolean) args.get(0); Result resultCallback = @@ -4272,7 +4464,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Number anIntArg = (Number) args.get(0); Result resultCallback = @@ -4305,7 +4497,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Double aDoubleArg = (Double) args.get(0); Result resultCallback = @@ -4337,7 +4529,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; String aStringArg = (String) args.get(0); Result resultCallback = @@ -4369,7 +4561,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; byte[] listArg = (byte[]) args.get(0); Result resultCallback = @@ -4401,7 +4593,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; List listArg = (List) args.get(0); Result> resultCallback = @@ -4433,7 +4625,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Map aMapArg = (Map) args.get(0); Result> resultCallback = @@ -4465,7 +4657,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; AnEnum anEnumArg = (AnEnum) args.get(0); Result resultCallback = @@ -4487,6 +4679,38 @@ public void error(Throwable error) { channel.setMessageHandler(null); } } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAnotherEnum" + + messageChannelSuffix, + getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + ArrayList args = (ArrayList) message; + AnotherEnum anotherEnumArg = (AnotherEnum) args.get(0); + Result resultCallback = + new Result() { + public void success(AnotherEnum result) { + wrapped.add(0, result); + reply.reply(wrapped); + } + + public void error(Throwable error) { + ArrayList wrappedError = wrapError(error); + reply.reply(wrappedError); + } + }; + + api.callFlutterEchoAnotherEnum(anotherEnumArg, resultCallback); + }); + } else { + channel.setMessageHandler(null); + } + } { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -4497,7 +4721,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Boolean aBoolArg = (Boolean) args.get(0); NullableResult resultCallback = @@ -4529,7 +4753,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Number anIntArg = (Number) args.get(0); NullableResult resultCallback = @@ -4562,7 +4786,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Double aDoubleArg = (Double) args.get(0); NullableResult resultCallback = @@ -4594,7 +4818,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; String aStringArg = (String) args.get(0); NullableResult resultCallback = @@ -4626,7 +4850,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; byte[] listArg = (byte[]) args.get(0); NullableResult resultCallback = @@ -4658,7 +4882,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; List listArg = (List) args.get(0); NullableResult> resultCallback = @@ -4690,7 +4914,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; Map aMapArg = (Map) args.get(0); NullableResult> resultCallback = @@ -4722,7 +4946,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; AnEnum anEnumArg = (AnEnum) args.get(0); NullableResult resultCallback = @@ -4744,6 +4968,38 @@ public void error(Throwable error) { channel.setMessageHandler(null); } } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAnotherNullableEnum" + + messageChannelSuffix, + getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + ArrayList args = (ArrayList) message; + AnotherEnum anotherEnumArg = (AnotherEnum) args.get(0); + NullableResult resultCallback = + new NullableResult() { + public void success(AnotherEnum result) { + wrapped.add(0, result); + reply.reply(wrapped); + } + + public void error(Throwable error) { + ArrayList wrappedError = wrapError(error); + reply.reply(wrappedError); + } + }; + + api.callFlutterEchoAnotherNullableEnum(anotherEnumArg, resultCallback); + }); + } else { + channel.setMessageHandler(null); + } + } { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -4754,7 +5010,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; String aStringArg = (String) args.get(0); Result resultCallback = @@ -4798,8 +5054,7 @@ public FlutterIntegrationCoreApi( this.messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; } - /** Public interface for sending reply. */ - /** The codec used by FlutterIntegrationCoreApi. */ + /** Public interface for sending reply. The codec used by FlutterIntegrationCoreApi. */ static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } @@ -4820,9 +5075,7 @@ public void noop(@NonNull VoidResult result) { if (listReply.size() > 1) { result.error( new FlutterError( - (String) listReply.get(0), - (String) listReply.get(1), - (String) listReply.get(2))); + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else { result.success(); } @@ -4846,9 +5099,7 @@ public void throwError(@NonNull NullableResult result) { if (listReply.size() > 1) { result.error( new FlutterError( - (String) listReply.get(0), - (String) listReply.get(1), - (String) listReply.get(2))); + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else { @SuppressWarnings("ConstantConditions") Object output = listReply.get(0); @@ -4874,9 +5125,7 @@ public void throwErrorFromVoid(@NonNull VoidResult result) { if (listReply.size() > 1) { result.error( new FlutterError( - (String) listReply.get(0), - (String) listReply.get(1), - (String) listReply.get(2))); + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else { result.success(); } @@ -4893,16 +5142,14 @@ public void echoAllTypes(@NonNull AllTypes everythingArg, @NonNull Result channel = new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( - new ArrayList(Collections.singletonList(everythingArg)), + new ArrayList<>(Collections.singletonList(everythingArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { result.error( new FlutterError( - (String) listReply.get(0), - (String) listReply.get(1), - (String) listReply.get(2))); + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else if (listReply.get(0) == null) { result.error( new FlutterError( @@ -4929,16 +5176,14 @@ public void echoAllNullableTypes( BasicMessageChannel channel = new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( - new ArrayList(Collections.singletonList(everythingArg)), + new ArrayList<>(Collections.singletonList(everythingArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { result.error( new FlutterError( - (String) listReply.get(0), - (String) listReply.get(1), - (String) listReply.get(2))); + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else { @SuppressWarnings("ConstantConditions") AllNullableTypes output = (AllNullableTypes) listReply.get(0); @@ -4965,17 +5210,14 @@ public void sendMultipleNullableTypes( BasicMessageChannel channel = new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( - new ArrayList( - Arrays.asList(aNullableBoolArg, aNullableIntArg, aNullableStringArg)), + new ArrayList<>(Arrays.asList(aNullableBoolArg, aNullableIntArg, aNullableStringArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { result.error( new FlutterError( - (String) listReply.get(0), - (String) listReply.get(1), - (String) listReply.get(2))); + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else if (listReply.get(0) == null) { result.error( new FlutterError( @@ -5002,16 +5244,14 @@ public void echoAllNullableTypesWithoutRecursion( BasicMessageChannel channel = new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( - new ArrayList(Collections.singletonList(everythingArg)), + new ArrayList<>(Collections.singletonList(everythingArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { result.error( new FlutterError( - (String) listReply.get(0), - (String) listReply.get(1), - (String) listReply.get(2))); + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else { @SuppressWarnings("ConstantConditions") AllNullableTypesWithoutRecursion output = @@ -5039,17 +5279,14 @@ public void sendMultipleNullableTypesWithoutRecursion( BasicMessageChannel channel = new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( - new ArrayList( - Arrays.asList(aNullableBoolArg, aNullableIntArg, aNullableStringArg)), + new ArrayList<>(Arrays.asList(aNullableBoolArg, aNullableIntArg, aNullableStringArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { result.error( new FlutterError( - (String) listReply.get(0), - (String) listReply.get(1), - (String) listReply.get(2))); + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else if (listReply.get(0) == null) { result.error( new FlutterError( @@ -5075,16 +5312,14 @@ public void echoBool(@NonNull Boolean aBoolArg, @NonNull Result result) BasicMessageChannel channel = new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( - new ArrayList(Collections.singletonList(aBoolArg)), + new ArrayList<>(Collections.singletonList(aBoolArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { result.error( new FlutterError( - (String) listReply.get(0), - (String) listReply.get(1), - (String) listReply.get(2))); + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else if (listReply.get(0) == null) { result.error( new FlutterError( @@ -5109,16 +5344,14 @@ public void echoInt(@NonNull Long anIntArg, @NonNull Result result) { BasicMessageChannel channel = new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( - new ArrayList(Collections.singletonList(anIntArg)), + new ArrayList<>(Collections.singletonList(anIntArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { result.error( new FlutterError( - (String) listReply.get(0), - (String) listReply.get(1), - (String) listReply.get(2))); + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else if (listReply.get(0) == null) { result.error( new FlutterError( @@ -5144,16 +5377,14 @@ public void echoDouble(@NonNull Double aDoubleArg, @NonNull Result resul BasicMessageChannel channel = new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( - new ArrayList(Collections.singletonList(aDoubleArg)), + new ArrayList<>(Collections.singletonList(aDoubleArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { result.error( new FlutterError( - (String) listReply.get(0), - (String) listReply.get(1), - (String) listReply.get(2))); + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else if (listReply.get(0) == null) { result.error( new FlutterError( @@ -5178,16 +5409,14 @@ public void echoString(@NonNull String aStringArg, @NonNull Result resul BasicMessageChannel channel = new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( - new ArrayList(Collections.singletonList(aStringArg)), + new ArrayList<>(Collections.singletonList(aStringArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { result.error( new FlutterError( - (String) listReply.get(0), - (String) listReply.get(1), - (String) listReply.get(2))); + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else if (listReply.get(0) == null) { result.error( new FlutterError( @@ -5212,16 +5441,14 @@ public void echoUint8List(@NonNull byte[] listArg, @NonNull Result resul BasicMessageChannel channel = new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( - new ArrayList(Collections.singletonList(listArg)), + new ArrayList<>(Collections.singletonList(listArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { result.error( new FlutterError( - (String) listReply.get(0), - (String) listReply.get(1), - (String) listReply.get(2))); + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else if (listReply.get(0) == null) { result.error( new FlutterError( @@ -5246,16 +5473,14 @@ public void echoList(@NonNull List listArg, @NonNull Result BasicMessageChannel channel = new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( - new ArrayList(Collections.singletonList(listArg)), + new ArrayList<>(Collections.singletonList(listArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { result.error( new FlutterError( - (String) listReply.get(0), - (String) listReply.get(1), - (String) listReply.get(2))); + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else if (listReply.get(0) == null) { result.error( new FlutterError( @@ -5281,16 +5506,14 @@ public void echoMap( BasicMessageChannel channel = new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( - new ArrayList(Collections.singletonList(aMapArg)), + new ArrayList<>(Collections.singletonList(aMapArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { result.error( new FlutterError( - (String) listReply.get(0), - (String) listReply.get(1), - (String) listReply.get(2))); + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else if (listReply.get(0) == null) { result.error( new FlutterError( @@ -5315,16 +5538,14 @@ public void echoEnum(@NonNull AnEnum anEnumArg, @NonNull Result result) BasicMessageChannel channel = new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( - new ArrayList(Collections.singletonList(anEnumArg)), + new ArrayList<>(Collections.singletonList(anEnumArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { result.error( new FlutterError( - (String) listReply.get(0), - (String) listReply.get(1), - (String) listReply.get(2))); + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else if (listReply.get(0) == null) { result.error( new FlutterError( @@ -5341,6 +5562,39 @@ public void echoEnum(@NonNull AnEnum anEnumArg, @NonNull Result result) } }); } + /** Returns the passed enum to test serialization and deserialization. */ + public void echoAnotherEnum( + @NonNull AnotherEnum anotherEnumArg, @NonNull Result result) { + final String channelName = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAnotherEnum" + + messageChannelSuffix; + BasicMessageChannel channel = + new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); + channel.send( + new ArrayList<>(Collections.singletonList(anotherEnumArg)), + channelReply -> { + if (channelReply instanceof List) { + List listReply = (List) channelReply; + if (listReply.size() > 1) { + result.error( + new FlutterError( + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); + } else if (listReply.get(0) == null) { + result.error( + new FlutterError( + "null-error", + "Flutter api returned null value for non-null return value.", + "")); + } else { + @SuppressWarnings("ConstantConditions") + AnotherEnum output = (AnotherEnum) listReply.get(0); + result.success(output); + } + } else { + result.error(createConnectionError(channelName)); + } + }); + } /** Returns the passed boolean, to test serialization and deserialization. */ public void echoNullableBool( @Nullable Boolean aBoolArg, @NonNull NullableResult result) { @@ -5350,16 +5604,14 @@ public void echoNullableBool( BasicMessageChannel channel = new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( - new ArrayList(Collections.singletonList(aBoolArg)), + new ArrayList<>(Collections.singletonList(aBoolArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { result.error( new FlutterError( - (String) listReply.get(0), - (String) listReply.get(1), - (String) listReply.get(2))); + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else { @SuppressWarnings("ConstantConditions") Boolean output = (Boolean) listReply.get(0); @@ -5378,16 +5630,14 @@ public void echoNullableInt(@Nullable Long anIntArg, @NonNull NullableResult channel = new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( - new ArrayList(Collections.singletonList(anIntArg)), + new ArrayList<>(Collections.singletonList(anIntArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { result.error( new FlutterError( - (String) listReply.get(0), - (String) listReply.get(1), - (String) listReply.get(2))); + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else { @SuppressWarnings("ConstantConditions") Long output = @@ -5408,16 +5658,14 @@ public void echoNullableDouble( BasicMessageChannel channel = new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( - new ArrayList(Collections.singletonList(aDoubleArg)), + new ArrayList<>(Collections.singletonList(aDoubleArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { result.error( new FlutterError( - (String) listReply.get(0), - (String) listReply.get(1), - (String) listReply.get(2))); + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else { @SuppressWarnings("ConstantConditions") Double output = (Double) listReply.get(0); @@ -5437,16 +5685,14 @@ public void echoNullableString( BasicMessageChannel channel = new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( - new ArrayList(Collections.singletonList(aStringArg)), + new ArrayList<>(Collections.singletonList(aStringArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { result.error( new FlutterError( - (String) listReply.get(0), - (String) listReply.get(1), - (String) listReply.get(2))); + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else { @SuppressWarnings("ConstantConditions") String output = (String) listReply.get(0); @@ -5466,16 +5712,14 @@ public void echoNullableUint8List( BasicMessageChannel channel = new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( - new ArrayList(Collections.singletonList(listArg)), + new ArrayList<>(Collections.singletonList(listArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { result.error( new FlutterError( - (String) listReply.get(0), - (String) listReply.get(1), - (String) listReply.get(2))); + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else { @SuppressWarnings("ConstantConditions") byte[] output = (byte[]) listReply.get(0); @@ -5495,16 +5739,14 @@ public void echoNullableList( BasicMessageChannel channel = new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( - new ArrayList(Collections.singletonList(listArg)), + new ArrayList<>(Collections.singletonList(listArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { result.error( new FlutterError( - (String) listReply.get(0), - (String) listReply.get(1), - (String) listReply.get(2))); + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else { @SuppressWarnings("ConstantConditions") List output = (List) listReply.get(0); @@ -5525,16 +5767,14 @@ public void echoNullableMap( BasicMessageChannel channel = new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( - new ArrayList(Collections.singletonList(aMapArg)), + new ArrayList<>(Collections.singletonList(aMapArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { result.error( new FlutterError( - (String) listReply.get(0), - (String) listReply.get(1), - (String) listReply.get(2))); + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else { @SuppressWarnings("ConstantConditions") Map output = (Map) listReply.get(0); @@ -5554,16 +5794,14 @@ public void echoNullableEnum( BasicMessageChannel channel = new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( - new ArrayList(Collections.singletonList(anEnumArg)), + new ArrayList<>(Collections.singletonList(anEnumArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { result.error( new FlutterError( - (String) listReply.get(0), - (String) listReply.get(1), - (String) listReply.get(2))); + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else { @SuppressWarnings("ConstantConditions") AnEnum output = (AnEnum) listReply.get(0); @@ -5574,6 +5812,33 @@ public void echoNullableEnum( } }); } + /** Returns the passed enum to test serialization and deserialization. */ + public void echoAnotherNullableEnum( + @Nullable AnotherEnum anotherEnumArg, @NonNull NullableResult result) { + final String channelName = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAnotherNullableEnum" + + messageChannelSuffix; + BasicMessageChannel channel = + new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); + channel.send( + new ArrayList<>(Collections.singletonList(anotherEnumArg)), + channelReply -> { + if (channelReply instanceof List) { + List listReply = (List) channelReply; + if (listReply.size() > 1) { + result.error( + new FlutterError( + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); + } else { + @SuppressWarnings("ConstantConditions") + AnotherEnum output = (AnotherEnum) listReply.get(0); + result.success(output); + } + } else { + result.error(createConnectionError(channelName)); + } + }); + } /** * A no-op function taking no arguments and returning no value, to sanity test basic * asynchronous calling. @@ -5592,9 +5857,7 @@ public void noopAsync(@NonNull VoidResult result) { if (listReply.size() > 1) { result.error( new FlutterError( - (String) listReply.get(0), - (String) listReply.get(1), - (String) listReply.get(2))); + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else { result.success(); } @@ -5611,16 +5874,14 @@ public void echoAsyncString(@NonNull String aStringArg, @NonNull Result BasicMessageChannel channel = new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( - new ArrayList(Collections.singletonList(aStringArg)), + new ArrayList<>(Collections.singletonList(aStringArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { result.error( new FlutterError( - (String) listReply.get(0), - (String) listReply.get(1), - (String) listReply.get(2))); + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else if (listReply.get(0) == null) { result.error( new FlutterError( @@ -5671,13 +5932,12 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); try { api.noop(); wrapped.add(0, null); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -5722,7 +5982,7 @@ static void setUp( if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; String aStringArg = (String) args.get(0); Result resultCallback = @@ -5754,7 +6014,7 @@ public void error(Throwable error) { if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); VoidResult resultCallback = new VoidResult() { public void success() { @@ -5795,8 +6055,7 @@ public FlutterSmallApi( this.messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; } - /** Public interface for sending reply. */ - /** The codec used by FlutterSmallApi. */ + /** Public interface for sending reply. The codec used by FlutterSmallApi. */ static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } @@ -5808,16 +6067,14 @@ public void echoWrappedList(@NonNull TestMessage msgArg, @NonNull Result channel = new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( - new ArrayList(Collections.singletonList(msgArg)), + new ArrayList<>(Collections.singletonList(msgArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { result.error( new FlutterError( - (String) listReply.get(0), - (String) listReply.get(1), - (String) listReply.get(2))); + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else if (listReply.get(0) == null) { result.error( new FlutterError( @@ -5842,16 +6099,14 @@ public void echoString(@NonNull String aStringArg, @NonNull Result resul BasicMessageChannel channel = new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( - new ArrayList(Collections.singletonList(aStringArg)), + new ArrayList<>(Collections.singletonList(aStringArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { result.error( new FlutterError( - (String) listReply.get(0), - (String) listReply.get(1), - (String) listReply.get(2))); + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else if (listReply.get(0) == null) { result.error( new FlutterError( diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/AllDatatypesTest.java b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/AllDatatypesTest.java index 20146fdc0e0..99bbb49c7ec 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/AllDatatypesTest.java +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/AllDatatypesTest.java @@ -34,6 +34,7 @@ void compareAllTypes(AllTypes firstTypes, AllTypes secondTypes) { assertArrayEquals(firstTypes.getA8ByteArray(), secondTypes.getA8ByteArray()); assertTrue(floatArraysEqual(firstTypes.getAFloatArray(), secondTypes.getAFloatArray())); assertEquals(firstTypes.getAnEnum(), secondTypes.getAnEnum()); + assertEquals(firstTypes.getAnotherEnum(), secondTypes.getAnotherEnum()); assertEquals(firstTypes.getAnObject(), secondTypes.getAnObject()); assertArrayEquals(firstTypes.getList().toArray(), secondTypes.getList().toArray()); assertArrayEquals(firstTypes.getStringList().toArray(), secondTypes.getStringList().toArray()); @@ -175,6 +176,7 @@ public void hasValues() { .setA8ByteArray(new long[] {1, 2, 3, 4}) .setAFloatArray(new double[] {0.5, 0.25, 1.5, 1.25}) .setAnEnum(CoreTests.AnEnum.ONE) + .setAnotherEnum(CoreTests.AnotherEnum.JUST_IN_CASE) .setAnObject(0) .setBoolList(Arrays.asList(new Boolean[] {true, false})) .setDoubleList(Arrays.asList(new Double[] {0.5, 0.25, 1.5, 1.25})) diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/AlternateLanguageTestPlugin.m b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/AlternateLanguageTestPlugin.m index 4ea9519033c..ef45caaf12e 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/AlternateLanguageTestPlugin.m +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/AlternateLanguageTestPlugin.m @@ -110,6 +110,11 @@ - (FLTAnEnumBox *_Nullable)echoEnum:(FLTAnEnum)anEnum return [[FLTAnEnumBox alloc] initWithValue:anEnum]; } +- (FLTAnotherEnumBox *_Nullable)echoAnotherEnum:(FLTAnotherEnum)anotherEnum + error:(FlutterError *_Nullable *_Nonnull)error { + return [[FLTAnotherEnumBox alloc] initWithValue:anotherEnum]; +} + - (nullable NSString *)echoNamedDefaultString:(NSString *)aString error:(FlutterError *_Nullable *_Nonnull)error { return aString; @@ -214,6 +219,12 @@ - (FLTAnEnumBox *_Nullable)echoNullableEnum:(nullable FLTAnEnumBox *)AnEnumBoxed return AnEnumBoxed; } +- (FLTAnotherEnumBox *_Nullable)echoAnotherNullableEnum: + (nullable FLTAnotherEnumBox *)AnotherEnumBoxed + error:(FlutterError *_Nullable *_Nonnull)error { + return AnotherEnumBoxed; +} + - (nullable NSNumber *)echoOptionalNullableInt:(nullable NSNumber *)aNullableInt error:(FlutterError *_Nullable *_Nonnull)error { return aNullableInt; @@ -309,6 +320,12 @@ - (void)echoAsyncEnum:(FLTAnEnum)anEnum completion([[FLTAnEnumBox alloc] initWithValue:anEnum], nil); } +- (void)echoAnotherAsyncEnum:(FLTAnotherEnum)anotherEnum + completion: + (void (^)(FLTAnotherEnumBox *_Nullable, FlutterError *_Nullable))completion { + completion([[FLTAnotherEnumBox alloc] initWithValue:anotherEnum], nil); +} + - (void)echoAsyncNullableInt:(nullable NSNumber *)anInt completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion { completion(anInt, nil); @@ -358,6 +375,12 @@ - (void)echoAsyncNullableEnum:(nullable FLTAnEnumBox *)AnEnumBoxed completion(AnEnumBoxed, nil); } +- (void)echoAnotherAsyncNullableEnum:(nullable FLTAnotherEnumBox *)AnotherEnumBoxed + completion:(void (^)(FLTAnotherEnumBox *_Nullable, + FlutterError *_Nullable))completion { + completion(AnotherEnumBoxed, nil); +} + - (void)callFlutterNoopWithCompletion:(void (^)(FlutterError *_Nullable))completion { [self.flutterAPI noopWithCompletion:^(FlutterError *error) { completion(error); @@ -485,6 +508,15 @@ - (void)callFlutterEchoEnum:(FLTAnEnum)anEnum }]; } +- (void)callFlutterEchoAnotherEnum:(FLTAnotherEnum)anotherEnum + completion:(void (^)(FLTAnotherEnumBox *_Nullable, + FlutterError *_Nullable))completion { + [self.flutterAPI echoAnotherEnum:anotherEnum + completion:^(FLTAnotherEnumBox *value, FlutterError *error) { + completion(value, error); + }]; +} + - (void)callFlutterEchoAllNullableTypes:(nullable FLTAllNullableTypes *)everything completion:(void (^)(FLTAllNullableTypes *_Nullable, FlutterError *_Nullable))completion { @@ -580,6 +612,15 @@ - (void)callFlutterEchoNullableEnum:(nullable FLTAnEnumBox *)AnEnumBoxed }]; } +- (void)callFlutterEchoAnotherNullableEnum:(nullable FLTAnotherEnumBox *)AnotherEnumBoxed + completion:(void (^)(FLTAnotherEnumBox *_Nullable, + FlutterError *_Nullable))completion { + [self.flutterAPI echoAnotherNullableEnum:AnotherEnumBoxed + completion:^(FLTAnotherEnumBox *value, FlutterError *error) { + completion(value, error); + }]; +} + - (void)callFlutterSmallApiEchoString:(nonnull NSString *)aString completion:(nonnull void (^)(NSString *_Nullable, FlutterError *_Nullable))completion { diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h index 2bf7bbf26be..f3fa20aa6a4 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h @@ -28,6 +28,16 @@ typedef NS_ENUM(NSUInteger, FLTAnEnum) { - (instancetype)initWithValue:(FLTAnEnum)value; @end +typedef NS_ENUM(NSUInteger, FLTAnotherEnum) { + FLTAnotherEnumJustInCase = 0, +}; + +/// Wrapper for FLTAnotherEnum to allow for nullability. +@interface FLTAnotherEnumBox : NSObject +@property(nonatomic, assign) FLTAnotherEnum value; +- (instancetype)initWithValue:(FLTAnotherEnum)value; +@end + @class FLTAllTypes; @class FLTAllNullableTypes; @class FLTAllNullableTypesWithoutRecursion; @@ -47,6 +57,7 @@ typedef NS_ENUM(NSUInteger, FLTAnEnum) { a8ByteArray:(FlutterStandardTypedData *)a8ByteArray aFloatArray:(FlutterStandardTypedData *)aFloatArray anEnum:(FLTAnEnum)anEnum + anotherEnum:(FLTAnotherEnum)anotherEnum aString:(NSString *)aString anObject:(id)anObject list:(NSArray *)list @@ -64,6 +75,7 @@ typedef NS_ENUM(NSUInteger, FLTAnEnum) { @property(nonatomic, strong) FlutterStandardTypedData *a8ByteArray; @property(nonatomic, strong) FlutterStandardTypedData *aFloatArray; @property(nonatomic, assign) FLTAnEnum anEnum; +@property(nonatomic, assign) FLTAnotherEnum anotherEnum; @property(nonatomic, copy) NSString *aString; @property(nonatomic, strong) id anObject; @property(nonatomic, copy) NSArray *list; @@ -89,6 +101,7 @@ typedef NS_ENUM(NSUInteger, FLTAnEnum) { (nullable NSDictionary *)nullableMapWithAnnotations nullableMapWithObject:(nullable NSDictionary *)nullableMapWithObject aNullableEnum:(nullable FLTAnEnumBox *)aNullableEnum + anotherNullableEnum:(nullable FLTAnotherEnumBox *)anotherNullableEnum aNullableString:(nullable NSString *)aNullableString aNullableObject:(nullable id)aNullableObject allNullableTypes:(nullable FLTAllNullableTypes *)allNullableTypes @@ -112,6 +125,7 @@ typedef NS_ENUM(NSUInteger, FLTAnEnum) { NSDictionary *nullableMapWithAnnotations; @property(nonatomic, copy, nullable) NSDictionary *nullableMapWithObject; @property(nonatomic, strong, nullable) FLTAnEnumBox *aNullableEnum; +@property(nonatomic, strong, nullable) FLTAnotherEnumBox *anotherNullableEnum; @property(nonatomic, copy, nullable) NSString *aNullableString; @property(nonatomic, strong, nullable) id aNullableObject; @property(nonatomic, strong, nullable) FLTAllNullableTypes *allNullableTypes; @@ -141,6 +155,7 @@ typedef NS_ENUM(NSUInteger, FLTAnEnum) { (nullable NSDictionary *)nullableMapWithAnnotations nullableMapWithObject:(nullable NSDictionary *)nullableMapWithObject aNullableEnum:(nullable FLTAnEnumBox *)aNullableEnum + anotherNullableEnum:(nullable FLTAnotherEnumBox *)anotherNullableEnum aNullableString:(nullable NSString *)aNullableString aNullableObject:(nullable id)aNullableObject list:(nullable NSArray *)list @@ -162,6 +177,7 @@ typedef NS_ENUM(NSUInteger, FLTAnEnum) { NSDictionary *nullableMapWithAnnotations; @property(nonatomic, copy, nullable) NSDictionary *nullableMapWithObject; @property(nonatomic, strong, nullable) FLTAnEnumBox *aNullableEnum; +@property(nonatomic, strong, nullable) FLTAnotherEnumBox *anotherNullableEnum; @property(nonatomic, copy, nullable) NSString *aNullableString; @property(nonatomic, strong, nullable) id aNullableObject; @property(nonatomic, copy, nullable) NSArray *list; @@ -262,6 +278,11 @@ NSObject *FLTGetCoreTestsCodec(void); /// @return `nil` only when `error != nil`. - (FLTAnEnumBox *_Nullable)echoEnum:(FLTAnEnum)anEnum error:(FlutterError *_Nullable *_Nonnull)error; +/// Returns the passed enum to test serialization and deserialization. +/// +/// @return `nil` only when `error != nil`. +- (FLTAnotherEnumBox *_Nullable)echoAnotherEnum:(FLTAnotherEnum)anotherEnum + error:(FlutterError *_Nullable *_Nonnull)error; /// Returns the default string. /// /// @return `nil` only when `error != nil`. @@ -339,6 +360,9 @@ NSObject *FLTGetCoreTestsCodec(void); error:(FlutterError *_Nullable *_Nonnull)error; - (FLTAnEnumBox *_Nullable)echoNullableEnum:(nullable FLTAnEnumBox *)anEnumBoxed error:(FlutterError *_Nullable *_Nonnull)error; +- (FLTAnotherEnumBox *_Nullable)echoAnotherNullableEnum: + (nullable FLTAnotherEnumBox *)anotherEnumBoxed + error:(FlutterError *_Nullable *_Nonnull)error; /// Returns passed in int. - (nullable NSNumber *)echoOptionalNullableInt:(nullable NSNumber *)aNullableInt error:(FlutterError *_Nullable *_Nonnull)error; @@ -377,6 +401,10 @@ NSObject *FLTGetCoreTestsCodec(void); /// Returns the passed enum, to test asynchronous serialization and deserialization. - (void)echoAsyncEnum:(FLTAnEnum)anEnum completion:(void (^)(FLTAnEnumBox *_Nullable, FlutterError *_Nullable))completion; +/// Returns the passed enum, to test asynchronous serialization and deserialization. +- (void)echoAnotherAsyncEnum:(FLTAnotherEnum)anotherEnum + completion: + (void (^)(FLTAnotherEnumBox *_Nullable, FlutterError *_Nullable))completion; /// Responds with an error from an async function returning a value. - (void)throwAsyncErrorWithCompletion:(void (^)(id _Nullable, FlutterError *_Nullable))completion; /// Responds with an error from an async void function. @@ -428,6 +456,10 @@ NSObject *FLTGetCoreTestsCodec(void); - (void)echoAsyncNullableEnum:(nullable FLTAnEnumBox *)anEnumBoxed completion: (void (^)(FLTAnEnumBox *_Nullable, FlutterError *_Nullable))completion; +/// Returns the passed enum, to test asynchronous serialization and deserialization. +- (void)echoAnotherAsyncNullableEnum:(nullable FLTAnotherEnumBox *)anotherEnumBoxed + completion:(void (^)(FLTAnotherEnumBox *_Nullable, + FlutterError *_Nullable))completion; - (void)callFlutterNoopWithCompletion:(void (^)(FlutterError *_Nullable))completion; - (void)callFlutterThrowErrorWithCompletion:(void (^)(id _Nullable, FlutterError *_Nullable))completion; @@ -476,6 +508,9 @@ NSObject *FLTGetCoreTestsCodec(void); FlutterError *_Nullable))completion; - (void)callFlutterEchoEnum:(FLTAnEnum)anEnum completion:(void (^)(FLTAnEnumBox *_Nullable, FlutterError *_Nullable))completion; +- (void)callFlutterEchoAnotherEnum:(FLTAnotherEnum)anotherEnum + completion:(void (^)(FLTAnotherEnumBox *_Nullable, + FlutterError *_Nullable))completion; - (void)callFlutterEchoNullableBool:(nullable NSNumber *)aBool completion: (void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; @@ -500,6 +535,9 @@ NSObject *FLTGetCoreTestsCodec(void); - (void)callFlutterEchoNullableEnum:(nullable FLTAnEnumBox *)anEnumBoxed completion: (void (^)(FLTAnEnumBox *_Nullable, FlutterError *_Nullable))completion; +- (void)callFlutterEchoAnotherNullableEnum:(nullable FLTAnotherEnumBox *)anotherEnumBoxed + completion:(void (^)(FLTAnotherEnumBox *_Nullable, + FlutterError *_Nullable))completion; - (void)callFlutterSmallApiEchoString:(NSString *)aString completion: (void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; @@ -581,6 +619,9 @@ extern void SetUpFLTHostIntegrationCoreApiWithSuffix( /// Returns the passed enum to test serialization and deserialization. - (void)echoEnum:(FLTAnEnum)anEnum completion:(void (^)(FLTAnEnumBox *_Nullable, FlutterError *_Nullable))completion; +/// Returns the passed enum to test serialization and deserialization. +- (void)echoAnotherEnum:(FLTAnotherEnum)anotherEnum + completion:(void (^)(FLTAnotherEnumBox *_Nullable, FlutterError *_Nullable))completion; /// Returns the passed boolean, to test serialization and deserialization. - (void)echoNullableBool:(nullable NSNumber *)aBool completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; @@ -607,6 +648,10 @@ extern void SetUpFLTHostIntegrationCoreApiWithSuffix( /// Returns the passed enum to test serialization and deserialization. - (void)echoNullableEnum:(nullable FLTAnEnumBox *)anEnumBoxed completion:(void (^)(FLTAnEnumBox *_Nullable, FlutterError *_Nullable))completion; +/// Returns the passed enum to test serialization and deserialization. +- (void)echoAnotherNullableEnum:(nullable FLTAnotherEnumBox *)anotherEnumBoxed + completion:(void (^)(FLTAnotherEnumBox *_Nullable, + FlutterError *_Nullable))completion; /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. - (void)noopAsyncWithCompletion:(void (^)(FlutterError *_Nullable))completion; diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m index 6dae6ff2abd..3d4d841ef15 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m @@ -50,6 +50,16 @@ - (instancetype)initWithValue:(FLTAnEnum)value { } @end +@implementation FLTAnotherEnumBox +- (instancetype)initWithValue:(FLTAnotherEnum)value { + self = [super init]; + if (self) { + _value = value; + } + return self; +} +@end + @interface FLTAllTypes () + (FLTAllTypes *)fromList:(NSArray *)list; + (nullable FLTAllTypes *)nullableFromList:(NSArray *)list; @@ -90,6 +100,7 @@ + (instancetype)makeWithABool:(BOOL)aBool a8ByteArray:(FlutterStandardTypedData *)a8ByteArray aFloatArray:(FlutterStandardTypedData *)aFloatArray anEnum:(FLTAnEnum)anEnum + anotherEnum:(FLTAnotherEnum)anotherEnum aString:(NSString *)aString anObject:(id)anObject list:(NSArray *)list @@ -108,6 +119,7 @@ + (instancetype)makeWithABool:(BOOL)aBool pigeonResult.a8ByteArray = a8ByteArray; pigeonResult.aFloatArray = aFloatArray; pigeonResult.anEnum = anEnum; + pigeonResult.anotherEnum = anotherEnum; pigeonResult.aString = aString; pigeonResult.anObject = anObject; pigeonResult.list = list; @@ -128,16 +140,18 @@ + (FLTAllTypes *)fromList:(NSArray *)list { pigeonResult.a4ByteArray = GetNullableObjectAtIndex(list, 5); pigeonResult.a8ByteArray = GetNullableObjectAtIndex(list, 6); pigeonResult.aFloatArray = GetNullableObjectAtIndex(list, 7); - FLTAnEnumBox *enumBox = GetNullableObjectAtIndex(list, 8); - pigeonResult.anEnum = enumBox.value; - pigeonResult.aString = GetNullableObjectAtIndex(list, 9); - pigeonResult.anObject = GetNullableObjectAtIndex(list, 10); - pigeonResult.list = GetNullableObjectAtIndex(list, 11); - pigeonResult.stringList = GetNullableObjectAtIndex(list, 12); - pigeonResult.intList = GetNullableObjectAtIndex(list, 13); - pigeonResult.doubleList = GetNullableObjectAtIndex(list, 14); - pigeonResult.boolList = GetNullableObjectAtIndex(list, 15); - pigeonResult.map = GetNullableObjectAtIndex(list, 16); + FLTAnEnumBox *boxedFLTAnEnum = GetNullableObjectAtIndex(list, 8); + pigeonResult.anEnum = boxedFLTAnEnum.value; + FLTAnotherEnumBox *boxedFLTAnotherEnum = GetNullableObjectAtIndex(list, 9); + pigeonResult.anotherEnum = boxedFLTAnotherEnum.value; + pigeonResult.aString = GetNullableObjectAtIndex(list, 10); + pigeonResult.anObject = GetNullableObjectAtIndex(list, 11); + pigeonResult.list = GetNullableObjectAtIndex(list, 12); + pigeonResult.stringList = GetNullableObjectAtIndex(list, 13); + pigeonResult.intList = GetNullableObjectAtIndex(list, 14); + pigeonResult.doubleList = GetNullableObjectAtIndex(list, 15); + pigeonResult.boolList = GetNullableObjectAtIndex(list, 16); + pigeonResult.map = GetNullableObjectAtIndex(list, 17); return pigeonResult; } + (nullable FLTAllTypes *)nullableFromList:(NSArray *)list { @@ -154,6 +168,7 @@ + (nullable FLTAllTypes *)nullableFromList:(NSArray *)list { self.a8ByteArray ?: [NSNull null], self.aFloatArray ?: [NSNull null], [[FLTAnEnumBox alloc] initWithValue:self.anEnum], + [[FLTAnotherEnumBox alloc] initWithValue:self.anotherEnum], self.aString ?: [NSNull null], self.anObject ?: [NSNull null], self.list ?: [NSNull null], @@ -180,6 +195,7 @@ + (instancetype)makeWithANullableBool:(nullable NSNumber *)aNullableBool (nullable NSDictionary *)nullableMapWithAnnotations nullableMapWithObject:(nullable NSDictionary *)nullableMapWithObject aNullableEnum:(nullable FLTAnEnumBox *)aNullableEnum + anotherNullableEnum:(nullable FLTAnotherEnumBox *)anotherNullableEnum aNullableString:(nullable NSString *)aNullableString aNullableObject:(nullable id)aNullableObject allNullableTypes:(nullable FLTAllNullableTypes *)allNullableTypes @@ -203,6 +219,7 @@ + (instancetype)makeWithANullableBool:(nullable NSNumber *)aNullableBool pigeonResult.nullableMapWithAnnotations = nullableMapWithAnnotations; pigeonResult.nullableMapWithObject = nullableMapWithObject; pigeonResult.aNullableEnum = aNullableEnum; + pigeonResult.anotherNullableEnum = anotherNullableEnum; pigeonResult.aNullableString = aNullableString; pigeonResult.aNullableObject = aNullableObject; pigeonResult.allNullableTypes = allNullableTypes; @@ -229,16 +246,17 @@ + (FLTAllNullableTypes *)fromList:(NSArray *)list { pigeonResult.nullableMapWithAnnotations = GetNullableObjectAtIndex(list, 9); pigeonResult.nullableMapWithObject = GetNullableObjectAtIndex(list, 10); pigeonResult.aNullableEnum = GetNullableObjectAtIndex(list, 11); - pigeonResult.aNullableString = GetNullableObjectAtIndex(list, 12); - pigeonResult.aNullableObject = GetNullableObjectAtIndex(list, 13); - pigeonResult.allNullableTypes = GetNullableObjectAtIndex(list, 14); - pigeonResult.list = GetNullableObjectAtIndex(list, 15); - pigeonResult.stringList = GetNullableObjectAtIndex(list, 16); - pigeonResult.intList = GetNullableObjectAtIndex(list, 17); - pigeonResult.doubleList = GetNullableObjectAtIndex(list, 18); - pigeonResult.boolList = GetNullableObjectAtIndex(list, 19); - pigeonResult.nestedClassList = GetNullableObjectAtIndex(list, 20); - pigeonResult.map = GetNullableObjectAtIndex(list, 21); + pigeonResult.anotherNullableEnum = GetNullableObjectAtIndex(list, 12); + pigeonResult.aNullableString = GetNullableObjectAtIndex(list, 13); + pigeonResult.aNullableObject = GetNullableObjectAtIndex(list, 14); + pigeonResult.allNullableTypes = GetNullableObjectAtIndex(list, 15); + pigeonResult.list = GetNullableObjectAtIndex(list, 16); + pigeonResult.stringList = GetNullableObjectAtIndex(list, 17); + pigeonResult.intList = GetNullableObjectAtIndex(list, 18); + pigeonResult.doubleList = GetNullableObjectAtIndex(list, 19); + pigeonResult.boolList = GetNullableObjectAtIndex(list, 20); + pigeonResult.nestedClassList = GetNullableObjectAtIndex(list, 21); + pigeonResult.map = GetNullableObjectAtIndex(list, 22); return pigeonResult; } + (nullable FLTAllNullableTypes *)nullableFromList:(NSArray *)list { @@ -258,6 +276,7 @@ + (nullable FLTAllNullableTypes *)nullableFromList:(NSArray *)list { self.nullableMapWithAnnotations ?: [NSNull null], self.nullableMapWithObject ?: [NSNull null], self.aNullableEnum ?: [NSNull null], + self.anotherNullableEnum ?: [NSNull null], self.aNullableString ?: [NSNull null], self.aNullableObject ?: [NSNull null], self.allNullableTypes ?: [NSNull null], @@ -286,6 +305,7 @@ + (instancetype)makeWithANullableBool:(nullable NSNumber *)aNullableBool (nullable NSDictionary *)nullableMapWithAnnotations nullableMapWithObject:(nullable NSDictionary *)nullableMapWithObject aNullableEnum:(nullable FLTAnEnumBox *)aNullableEnum + anotherNullableEnum:(nullable FLTAnotherEnumBox *)anotherNullableEnum aNullableString:(nullable NSString *)aNullableString aNullableObject:(nullable id)aNullableObject list:(nullable NSArray *)list @@ -308,6 +328,7 @@ + (instancetype)makeWithANullableBool:(nullable NSNumber *)aNullableBool pigeonResult.nullableMapWithAnnotations = nullableMapWithAnnotations; pigeonResult.nullableMapWithObject = nullableMapWithObject; pigeonResult.aNullableEnum = aNullableEnum; + pigeonResult.anotherNullableEnum = anotherNullableEnum; pigeonResult.aNullableString = aNullableString; pigeonResult.aNullableObject = aNullableObject; pigeonResult.list = list; @@ -333,14 +354,15 @@ + (FLTAllNullableTypesWithoutRecursion *)fromList:(NSArray *)list { pigeonResult.nullableMapWithAnnotations = GetNullableObjectAtIndex(list, 9); pigeonResult.nullableMapWithObject = GetNullableObjectAtIndex(list, 10); pigeonResult.aNullableEnum = GetNullableObjectAtIndex(list, 11); - pigeonResult.aNullableString = GetNullableObjectAtIndex(list, 12); - pigeonResult.aNullableObject = GetNullableObjectAtIndex(list, 13); - pigeonResult.list = GetNullableObjectAtIndex(list, 14); - pigeonResult.stringList = GetNullableObjectAtIndex(list, 15); - pigeonResult.intList = GetNullableObjectAtIndex(list, 16); - pigeonResult.doubleList = GetNullableObjectAtIndex(list, 17); - pigeonResult.boolList = GetNullableObjectAtIndex(list, 18); - pigeonResult.map = GetNullableObjectAtIndex(list, 19); + pigeonResult.anotherNullableEnum = GetNullableObjectAtIndex(list, 12); + pigeonResult.aNullableString = GetNullableObjectAtIndex(list, 13); + pigeonResult.aNullableObject = GetNullableObjectAtIndex(list, 14); + pigeonResult.list = GetNullableObjectAtIndex(list, 15); + pigeonResult.stringList = GetNullableObjectAtIndex(list, 16); + pigeonResult.intList = GetNullableObjectAtIndex(list, 17); + pigeonResult.doubleList = GetNullableObjectAtIndex(list, 18); + pigeonResult.boolList = GetNullableObjectAtIndex(list, 19); + pigeonResult.map = GetNullableObjectAtIndex(list, 20); return pigeonResult; } + (nullable FLTAllNullableTypesWithoutRecursion *)nullableFromList:(NSArray *)list { @@ -360,6 +382,7 @@ + (nullable FLTAllNullableTypesWithoutRecursion *)nullableFromList:(NSArray self.nullableMapWithAnnotations ?: [NSNull null], self.nullableMapWithObject ?: [NSNull null], self.aNullableEnum ?: [NSNull null], + self.anotherNullableEnum ?: [NSNull null], self.aNullableString ?: [NSNull null], self.aNullableObject ?: [NSNull null], self.list ?: [NSNull null], @@ -428,21 +451,27 @@ @interface FLTCoreTestsPigeonCodecReader : FlutterStandardReader @implementation FLTCoreTestsPigeonCodecReader - (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 129: + case 129: { + NSNumber *enumAsNumber = [self readValue]; + return enumAsNumber == nil ? nil + : [[FLTAnEnumBox alloc] initWithValue:[enumAsNumber integerValue]]; + } + case 130: { + NSNumber *enumAsNumber = [self readValue]; + return enumAsNumber == nil + ? nil + : [[FLTAnotherEnumBox alloc] initWithValue:[enumAsNumber integerValue]]; + } + case 131: return [FLTAllTypes fromList:[self readValue]]; - case 130: + case 132: return [FLTAllNullableTypes fromList:[self readValue]]; - case 131: + case 133: return [FLTAllNullableTypesWithoutRecursion fromList:[self readValue]]; - case 132: + case 134: return [FLTAllClassesWrapper fromList:[self readValue]]; - case 133: + case 135: return [FLTTestMessage fromList:[self readValue]]; - case 134: { - NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil - : [[FLTAnEnumBox alloc] initWithValue:[enumAsNumber integerValue]]; - } default: return [super readValueOfType:type]; } @@ -453,25 +482,29 @@ @interface FLTCoreTestsPigeonCodecWriter : FlutterStandardWriter @end @implementation FLTCoreTestsPigeonCodecWriter - (void)writeValue:(id)value { - if ([value isKindOfClass:[FLTAllTypes class]]) { + if ([value isKindOfClass:[FLTAnEnumBox class]]) { + FLTAnEnumBox *box = (FLTAnEnumBox *)value; [self writeByte:129]; + [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; + } else if ([value isKindOfClass:[FLTAnotherEnumBox class]]) { + FLTAnotherEnumBox *box = (FLTAnotherEnumBox *)value; + [self writeByte:130]; + [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; + } else if ([value isKindOfClass:[FLTAllTypes class]]) { + [self writeByte:131]; [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FLTAllNullableTypes class]]) { - [self writeByte:130]; + [self writeByte:132]; [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FLTAllNullableTypesWithoutRecursion class]]) { - [self writeByte:131]; + [self writeByte:133]; [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FLTAllClassesWrapper class]]) { - [self writeByte:132]; + [self writeByte:134]; [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FLTTestMessage class]]) { - [self writeByte:133]; + [self writeByte:135]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FLTAnEnumBox class]]) { - FLTAnEnumBox *box = (FLTAnEnumBox *)value; - [self writeByte:134]; - [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; } else { [super writeValue:value]; } @@ -863,8 +896,8 @@ void SetUpFLTHostIntegrationCoreApiWithSuffix(id binaryM api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - FLTAnEnumBox *enumBox = GetNullableObjectAtIndex(args, 0); - FLTAnEnum arg_anEnum = enumBox.value; + FLTAnEnumBox *boxedFLTAnEnum = GetNullableObjectAtIndex(args, 0); + FLTAnEnum arg_anEnum = boxedFLTAnEnum.value; FlutterError *error; FLTAnEnumBox *output = [api echoEnum:arg_anEnum error:&error]; callback(wrapResult(output, error)); @@ -873,6 +906,32 @@ void SetUpFLTHostIntegrationCoreApiWithSuffix(id binaryM [channel setMessageHandler:nil]; } } + /// Returns the passed enum to test serialization and deserialization. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.pigeon_integration_tests." + @"HostIntegrationCoreApi.echoAnotherEnum", + messageChannelSuffix] + binaryMessenger:binaryMessenger + codec:FLTGetCoreTestsCodec()]; + if (api) { + NSCAssert([api respondsToSelector:@selector(echoAnotherEnum:error:)], + @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " + @"@selector(echoAnotherEnum:error:)", + api); + [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { + NSArray *args = message; + FLTAnotherEnumBox *boxedFLTAnotherEnum = GetNullableObjectAtIndex(args, 0); + FLTAnotherEnum arg_anotherEnum = boxedFLTAnotherEnum.value; + FlutterError *error; + FLTAnotherEnumBox *output = [api echoAnotherEnum:arg_anotherEnum error:&error]; + callback(wrapResult(output, error)); + }]; + } else { + [channel setMessageHandler:nil]; + } + } /// Returns the default string. { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] @@ -1348,6 +1407,31 @@ void SetUpFLTHostIntegrationCoreApiWithSuffix(id binaryM [channel setMessageHandler:nil]; } } + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.pigeon_integration_tests." + @"HostIntegrationCoreApi.echoAnotherNullableEnum", + messageChannelSuffix] + binaryMessenger:binaryMessenger + codec:FLTGetCoreTestsCodec()]; + if (api) { + NSCAssert([api respondsToSelector:@selector(echoAnotherNullableEnum:error:)], + @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " + @"@selector(echoAnotherNullableEnum:error:)", + api); + [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { + NSArray *args = message; + FLTAnotherEnumBox *arg_anotherEnum = GetNullableObjectAtIndex(args, 0); + FlutterError *error; + FLTAnotherEnumBox *output = [api echoAnotherNullableEnum:arg_anotherEnum error:&error]; + callback(wrapResult(output, error)); + }]; + } else { + [channel setMessageHandler:nil]; + } + } /// Returns passed in int. { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] @@ -1650,8 +1734,8 @@ void SetUpFLTHostIntegrationCoreApiWithSuffix(id binaryM api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - FLTAnEnumBox *enumBox = GetNullableObjectAtIndex(args, 0); - FLTAnEnum arg_anEnum = enumBox.value; + FLTAnEnumBox *boxedFLTAnEnum = GetNullableObjectAtIndex(args, 0); + FLTAnEnum arg_anEnum = boxedFLTAnEnum.value; [api echoAsyncEnum:arg_anEnum completion:^(FLTAnEnumBox *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -1661,6 +1745,34 @@ void SetUpFLTHostIntegrationCoreApiWithSuffix(id binaryM [channel setMessageHandler:nil]; } } + /// Returns the passed enum, to test asynchronous serialization and deserialization. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.pigeon_integration_tests." + @"HostIntegrationCoreApi.echoAnotherAsyncEnum", + messageChannelSuffix] + binaryMessenger:binaryMessenger + codec:FLTGetCoreTestsCodec()]; + if (api) { + NSCAssert([api respondsToSelector:@selector(echoAnotherAsyncEnum:completion:)], + @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " + @"@selector(echoAnotherAsyncEnum:completion:)", + api); + [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { + NSArray *args = message; + FLTAnotherEnumBox *boxedFLTAnotherEnum = GetNullableObjectAtIndex(args, 0); + FLTAnotherEnum arg_anotherEnum = boxedFLTAnotherEnum.value; + [api echoAnotherAsyncEnum:arg_anotherEnum + completion:^(FLTAnotherEnumBox *_Nullable output, + FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; + }]; + } else { + [channel setMessageHandler:nil]; + } + } /// Responds with an error from an async function returning a value. { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] @@ -2058,6 +2170,34 @@ void SetUpFLTHostIntegrationCoreApiWithSuffix(id binaryM [channel setMessageHandler:nil]; } } + /// Returns the passed enum, to test asynchronous serialization and deserialization. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.pigeon_integration_tests." + @"HostIntegrationCoreApi.echoAnotherAsyncNullableEnum", + messageChannelSuffix] + binaryMessenger:binaryMessenger + codec:FLTGetCoreTestsCodec()]; + if (api) { + NSCAssert([api respondsToSelector:@selector(echoAnotherAsyncNullableEnum:completion:)], + @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " + @"@selector(echoAnotherAsyncNullableEnum:completion:)", + api); + [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { + NSArray *args = message; + FLTAnotherEnumBox *arg_anotherEnum = GetNullableObjectAtIndex(args, 0); + [api echoAnotherAsyncNullableEnum:arg_anotherEnum + completion:^(FLTAnotherEnumBox *_Nullable output, + FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; + }]; + } else { + [channel setMessageHandler:nil]; + } + } { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] initWithName:[NSString stringWithFormat:@"%@%@", @@ -2474,8 +2614,8 @@ void SetUpFLTHostIntegrationCoreApiWithSuffix(id binaryM api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - FLTAnEnumBox *enumBox = GetNullableObjectAtIndex(args, 0); - FLTAnEnum arg_anEnum = enumBox.value; + FLTAnEnumBox *boxedFLTAnEnum = GetNullableObjectAtIndex(args, 0); + FLTAnEnum arg_anEnum = boxedFLTAnEnum.value; [api callFlutterEchoEnum:arg_anEnum completion:^(FLTAnEnumBox *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -2485,6 +2625,34 @@ void SetUpFLTHostIntegrationCoreApiWithSuffix(id binaryM [channel setMessageHandler:nil]; } } + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.pigeon_integration_tests." + @"HostIntegrationCoreApi.callFlutterEchoAnotherEnum", + messageChannelSuffix] + binaryMessenger:binaryMessenger + codec:FLTGetCoreTestsCodec()]; + if (api) { + NSCAssert([api respondsToSelector:@selector(callFlutterEchoAnotherEnum:completion:)], + @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " + @"@selector(callFlutterEchoAnotherEnum:completion:)", + api); + [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { + NSArray *args = message; + FLTAnotherEnumBox *boxedFLTAnotherEnum = GetNullableObjectAtIndex(args, 0); + FLTAnotherEnum arg_anotherEnum = boxedFLTAnotherEnum.value; + [api callFlutterEchoAnotherEnum:arg_anotherEnum + completion:^(FLTAnotherEnumBox *_Nullable output, + FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; + }]; + } else { + [channel setMessageHandler:nil]; + } + } { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] initWithName:[NSString @@ -2701,6 +2869,33 @@ void SetUpFLTHostIntegrationCoreApiWithSuffix(id binaryM [channel setMessageHandler:nil]; } } + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.pigeon_integration_tests." + @"HostIntegrationCoreApi.callFlutterEchoAnotherNullableEnum", + messageChannelSuffix] + binaryMessenger:binaryMessenger + codec:FLTGetCoreTestsCodec()]; + if (api) { + NSCAssert([api respondsToSelector:@selector(callFlutterEchoAnotherNullableEnum:completion:)], + @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " + @"@selector(callFlutterEchoAnotherNullableEnum:completion:)", + api); + [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { + NSArray *args = message; + FLTAnotherEnumBox *arg_anotherEnum = GetNullableObjectAtIndex(args, 0); + [api callFlutterEchoAnotherNullableEnum:arg_anotherEnum + completion:^(FLTAnotherEnumBox *_Nullable output, + FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; + }]; + } else { + [channel setMessageHandler:nil]; + } + } { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] initWithName: @@ -3198,6 +3393,34 @@ - (void)echoEnum:(FLTAnEnum)arg_anEnum } }]; } +- (void)echoAnotherEnum:(FLTAnotherEnum)arg_anotherEnum + completion: + (void (^)(FLTAnotherEnumBox *_Nullable, FlutterError *_Nullable))completion { + NSString *channelName = [NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAnotherEnum", + _messageChannelSuffix]; + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FLTGetCoreTestsCodec()]; + [channel sendMessage:@[ [[FLTAnotherEnumBox alloc] initWithValue:arg_anotherEnum] ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion(nil, [FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + FLTAnotherEnumBox *output = reply[0] == [NSNull null] ? nil : reply[0]; + completion(output, nil); + } + } else { + completion(nil, createConnectionError(channelName)); + } + }]; +} - (void)echoNullableBool:(nullable NSNumber *)arg_aBool completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion { NSString *channelName = [NSString @@ -3418,6 +3641,34 @@ - (void)echoNullableEnum:(nullable FLTAnEnumBox *)arg_anEnum } }]; } +- (void)echoAnotherNullableEnum:(nullable FLTAnotherEnumBox *)arg_anotherEnum + completion:(void (^)(FLTAnotherEnumBox *_Nullable, + FlutterError *_Nullable))completion { + NSString *channelName = + [NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.pigeon_integration_tests." + @"FlutterIntegrationCoreApi.echoAnotherNullableEnum", + _messageChannelSuffix]; + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FLTGetCoreTestsCodec()]; + [channel sendMessage:@[ arg_anotherEnum == nil ? [NSNull null] : arg_anotherEnum ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion(nil, [FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + FLTAnotherEnumBox *output = reply[0] == [NSNull null] ? nil : reply[0]; + completion(output, nil); + } + } else { + completion(nil, createConnectionError(channelName)); + } + }]; +} - (void)noopAsyncWithCompletion:(void (^)(FlutterError *_Nullable))completion { NSString *channelName = [NSString stringWithFormat: diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/macos/Classes/AlternateLanguageTestPlugin.m b/packages/pigeon/platform_tests/alternate_language_test_plugin/macos/Classes/AlternateLanguageTestPlugin.m index 0cdec98b9ed..25324dab809 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/macos/Classes/AlternateLanguageTestPlugin.m +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/macos/Classes/AlternateLanguageTestPlugin.m @@ -7,9 +7,9 @@ #import "CoreTests.gen.h" @interface AlternateLanguageTestPlugin () -@property(nonatomic) FlutterIntegrationCoreApi *flutterAPI; @property(nonatomic) FlutterSmallApi *flutterSmallApiOne; @property(nonatomic) FlutterSmallApi *flutterSmallApiTwo; +@property(nonatomic) FlutterIntegrationCoreApi *flutterAPI; @end /// This plugin handles the native side of the integration tests in example/integration_test/. @@ -107,6 +107,11 @@ - (AnEnumBox *_Nullable)echoEnum:(AnEnum)anEnum error:(FlutterError *_Nullable * return [[AnEnumBox alloc] initWithValue:anEnum]; } +- (AnotherEnumBox *_Nullable)echoAnotherEnum:(AnotherEnum)anotherEnum + error:(FlutterError *_Nullable *_Nonnull)error { + return [[AnotherEnumBox alloc] initWithValue:anotherEnum]; +} + - (nullable NSString *)echoNamedDefaultString:(NSString *)aString error:(FlutterError *_Nullable *_Nonnull)error { return aString; @@ -210,6 +215,11 @@ - (AnEnumBox *_Nullable)echoNullableEnum:(nullable AnEnumBox *)AnEnumBoxed return AnEnumBoxed; } +- (AnotherEnumBox *_Nullable)echoAnotherNullableEnum:(nullable AnotherEnumBox *)AnotherEnumBoxed + error:(FlutterError *_Nullable *_Nonnull)error { + return AnotherEnumBoxed; +} + - (nullable NSNumber *)echoOptionalNullableInt:(nullable NSNumber *)aNullableInt error:(FlutterError *_Nullable *_Nonnull)error { return aNullableInt; @@ -304,6 +314,12 @@ - (void)echoAsyncEnum:(AnEnum)anEnum completion([[AnEnumBox alloc] initWithValue:anEnum], nil); } +- (void)echoAnotherAsyncEnum:(AnotherEnum)anotherEnum + completion: + (void (^)(AnotherEnumBox *_Nullable, FlutterError *_Nullable))completion { + completion([[AnotherEnumBox alloc] initWithValue:anotherEnum], nil); +} + - (void)echoAsyncNullableInt:(nullable NSNumber *)anInt completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion { completion(anInt, nil); @@ -352,6 +368,12 @@ - (void)echoAsyncNullableEnum:(nullable AnEnumBox *)AnEnumBoxed completion(AnEnumBoxed, nil); } +- (void)echoAnotherAsyncNullableEnum:(nullable AnotherEnumBox *)AnotherEnumBoxed + completion:(void (^)(AnotherEnumBox *_Nullable, + FlutterError *_Nullable))completion { + completion(AnotherEnumBoxed, nil); +} + - (void)callFlutterNoopWithCompletion:(void (^)(FlutterError *_Nullable))completion { [self.flutterAPI noopWithCompletion:^(FlutterError *error) { completion(error); @@ -477,6 +499,15 @@ - (void)callFlutterEchoEnum:(AnEnum)anEnum }]; } +- (void)callFlutterEchoAnotherEnum:(AnotherEnum)anotherEnum + completion:(void (^)(AnotherEnumBox *_Nullable, + FlutterError *_Nullable))completion { + [self.flutterAPI echoAnotherEnum:anotherEnum + completion:^(AnotherEnumBox *value, FlutterError *error) { + completion(value, error); + }]; +} + - (void)callFlutterEchoAllNullableTypes:(nullable AllNullableTypes *)everything completion:(void (^)(AllNullableTypes *_Nullable, FlutterError *_Nullable))completion { @@ -571,6 +602,15 @@ - (void)callFlutterEchoNullableEnum:(nullable AnEnumBox *)AnEnumBoxed }]; } +- (void)callFlutterEchoAnotherNullableEnum:(nullable AnotherEnumBox *)AnotherEnumBoxed + completion:(void (^)(AnotherEnumBox *_Nullable, + FlutterError *_Nullable))completion { + [self.flutterAPI echoAnotherNullableEnum:AnotherEnumBoxed + completion:^(AnotherEnumBox *value, FlutterError *error) { + completion(value, error); + }]; +} + - (void)callFlutterSmallApiEchoString:(nonnull NSString *)aString completion:(nonnull void (^)(NSString *_Nullable, FlutterError *_Nullable))completion { diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/macos/Classes/CoreTests.gen.h b/packages/pigeon/platform_tests/alternate_language_test_plugin/macos/Classes/CoreTests.gen.h index f2b2c074755..4a2239f9656 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/macos/Classes/CoreTests.gen.h +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/macos/Classes/CoreTests.gen.h @@ -28,6 +28,16 @@ typedef NS_ENUM(NSUInteger, AnEnum) { - (instancetype)initWithValue:(AnEnum)value; @end +typedef NS_ENUM(NSUInteger, AnotherEnum) { + AnotherEnumJustInCase = 0, +}; + +/// Wrapper for AnotherEnum to allow for nullability. +@interface AnotherEnumBox : NSObject +@property(nonatomic, assign) AnotherEnum value; +- (instancetype)initWithValue:(AnotherEnum)value; +@end + @class AllTypes; @class AllNullableTypes; @class AllNullableTypesWithoutRecursion; @@ -47,6 +57,7 @@ typedef NS_ENUM(NSUInteger, AnEnum) { a8ByteArray:(FlutterStandardTypedData *)a8ByteArray aFloatArray:(FlutterStandardTypedData *)aFloatArray anEnum:(AnEnum)anEnum + anotherEnum:(AnotherEnum)anotherEnum aString:(NSString *)aString anObject:(id)anObject list:(NSArray *)list @@ -64,6 +75,7 @@ typedef NS_ENUM(NSUInteger, AnEnum) { @property(nonatomic, strong) FlutterStandardTypedData *a8ByteArray; @property(nonatomic, strong) FlutterStandardTypedData *aFloatArray; @property(nonatomic, assign) AnEnum anEnum; +@property(nonatomic, assign) AnotherEnum anotherEnum; @property(nonatomic, copy) NSString *aString; @property(nonatomic, strong) id anObject; @property(nonatomic, copy) NSArray *list; @@ -89,6 +101,7 @@ typedef NS_ENUM(NSUInteger, AnEnum) { (nullable NSDictionary *)nullableMapWithAnnotations nullableMapWithObject:(nullable NSDictionary *)nullableMapWithObject aNullableEnum:(nullable AnEnumBox *)aNullableEnum + anotherNullableEnum:(nullable AnotherEnumBox *)anotherNullableEnum aNullableString:(nullable NSString *)aNullableString aNullableObject:(nullable id)aNullableObject allNullableTypes:(nullable AllNullableTypes *)allNullableTypes @@ -112,6 +125,7 @@ typedef NS_ENUM(NSUInteger, AnEnum) { NSDictionary *nullableMapWithAnnotations; @property(nonatomic, copy, nullable) NSDictionary *nullableMapWithObject; @property(nonatomic, strong, nullable) AnEnumBox *aNullableEnum; +@property(nonatomic, strong, nullable) AnotherEnumBox *anotherNullableEnum; @property(nonatomic, copy, nullable) NSString *aNullableString; @property(nonatomic, strong, nullable) id aNullableObject; @property(nonatomic, strong, nullable) AllNullableTypes *allNullableTypes; @@ -141,6 +155,7 @@ typedef NS_ENUM(NSUInteger, AnEnum) { (nullable NSDictionary *)nullableMapWithAnnotations nullableMapWithObject:(nullable NSDictionary *)nullableMapWithObject aNullableEnum:(nullable AnEnumBox *)aNullableEnum + anotherNullableEnum:(nullable AnotherEnumBox *)anotherNullableEnum aNullableString:(nullable NSString *)aNullableString aNullableObject:(nullable id)aNullableObject list:(nullable NSArray *)list @@ -162,6 +177,7 @@ typedef NS_ENUM(NSUInteger, AnEnum) { NSDictionary *nullableMapWithAnnotations; @property(nonatomic, copy, nullable) NSDictionary *nullableMapWithObject; @property(nonatomic, strong, nullable) AnEnumBox *aNullableEnum; +@property(nonatomic, strong, nullable) AnotherEnumBox *anotherNullableEnum; @property(nonatomic, copy, nullable) NSString *aNullableString; @property(nonatomic, strong, nullable) id aNullableObject; @property(nonatomic, copy, nullable) NSArray *list; @@ -261,6 +277,11 @@ NSObject *GetCoreTestsCodec(void); /// /// @return `nil` only when `error != nil`. - (AnEnumBox *_Nullable)echoEnum:(AnEnum)anEnum error:(FlutterError *_Nullable *_Nonnull)error; +/// Returns the passed enum to test serialization and deserialization. +/// +/// @return `nil` only when `error != nil`. +- (AnotherEnumBox *_Nullable)echoAnotherEnum:(AnotherEnum)anotherEnum + error:(FlutterError *_Nullable *_Nonnull)error; /// Returns the default string. /// /// @return `nil` only when `error != nil`. @@ -338,6 +359,8 @@ NSObject *GetCoreTestsCodec(void); error:(FlutterError *_Nullable *_Nonnull)error; - (AnEnumBox *_Nullable)echoNullableEnum:(nullable AnEnumBox *)anEnumBoxed error:(FlutterError *_Nullable *_Nonnull)error; +- (AnotherEnumBox *_Nullable)echoAnotherNullableEnum:(nullable AnotherEnumBox *)anotherEnumBoxed + error:(FlutterError *_Nullable *_Nonnull)error; /// Returns passed in int. - (nullable NSNumber *)echoOptionalNullableInt:(nullable NSNumber *)aNullableInt error:(FlutterError *_Nullable *_Nonnull)error; @@ -376,6 +399,10 @@ NSObject *GetCoreTestsCodec(void); /// Returns the passed enum, to test asynchronous serialization and deserialization. - (void)echoAsyncEnum:(AnEnum)anEnum completion:(void (^)(AnEnumBox *_Nullable, FlutterError *_Nullable))completion; +/// Returns the passed enum, to test asynchronous serialization and deserialization. +- (void)echoAnotherAsyncEnum:(AnotherEnum)anotherEnum + completion: + (void (^)(AnotherEnumBox *_Nullable, FlutterError *_Nullable))completion; /// Responds with an error from an async function returning a value. - (void)throwAsyncErrorWithCompletion:(void (^)(id _Nullable, FlutterError *_Nullable))completion; /// Responds with an error from an async void function. @@ -426,6 +453,10 @@ NSObject *GetCoreTestsCodec(void); /// Returns the passed enum, to test asynchronous serialization and deserialization. - (void)echoAsyncNullableEnum:(nullable AnEnumBox *)anEnumBoxed completion:(void (^)(AnEnumBox *_Nullable, FlutterError *_Nullable))completion; +/// Returns the passed enum, to test asynchronous serialization and deserialization. +- (void)echoAnotherAsyncNullableEnum:(nullable AnotherEnumBox *)anotherEnumBoxed + completion:(void (^)(AnotherEnumBox *_Nullable, + FlutterError *_Nullable))completion; - (void)callFlutterNoopWithCompletion:(void (^)(FlutterError *_Nullable))completion; - (void)callFlutterThrowErrorWithCompletion:(void (^)(id _Nullable, FlutterError *_Nullable))completion; @@ -473,6 +504,9 @@ NSObject *GetCoreTestsCodec(void); FlutterError *_Nullable))completion; - (void)callFlutterEchoEnum:(AnEnum)anEnum completion:(void (^)(AnEnumBox *_Nullable, FlutterError *_Nullable))completion; +- (void)callFlutterEchoAnotherEnum:(AnotherEnum)anotherEnum + completion:(void (^)(AnotherEnumBox *_Nullable, + FlutterError *_Nullable))completion; - (void)callFlutterEchoNullableBool:(nullable NSNumber *)aBool completion: (void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; @@ -497,6 +531,9 @@ NSObject *GetCoreTestsCodec(void); - (void)callFlutterEchoNullableEnum:(nullable AnEnumBox *)anEnumBoxed completion: (void (^)(AnEnumBox *_Nullable, FlutterError *_Nullable))completion; +- (void)callFlutterEchoAnotherNullableEnum:(nullable AnotherEnumBox *)anotherEnumBoxed + completion:(void (^)(AnotherEnumBox *_Nullable, + FlutterError *_Nullable))completion; - (void)callFlutterSmallApiEchoString:(NSString *)aString completion: (void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; @@ -577,6 +614,9 @@ extern void SetUpHostIntegrationCoreApiWithSuffix(id bin /// Returns the passed enum to test serialization and deserialization. - (void)echoEnum:(AnEnum)anEnum completion:(void (^)(AnEnumBox *_Nullable, FlutterError *_Nullable))completion; +/// Returns the passed enum to test serialization and deserialization. +- (void)echoAnotherEnum:(AnotherEnum)anotherEnum + completion:(void (^)(AnotherEnumBox *_Nullable, FlutterError *_Nullable))completion; /// Returns the passed boolean, to test serialization and deserialization. - (void)echoNullableBool:(nullable NSNumber *)aBool completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; @@ -603,6 +643,10 @@ extern void SetUpHostIntegrationCoreApiWithSuffix(id bin /// Returns the passed enum to test serialization and deserialization. - (void)echoNullableEnum:(nullable AnEnumBox *)anEnumBoxed completion:(void (^)(AnEnumBox *_Nullable, FlutterError *_Nullable))completion; +/// Returns the passed enum to test serialization and deserialization. +- (void)echoAnotherNullableEnum:(nullable AnotherEnumBox *)anotherEnumBoxed + completion: + (void (^)(AnotherEnumBox *_Nullable, FlutterError *_Nullable))completion; /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. - (void)noopAsyncWithCompletion:(void (^)(FlutterError *_Nullable))completion; diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/macos/Classes/CoreTests.gen.m b/packages/pigeon/platform_tests/alternate_language_test_plugin/macos/Classes/CoreTests.gen.m index be3810ceae8..78b333c21a9 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/macos/Classes/CoreTests.gen.m +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/macos/Classes/CoreTests.gen.m @@ -50,6 +50,16 @@ - (instancetype)initWithValue:(AnEnum)value { } @end +@implementation AnotherEnumBox +- (instancetype)initWithValue:(AnotherEnum)value { + self = [super init]; + if (self) { + _value = value; + } + return self; +} +@end + @interface AllTypes () + (AllTypes *)fromList:(NSArray *)list; + (nullable AllTypes *)nullableFromList:(NSArray *)list; @@ -90,6 +100,7 @@ + (instancetype)makeWithABool:(BOOL)aBool a8ByteArray:(FlutterStandardTypedData *)a8ByteArray aFloatArray:(FlutterStandardTypedData *)aFloatArray anEnum:(AnEnum)anEnum + anotherEnum:(AnotherEnum)anotherEnum aString:(NSString *)aString anObject:(id)anObject list:(NSArray *)list @@ -108,6 +119,7 @@ + (instancetype)makeWithABool:(BOOL)aBool pigeonResult.a8ByteArray = a8ByteArray; pigeonResult.aFloatArray = aFloatArray; pigeonResult.anEnum = anEnum; + pigeonResult.anotherEnum = anotherEnum; pigeonResult.aString = aString; pigeonResult.anObject = anObject; pigeonResult.list = list; @@ -128,16 +140,18 @@ + (AllTypes *)fromList:(NSArray *)list { pigeonResult.a4ByteArray = GetNullableObjectAtIndex(list, 5); pigeonResult.a8ByteArray = GetNullableObjectAtIndex(list, 6); pigeonResult.aFloatArray = GetNullableObjectAtIndex(list, 7); - AnEnumBox *enumBox = GetNullableObjectAtIndex(list, 8); - pigeonResult.anEnum = enumBox.value; - pigeonResult.aString = GetNullableObjectAtIndex(list, 9); - pigeonResult.anObject = GetNullableObjectAtIndex(list, 10); - pigeonResult.list = GetNullableObjectAtIndex(list, 11); - pigeonResult.stringList = GetNullableObjectAtIndex(list, 12); - pigeonResult.intList = GetNullableObjectAtIndex(list, 13); - pigeonResult.doubleList = GetNullableObjectAtIndex(list, 14); - pigeonResult.boolList = GetNullableObjectAtIndex(list, 15); - pigeonResult.map = GetNullableObjectAtIndex(list, 16); + AnEnumBox *boxedAnEnum = GetNullableObjectAtIndex(list, 8); + pigeonResult.anEnum = boxedAnEnum.value; + AnotherEnumBox *boxedAnotherEnum = GetNullableObjectAtIndex(list, 9); + pigeonResult.anotherEnum = boxedAnotherEnum.value; + pigeonResult.aString = GetNullableObjectAtIndex(list, 10); + pigeonResult.anObject = GetNullableObjectAtIndex(list, 11); + pigeonResult.list = GetNullableObjectAtIndex(list, 12); + pigeonResult.stringList = GetNullableObjectAtIndex(list, 13); + pigeonResult.intList = GetNullableObjectAtIndex(list, 14); + pigeonResult.doubleList = GetNullableObjectAtIndex(list, 15); + pigeonResult.boolList = GetNullableObjectAtIndex(list, 16); + pigeonResult.map = GetNullableObjectAtIndex(list, 17); return pigeonResult; } + (nullable AllTypes *)nullableFromList:(NSArray *)list { @@ -154,6 +168,7 @@ + (nullable AllTypes *)nullableFromList:(NSArray *)list { self.a8ByteArray ?: [NSNull null], self.aFloatArray ?: [NSNull null], [[AnEnumBox alloc] initWithValue:self.anEnum], + [[AnotherEnumBox alloc] initWithValue:self.anotherEnum], self.aString ?: [NSNull null], self.anObject ?: [NSNull null], self.list ?: [NSNull null], @@ -180,6 +195,7 @@ + (instancetype)makeWithANullableBool:(nullable NSNumber *)aNullableBool (nullable NSDictionary *)nullableMapWithAnnotations nullableMapWithObject:(nullable NSDictionary *)nullableMapWithObject aNullableEnum:(nullable AnEnumBox *)aNullableEnum + anotherNullableEnum:(nullable AnotherEnumBox *)anotherNullableEnum aNullableString:(nullable NSString *)aNullableString aNullableObject:(nullable id)aNullableObject allNullableTypes:(nullable AllNullableTypes *)allNullableTypes @@ -203,6 +219,7 @@ + (instancetype)makeWithANullableBool:(nullable NSNumber *)aNullableBool pigeonResult.nullableMapWithAnnotations = nullableMapWithAnnotations; pigeonResult.nullableMapWithObject = nullableMapWithObject; pigeonResult.aNullableEnum = aNullableEnum; + pigeonResult.anotherNullableEnum = anotherNullableEnum; pigeonResult.aNullableString = aNullableString; pigeonResult.aNullableObject = aNullableObject; pigeonResult.allNullableTypes = allNullableTypes; @@ -229,16 +246,17 @@ + (AllNullableTypes *)fromList:(NSArray *)list { pigeonResult.nullableMapWithAnnotations = GetNullableObjectAtIndex(list, 9); pigeonResult.nullableMapWithObject = GetNullableObjectAtIndex(list, 10); pigeonResult.aNullableEnum = GetNullableObjectAtIndex(list, 11); - pigeonResult.aNullableString = GetNullableObjectAtIndex(list, 12); - pigeonResult.aNullableObject = GetNullableObjectAtIndex(list, 13); - pigeonResult.allNullableTypes = GetNullableObjectAtIndex(list, 14); - pigeonResult.list = GetNullableObjectAtIndex(list, 15); - pigeonResult.stringList = GetNullableObjectAtIndex(list, 16); - pigeonResult.intList = GetNullableObjectAtIndex(list, 17); - pigeonResult.doubleList = GetNullableObjectAtIndex(list, 18); - pigeonResult.boolList = GetNullableObjectAtIndex(list, 19); - pigeonResult.nestedClassList = GetNullableObjectAtIndex(list, 20); - pigeonResult.map = GetNullableObjectAtIndex(list, 21); + pigeonResult.anotherNullableEnum = GetNullableObjectAtIndex(list, 12); + pigeonResult.aNullableString = GetNullableObjectAtIndex(list, 13); + pigeonResult.aNullableObject = GetNullableObjectAtIndex(list, 14); + pigeonResult.allNullableTypes = GetNullableObjectAtIndex(list, 15); + pigeonResult.list = GetNullableObjectAtIndex(list, 16); + pigeonResult.stringList = GetNullableObjectAtIndex(list, 17); + pigeonResult.intList = GetNullableObjectAtIndex(list, 18); + pigeonResult.doubleList = GetNullableObjectAtIndex(list, 19); + pigeonResult.boolList = GetNullableObjectAtIndex(list, 20); + pigeonResult.nestedClassList = GetNullableObjectAtIndex(list, 21); + pigeonResult.map = GetNullableObjectAtIndex(list, 22); return pigeonResult; } + (nullable AllNullableTypes *)nullableFromList:(NSArray *)list { @@ -258,6 +276,7 @@ + (nullable AllNullableTypes *)nullableFromList:(NSArray *)list { self.nullableMapWithAnnotations ?: [NSNull null], self.nullableMapWithObject ?: [NSNull null], self.aNullableEnum ?: [NSNull null], + self.anotherNullableEnum ?: [NSNull null], self.aNullableString ?: [NSNull null], self.aNullableObject ?: [NSNull null], self.allNullableTypes ?: [NSNull null], @@ -286,6 +305,7 @@ + (instancetype)makeWithANullableBool:(nullable NSNumber *)aNullableBool (nullable NSDictionary *)nullableMapWithAnnotations nullableMapWithObject:(nullable NSDictionary *)nullableMapWithObject aNullableEnum:(nullable AnEnumBox *)aNullableEnum + anotherNullableEnum:(nullable AnotherEnumBox *)anotherNullableEnum aNullableString:(nullable NSString *)aNullableString aNullableObject:(nullable id)aNullableObject list:(nullable NSArray *)list @@ -307,6 +327,7 @@ + (instancetype)makeWithANullableBool:(nullable NSNumber *)aNullableBool pigeonResult.nullableMapWithAnnotations = nullableMapWithAnnotations; pigeonResult.nullableMapWithObject = nullableMapWithObject; pigeonResult.aNullableEnum = aNullableEnum; + pigeonResult.anotherNullableEnum = anotherNullableEnum; pigeonResult.aNullableString = aNullableString; pigeonResult.aNullableObject = aNullableObject; pigeonResult.list = list; @@ -331,14 +352,15 @@ + (AllNullableTypesWithoutRecursion *)fromList:(NSArray *)list { pigeonResult.nullableMapWithAnnotations = GetNullableObjectAtIndex(list, 9); pigeonResult.nullableMapWithObject = GetNullableObjectAtIndex(list, 10); pigeonResult.aNullableEnum = GetNullableObjectAtIndex(list, 11); - pigeonResult.aNullableString = GetNullableObjectAtIndex(list, 12); - pigeonResult.aNullableObject = GetNullableObjectAtIndex(list, 13); - pigeonResult.list = GetNullableObjectAtIndex(list, 14); - pigeonResult.stringList = GetNullableObjectAtIndex(list, 15); - pigeonResult.intList = GetNullableObjectAtIndex(list, 16); - pigeonResult.doubleList = GetNullableObjectAtIndex(list, 17); - pigeonResult.boolList = GetNullableObjectAtIndex(list, 18); - pigeonResult.map = GetNullableObjectAtIndex(list, 19); + pigeonResult.anotherNullableEnum = GetNullableObjectAtIndex(list, 12); + pigeonResult.aNullableString = GetNullableObjectAtIndex(list, 13); + pigeonResult.aNullableObject = GetNullableObjectAtIndex(list, 14); + pigeonResult.list = GetNullableObjectAtIndex(list, 15); + pigeonResult.stringList = GetNullableObjectAtIndex(list, 16); + pigeonResult.intList = GetNullableObjectAtIndex(list, 17); + pigeonResult.doubleList = GetNullableObjectAtIndex(list, 18); + pigeonResult.boolList = GetNullableObjectAtIndex(list, 19); + pigeonResult.map = GetNullableObjectAtIndex(list, 20); return pigeonResult; } + (nullable AllNullableTypesWithoutRecursion *)nullableFromList:(NSArray *)list { @@ -358,6 +380,7 @@ + (nullable AllNullableTypesWithoutRecursion *)nullableFromList:(NSArray *)l self.nullableMapWithAnnotations ?: [NSNull null], self.nullableMapWithObject ?: [NSNull null], self.aNullableEnum ?: [NSNull null], + self.anotherNullableEnum ?: [NSNull null], self.aNullableString ?: [NSNull null], self.aNullableObject ?: [NSNull null], self.list ?: [NSNull null], @@ -426,21 +449,27 @@ @interface CoreTestsPigeonCodecReader : FlutterStandardReader @implementation CoreTestsPigeonCodecReader - (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 129: + case 129: { + NSNumber *enumAsNumber = [self readValue]; + return enumAsNumber == nil ? nil + : [[AnEnumBox alloc] initWithValue:[enumAsNumber integerValue]]; + } + case 130: { + NSNumber *enumAsNumber = [self readValue]; + return enumAsNumber == nil + ? nil + : [[AnotherEnumBox alloc] initWithValue:[enumAsNumber integerValue]]; + } + case 131: return [AllTypes fromList:[self readValue]]; - case 130: + case 132: return [AllNullableTypes fromList:[self readValue]]; - case 131: + case 133: return [AllNullableTypesWithoutRecursion fromList:[self readValue]]; - case 132: + case 134: return [AllClassesWrapper fromList:[self readValue]]; - case 133: + case 135: return [TestMessage fromList:[self readValue]]; - case 134: { - NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil - : [[AnEnumBox alloc] initWithValue:[enumAsNumber integerValue]]; - } default: return [super readValueOfType:type]; } @@ -451,25 +480,29 @@ @interface CoreTestsPigeonCodecWriter : FlutterStandardWriter @end @implementation CoreTestsPigeonCodecWriter - (void)writeValue:(id)value { - if ([value isKindOfClass:[AllTypes class]]) { + if ([value isKindOfClass:[AnEnumBox class]]) { + AnEnumBox *box = (AnEnumBox *)value; [self writeByte:129]; + [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; + } else if ([value isKindOfClass:[AnotherEnumBox class]]) { + AnotherEnumBox *box = (AnotherEnumBox *)value; + [self writeByte:130]; + [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; + } else if ([value isKindOfClass:[AllTypes class]]) { + [self writeByte:131]; [self writeValue:[value toList]]; } else if ([value isKindOfClass:[AllNullableTypes class]]) { - [self writeByte:130]; + [self writeByte:132]; [self writeValue:[value toList]]; } else if ([value isKindOfClass:[AllNullableTypesWithoutRecursion class]]) { - [self writeByte:131]; + [self writeByte:133]; [self writeValue:[value toList]]; } else if ([value isKindOfClass:[AllClassesWrapper class]]) { - [self writeByte:132]; + [self writeByte:134]; [self writeValue:[value toList]]; } else if ([value isKindOfClass:[TestMessage class]]) { - [self writeByte:133]; + [self writeByte:135]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[AnEnumBox class]]) { - AnEnumBox *box = (AnEnumBox *)value; - [self writeByte:134]; - [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; } else { [super writeValue:value]; } @@ -858,8 +891,8 @@ void SetUpHostIntegrationCoreApiWithSuffix(id binaryMess api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - AnEnumBox *enumBox = GetNullableObjectAtIndex(args, 0); - AnEnum arg_anEnum = enumBox.value; + AnEnumBox *boxedAnEnum = GetNullableObjectAtIndex(args, 0); + AnEnum arg_anEnum = boxedAnEnum.value; FlutterError *error; AnEnumBox *output = [api echoEnum:arg_anEnum error:&error]; callback(wrapResult(output, error)); @@ -868,6 +901,32 @@ void SetUpHostIntegrationCoreApiWithSuffix(id binaryMess [channel setMessageHandler:nil]; } } + /// Returns the passed enum to test serialization and deserialization. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.pigeon_integration_tests." + @"HostIntegrationCoreApi.echoAnotherEnum", + messageChannelSuffix] + binaryMessenger:binaryMessenger + codec:GetCoreTestsCodec()]; + if (api) { + NSCAssert( + [api respondsToSelector:@selector(echoAnotherEnum:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoAnotherEnum:error:)", + api); + [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { + NSArray *args = message; + AnotherEnumBox *boxedAnotherEnum = GetNullableObjectAtIndex(args, 0); + AnotherEnum arg_anotherEnum = boxedAnotherEnum.value; + FlutterError *error; + AnotherEnumBox *output = [api echoAnotherEnum:arg_anotherEnum error:&error]; + callback(wrapResult(output, error)); + }]; + } else { + [channel setMessageHandler:nil]; + } + } /// Returns the default string. { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] @@ -1343,6 +1402,31 @@ void SetUpHostIntegrationCoreApiWithSuffix(id binaryMess [channel setMessageHandler:nil]; } } + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.pigeon_integration_tests." + @"HostIntegrationCoreApi.echoAnotherNullableEnum", + messageChannelSuffix] + binaryMessenger:binaryMessenger + codec:GetCoreTestsCodec()]; + if (api) { + NSCAssert([api respondsToSelector:@selector(echoAnotherNullableEnum:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to " + @"@selector(echoAnotherNullableEnum:error:)", + api); + [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { + NSArray *args = message; + AnotherEnumBox *arg_anotherEnum = GetNullableObjectAtIndex(args, 0); + FlutterError *error; + AnotherEnumBox *output = [api echoAnotherNullableEnum:arg_anotherEnum error:&error]; + callback(wrapResult(output, error)); + }]; + } else { + [channel setMessageHandler:nil]; + } + } /// Returns passed in int. { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] @@ -1645,8 +1729,8 @@ void SetUpHostIntegrationCoreApiWithSuffix(id binaryMess api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - AnEnumBox *enumBox = GetNullableObjectAtIndex(args, 0); - AnEnum arg_anEnum = enumBox.value; + AnEnumBox *boxedAnEnum = GetNullableObjectAtIndex(args, 0); + AnEnum arg_anEnum = boxedAnEnum.value; [api echoAsyncEnum:arg_anEnum completion:^(AnEnumBox *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -1656,6 +1740,34 @@ void SetUpHostIntegrationCoreApiWithSuffix(id binaryMess [channel setMessageHandler:nil]; } } + /// Returns the passed enum, to test asynchronous serialization and deserialization. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.pigeon_integration_tests." + @"HostIntegrationCoreApi.echoAnotherAsyncEnum", + messageChannelSuffix] + binaryMessenger:binaryMessenger + codec:GetCoreTestsCodec()]; + if (api) { + NSCAssert([api respondsToSelector:@selector(echoAnotherAsyncEnum:completion:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to " + @"@selector(echoAnotherAsyncEnum:completion:)", + api); + [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { + NSArray *args = message; + AnotherEnumBox *boxedAnotherEnum = GetNullableObjectAtIndex(args, 0); + AnotherEnum arg_anotherEnum = boxedAnotherEnum.value; + [api echoAnotherAsyncEnum:arg_anotherEnum + completion:^(AnotherEnumBox *_Nullable output, + FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; + }]; + } else { + [channel setMessageHandler:nil]; + } + } /// Responds with an error from an async function returning a value. { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] @@ -2052,6 +2164,34 @@ void SetUpHostIntegrationCoreApiWithSuffix(id binaryMess [channel setMessageHandler:nil]; } } + /// Returns the passed enum, to test asynchronous serialization and deserialization. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.pigeon_integration_tests." + @"HostIntegrationCoreApi.echoAnotherAsyncNullableEnum", + messageChannelSuffix] + binaryMessenger:binaryMessenger + codec:GetCoreTestsCodec()]; + if (api) { + NSCAssert([api respondsToSelector:@selector(echoAnotherAsyncNullableEnum:completion:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to " + @"@selector(echoAnotherAsyncNullableEnum:completion:)", + api); + [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { + NSArray *args = message; + AnotherEnumBox *arg_anotherEnum = GetNullableObjectAtIndex(args, 0); + [api echoAnotherAsyncNullableEnum:arg_anotherEnum + completion:^(AnotherEnumBox *_Nullable output, + FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; + }]; + } else { + [channel setMessageHandler:nil]; + } + } { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] initWithName:[NSString stringWithFormat:@"%@%@", @@ -2467,8 +2607,8 @@ void SetUpHostIntegrationCoreApiWithSuffix(id binaryMess api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - AnEnumBox *enumBox = GetNullableObjectAtIndex(args, 0); - AnEnum arg_anEnum = enumBox.value; + AnEnumBox *boxedAnEnum = GetNullableObjectAtIndex(args, 0); + AnEnum arg_anEnum = boxedAnEnum.value; [api callFlutterEchoEnum:arg_anEnum completion:^(AnEnumBox *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -2478,6 +2618,34 @@ void SetUpHostIntegrationCoreApiWithSuffix(id binaryMess [channel setMessageHandler:nil]; } } + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.pigeon_integration_tests." + @"HostIntegrationCoreApi.callFlutterEchoAnotherEnum", + messageChannelSuffix] + binaryMessenger:binaryMessenger + codec:GetCoreTestsCodec()]; + if (api) { + NSCAssert([api respondsToSelector:@selector(callFlutterEchoAnotherEnum:completion:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to " + @"@selector(callFlutterEchoAnotherEnum:completion:)", + api); + [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { + NSArray *args = message; + AnotherEnumBox *boxedAnotherEnum = GetNullableObjectAtIndex(args, 0); + AnotherEnum arg_anotherEnum = boxedAnotherEnum.value; + [api callFlutterEchoAnotherEnum:arg_anotherEnum + completion:^(AnotherEnumBox *_Nullable output, + FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; + }]; + } else { + [channel setMessageHandler:nil]; + } + } { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] initWithName:[NSString @@ -2694,6 +2862,33 @@ void SetUpHostIntegrationCoreApiWithSuffix(id binaryMess [channel setMessageHandler:nil]; } } + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.pigeon_integration_tests." + @"HostIntegrationCoreApi.callFlutterEchoAnotherNullableEnum", + messageChannelSuffix] + binaryMessenger:binaryMessenger + codec:GetCoreTestsCodec()]; + if (api) { + NSCAssert([api respondsToSelector:@selector(callFlutterEchoAnotherNullableEnum:completion:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to " + @"@selector(callFlutterEchoAnotherNullableEnum:completion:)", + api); + [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { + NSArray *args = message; + AnotherEnumBox *arg_anotherEnum = GetNullableObjectAtIndex(args, 0); + [api callFlutterEchoAnotherNullableEnum:arg_anotherEnum + completion:^(AnotherEnumBox *_Nullable output, + FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; + }]; + } else { + [channel setMessageHandler:nil]; + } + } { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] initWithName: @@ -3190,6 +3385,33 @@ - (void)echoEnum:(AnEnum)arg_anEnum } }]; } +- (void)echoAnotherEnum:(AnotherEnum)arg_anotherEnum + completion:(void (^)(AnotherEnumBox *_Nullable, FlutterError *_Nullable))completion { + NSString *channelName = [NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAnotherEnum", + _messageChannelSuffix]; + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:GetCoreTestsCodec()]; + [channel sendMessage:@[ [[AnotherEnumBox alloc] initWithValue:arg_anotherEnum] ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion(nil, [FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + AnotherEnumBox *output = reply[0] == [NSNull null] ? nil : reply[0]; + completion(output, nil); + } + } else { + completion(nil, createConnectionError(channelName)); + } + }]; +} - (void)echoNullableBool:(nullable NSNumber *)arg_aBool completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion { NSString *channelName = [NSString @@ -3410,6 +3632,34 @@ - (void)echoNullableEnum:(nullable AnEnumBox *)arg_anEnum } }]; } +- (void)echoAnotherNullableEnum:(nullable AnotherEnumBox *)arg_anotherEnum + completion: + (void (^)(AnotherEnumBox *_Nullable, FlutterError *_Nullable))completion { + NSString *channelName = + [NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.pigeon_integration_tests." + @"FlutterIntegrationCoreApi.echoAnotherNullableEnum", + _messageChannelSuffix]; + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:GetCoreTestsCodec()]; + [channel sendMessage:@[ arg_anotherEnum == nil ? [NSNull null] : arg_anotherEnum ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion(nil, [FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + AnotherEnumBox *output = reply[0] == [NSNull null] ? nil : reply[0]; + completion(output, nil); + } + } else { + completion(nil, createConnectionError(channelName)); + } + }]; +} - (void)noopAsyncWithCompletion:(void (^)(FlutterError *_Nullable))completion { NSString *channelName = [NSString stringWithFormat: diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/integration_tests.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/integration_tests.dart index de771318eb6..40221efda70 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/integration_tests.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/integration_tests.dart @@ -35,338 +35,333 @@ enum TargetGenerator { swift, } -/// Sets up and runs the integration tests. -void runPigeonIntegrationTests(TargetGenerator targetGenerator) { - IntegrationTestWidgetsFlutterBinding.ensureInitialized(); - - void compareAllTypes(AllTypes? allTypesOne, AllTypes? allTypesTwo) { - expect(allTypesOne == null, allTypesTwo == null); - if (allTypesOne == null || allTypesTwo == null) { - return; - } - expect(allTypesOne.aBool, allTypesTwo.aBool); - expect(allTypesOne.anInt, allTypesTwo.anInt); - expect(allTypesOne.anInt64, allTypesTwo.anInt64); - expect(allTypesOne.aDouble, allTypesTwo.aDouble); - expect(allTypesOne.aString, allTypesTwo.aString); - expect(allTypesOne.aByteArray, allTypesTwo.aByteArray); - expect(allTypesOne.a4ByteArray, allTypesTwo.a4ByteArray); - expect(allTypesOne.a8ByteArray, allTypesTwo.a8ByteArray); - expect(allTypesOne.aFloatArray, allTypesTwo.aFloatArray); - expect(allTypesOne.anEnum, allTypesTwo.anEnum); - expect(allTypesOne.anObject, allTypesTwo.anObject); - expect(listEquals(allTypesOne.list, allTypesTwo.list), true); - expect(listEquals(allTypesOne.stringList, allTypesTwo.stringList), true); - expect(listEquals(allTypesOne.boolList, allTypesTwo.boolList), true); - expect(listEquals(allTypesOne.doubleList, allTypesTwo.doubleList), true); - expect(listEquals(allTypesOne.intList, allTypesTwo.intList), true); - expect(mapEquals(allTypesOne.map, allTypesTwo.map), true); +void _compareAllTypes(AllTypes? allTypesOne, AllTypes? allTypesTwo) { + expect(allTypesOne == null, allTypesTwo == null); + if (allTypesOne == null || allTypesTwo == null) { + return; } + expect(allTypesOne.aBool, allTypesTwo.aBool); + expect(allTypesOne.anInt, allTypesTwo.anInt); + expect(allTypesOne.anInt64, allTypesTwo.anInt64); + expect(allTypesOne.aDouble, allTypesTwo.aDouble); + expect(allTypesOne.aString, allTypesTwo.aString); + expect(allTypesOne.aByteArray, allTypesTwo.aByteArray); + expect(allTypesOne.a4ByteArray, allTypesTwo.a4ByteArray); + expect(allTypesOne.a8ByteArray, allTypesTwo.a8ByteArray); + expect(allTypesOne.aFloatArray, allTypesTwo.aFloatArray); + expect(allTypesOne.anEnum, allTypesTwo.anEnum); + expect(allTypesOne.anObject, allTypesTwo.anObject); + expect(listEquals(allTypesOne.list, allTypesTwo.list), true); + expect(listEquals(allTypesOne.stringList, allTypesTwo.stringList), true); + expect(listEquals(allTypesOne.boolList, allTypesTwo.boolList), true); + expect(listEquals(allTypesOne.doubleList, allTypesTwo.doubleList), true); + expect(listEquals(allTypesOne.intList, allTypesTwo.intList), true); + expect(mapEquals(allTypesOne.map, allTypesTwo.map), true); +} - void compareAllNullableTypes(AllNullableTypes? allNullableTypesOne, - AllNullableTypes? allNullableTypesTwo) { - expect(allNullableTypesOne == null, allNullableTypesTwo == null); - if (allNullableTypesOne == null || allNullableTypesTwo == null) { - return; - } - expect( - allNullableTypesOne.aNullableBool, allNullableTypesTwo.aNullableBool); - expect(allNullableTypesOne.aNullableInt, allNullableTypesTwo.aNullableInt); - expect( - allNullableTypesOne.aNullableInt64, allNullableTypesTwo.aNullableInt64); - expect(allNullableTypesOne.aNullableDouble, - allNullableTypesTwo.aNullableDouble); - expect(allNullableTypesOne.aNullableString, - allNullableTypesTwo.aNullableString); - expect(allNullableTypesOne.aNullableByteArray, - allNullableTypesTwo.aNullableByteArray); - expect(allNullableTypesOne.aNullable4ByteArray, - allNullableTypesTwo.aNullable4ByteArray); - expect(allNullableTypesOne.aNullable8ByteArray, - allNullableTypesTwo.aNullable8ByteArray); - expect(allNullableTypesOne.aNullableFloatArray, - allNullableTypesTwo.aNullableFloatArray); - expect(allNullableTypesOne.nullableNestedList?.length, - allNullableTypesTwo.nullableNestedList?.length); - // TODO(stuartmorgan): Enable this once the Dart types are fixed; see - // https://github.com/flutter/flutter/issues/116117 - //for (int i = 0; i < allNullableTypesOne.nullableNestedList!.length; i++) { - // expect(listEquals(allNullableTypesOne.nullableNestedList![i], allNullableTypesTwo.nullableNestedList![i]), - // true); - //} - expect( - mapEquals(allNullableTypesOne.nullableMapWithAnnotations, - allNullableTypesTwo.nullableMapWithAnnotations), - true); - expect( - mapEquals(allNullableTypesOne.nullableMapWithObject, - allNullableTypesTwo.nullableMapWithObject), - true); - expect(allNullableTypesOne.aNullableObject, - allNullableTypesTwo.aNullableObject); - expect( - allNullableTypesOne.aNullableEnum, allNullableTypesTwo.aNullableEnum); - compareAllNullableTypes(allNullableTypesOne.allNullableTypes, - allNullableTypesTwo.allNullableTypes); - expect( - listEquals(allNullableTypesOne.list, allNullableTypesTwo.list), true); - expect( - listEquals( - allNullableTypesOne.stringList, allNullableTypesTwo.stringList), - true); - expect( - listEquals(allNullableTypesOne.boolList, allNullableTypesTwo.boolList), - true); - expect( - listEquals( - allNullableTypesOne.doubleList, allNullableTypesTwo.doubleList), - true); - expect(listEquals(allNullableTypesOne.intList, allNullableTypesTwo.intList), - true); - expect(allNullableTypesOne.nestedClassList?.length, - allNullableTypesTwo.nestedClassList?.length); - for (int i = 0; - i < (allNullableTypesOne.nestedClassList?.length ?? 0); - i++) { - compareAllNullableTypes(allNullableTypesOne.nestedClassList?[i], - allNullableTypesTwo.nestedClassList?[i]); - } - expect(mapEquals(allNullableTypesOne.map, allNullableTypesTwo.map), true); +void _compareAllNullableTypes(AllNullableTypes? allNullableTypesOne, + AllNullableTypes? allNullableTypesTwo) { + expect(allNullableTypesOne == null, allNullableTypesTwo == null); + if (allNullableTypesOne == null || allNullableTypesTwo == null) { + return; } - - void compareAllNullableTypesWithoutRecursion( - AllNullableTypesWithoutRecursion? allNullableTypesOne, - AllNullableTypesWithoutRecursion? allNullableTypesTwo) { - expect(allNullableTypesOne == null, allNullableTypesTwo == null); - if (allNullableTypesOne == null || allNullableTypesTwo == null) { - return; - } - expect( - allNullableTypesOne.aNullableBool, allNullableTypesTwo.aNullableBool); - expect(allNullableTypesOne.aNullableInt, allNullableTypesTwo.aNullableInt); - expect( - allNullableTypesOne.aNullableInt64, allNullableTypesTwo.aNullableInt64); - expect(allNullableTypesOne.aNullableDouble, - allNullableTypesTwo.aNullableDouble); - expect(allNullableTypesOne.aNullableString, - allNullableTypesTwo.aNullableString); - expect(allNullableTypesOne.aNullableByteArray, - allNullableTypesTwo.aNullableByteArray); - expect(allNullableTypesOne.aNullable4ByteArray, - allNullableTypesTwo.aNullable4ByteArray); - expect(allNullableTypesOne.aNullable8ByteArray, - allNullableTypesTwo.aNullable8ByteArray); - expect(allNullableTypesOne.aNullableFloatArray, - allNullableTypesTwo.aNullableFloatArray); - expect(allNullableTypesOne.nullableNestedList?.length, - allNullableTypesTwo.nullableNestedList?.length); - // TODO(stuartmorgan): Enable this once the Dart types are fixed; see - // https://github.com/flutter/flutter/issues/116117 - //for (int i = 0; i < allNullableTypesOne.nullableNestedList!.length; i++) { - // expect(listEquals(allNullableTypesOne.nullableNestedList![i], allNullableTypesTwo.nullableNestedList![i]), - // true); - //} - expect( - mapEquals(allNullableTypesOne.nullableMapWithAnnotations, - allNullableTypesTwo.nullableMapWithAnnotations), - true); - expect( - mapEquals(allNullableTypesOne.nullableMapWithObject, - allNullableTypesTwo.nullableMapWithObject), - true); - expect(allNullableTypesOne.aNullableObject, - allNullableTypesTwo.aNullableObject); - expect( - allNullableTypesOne.aNullableEnum, allNullableTypesTwo.aNullableEnum); - expect( - listEquals(allNullableTypesOne.list, allNullableTypesTwo.list), true); - expect( - listEquals( - allNullableTypesOne.stringList, allNullableTypesTwo.stringList), - true); - expect( - listEquals(allNullableTypesOne.boolList, allNullableTypesTwo.boolList), - true); - expect( - listEquals( - allNullableTypesOne.doubleList, allNullableTypesTwo.doubleList), - true); - expect(listEquals(allNullableTypesOne.intList, allNullableTypesTwo.intList), - true); - expect(mapEquals(allNullableTypesOne.map, allNullableTypesTwo.map), true); + expect(allNullableTypesOne.aNullableBool, allNullableTypesTwo.aNullableBool); + expect(allNullableTypesOne.aNullableInt, allNullableTypesTwo.aNullableInt); + expect( + allNullableTypesOne.aNullableInt64, allNullableTypesTwo.aNullableInt64); + expect( + allNullableTypesOne.aNullableDouble, allNullableTypesTwo.aNullableDouble); + expect( + allNullableTypesOne.aNullableString, allNullableTypesTwo.aNullableString); + expect(allNullableTypesOne.aNullableByteArray, + allNullableTypesTwo.aNullableByteArray); + expect(allNullableTypesOne.aNullable4ByteArray, + allNullableTypesTwo.aNullable4ByteArray); + expect(allNullableTypesOne.aNullable8ByteArray, + allNullableTypesTwo.aNullable8ByteArray); + expect(allNullableTypesOne.aNullableFloatArray, + allNullableTypesTwo.aNullableFloatArray); + expect(allNullableTypesOne.nullableNestedList?.length, + allNullableTypesTwo.nullableNestedList?.length); + // TODO(stuartmorgan): Enable this once the Dart types are fixed; see + // https://github.com/flutter/flutter/issues/116117 + //for (int i = 0; i < allNullableTypesOne.nullableNestedList!.length; i++) { + // expect(listEquals(allNullableTypesOne.nullableNestedList![i], allNullableTypesTwo.nullableNestedList![i]), + // true); + //} + expect( + mapEquals(allNullableTypesOne.nullableMapWithAnnotations, + allNullableTypesTwo.nullableMapWithAnnotations), + true); + expect( + mapEquals(allNullableTypesOne.nullableMapWithObject, + allNullableTypesTwo.nullableMapWithObject), + true); + expect( + allNullableTypesOne.aNullableObject, allNullableTypesTwo.aNullableObject); + expect(allNullableTypesOne.aNullableEnum, allNullableTypesTwo.aNullableEnum); + _compareAllNullableTypes(allNullableTypesOne.allNullableTypes, + allNullableTypesTwo.allNullableTypes); + expect(listEquals(allNullableTypesOne.list, allNullableTypesTwo.list), true); + expect( + listEquals( + allNullableTypesOne.stringList, allNullableTypesTwo.stringList), + true); + expect(listEquals(allNullableTypesOne.boolList, allNullableTypesTwo.boolList), + true); + expect( + listEquals( + allNullableTypesOne.doubleList, allNullableTypesTwo.doubleList), + true); + expect(listEquals(allNullableTypesOne.intList, allNullableTypesTwo.intList), + true); + expect(allNullableTypesOne.nestedClassList?.length, + allNullableTypesTwo.nestedClassList?.length); + for (int i = 0; i < (allNullableTypesOne.nestedClassList?.length ?? 0); i++) { + _compareAllNullableTypes(allNullableTypesOne.nestedClassList?[i], + allNullableTypesTwo.nestedClassList?[i]); } + expect(mapEquals(allNullableTypesOne.map, allNullableTypesTwo.map), true); +} - void compareAllClassesWrapper( - AllClassesWrapper? wrapperOne, AllClassesWrapper? wrapperTwo) { - expect(wrapperOne == null, wrapperTwo == null); - if (wrapperOne == null || wrapperTwo == null) { - return; - } - - compareAllNullableTypes( - wrapperOne.allNullableTypes, wrapperTwo.allNullableTypes); - compareAllNullableTypesWithoutRecursion( - wrapperOne.allNullableTypesWithoutRecursion, - wrapperTwo.allNullableTypesWithoutRecursion, - ); - compareAllTypes(wrapperOne.allTypes, wrapperTwo.allTypes); +void __compareAllNullableTypesWithoutRecursion( + AllNullableTypesWithoutRecursion? allNullableTypesOne, + AllNullableTypesWithoutRecursion? allNullableTypesTwo) { + expect(allNullableTypesOne == null, allNullableTypesTwo == null); + if (allNullableTypesOne == null || allNullableTypesTwo == null) { + return; } + expect(allNullableTypesOne.aNullableBool, allNullableTypesTwo.aNullableBool); + expect(allNullableTypesOne.aNullableInt, allNullableTypesTwo.aNullableInt); + expect( + allNullableTypesOne.aNullableInt64, allNullableTypesTwo.aNullableInt64); + expect( + allNullableTypesOne.aNullableDouble, allNullableTypesTwo.aNullableDouble); + expect( + allNullableTypesOne.aNullableString, allNullableTypesTwo.aNullableString); + expect(allNullableTypesOne.aNullableByteArray, + allNullableTypesTwo.aNullableByteArray); + expect(allNullableTypesOne.aNullable4ByteArray, + allNullableTypesTwo.aNullable4ByteArray); + expect(allNullableTypesOne.aNullable8ByteArray, + allNullableTypesTwo.aNullable8ByteArray); + expect(allNullableTypesOne.aNullableFloatArray, + allNullableTypesTwo.aNullableFloatArray); + expect(allNullableTypesOne.nullableNestedList?.length, + allNullableTypesTwo.nullableNestedList?.length); + // TODO(stuartmorgan): Enable this once the Dart types are fixed; see + // https://github.com/flutter/flutter/issues/116117 + //for (int i = 0; i < allNullableTypesOne.nullableNestedList!.length; i++) { + // expect(listEquals(allNullableTypesOne.nullableNestedList![i], allNullableTypesTwo.nullableNestedList![i]), + // true); + //} + expect( + mapEquals(allNullableTypesOne.nullableMapWithAnnotations, + allNullableTypesTwo.nullableMapWithAnnotations), + true); + expect( + mapEquals(allNullableTypesOne.nullableMapWithObject, + allNullableTypesTwo.nullableMapWithObject), + true); + expect( + allNullableTypesOne.aNullableObject, allNullableTypesTwo.aNullableObject); + expect(allNullableTypesOne.aNullableEnum, allNullableTypesTwo.aNullableEnum); + expect(listEquals(allNullableTypesOne.list, allNullableTypesTwo.list), true); + expect( + listEquals( + allNullableTypesOne.stringList, allNullableTypesTwo.stringList), + true); + expect(listEquals(allNullableTypesOne.boolList, allNullableTypesTwo.boolList), + true); + expect( + listEquals( + allNullableTypesOne.doubleList, allNullableTypesTwo.doubleList), + true); + expect(listEquals(allNullableTypesOne.intList, allNullableTypesTwo.intList), + true); + expect(mapEquals(allNullableTypesOne.map, allNullableTypesTwo.map), true); +} - final Map map = { - 'a': 1, - 'b': 2.0, - 'c': 'three', - 'd': false, - 'e': null - }; - - final List list = [ - 'Thing 1', - 2, - true, - 3.14, - null, - ]; - - final List stringList = [ - 'Thing 1', - '2', - 'true', - '3.14', - null, - ]; - - final List intList = [ - 1, - 2, - 3, - 4, - null, - ]; - - final List doubleList = [ - 1, - 2.99999, - 3, - 3.14, - null, - ]; - - final List boolList = [ - true, - false, - true, - false, - null, - ]; - - final AllTypes genericAllTypes = AllTypes( - aBool: true, - anInt: _regularInt, - anInt64: _biggerThanBigInt, - aDouble: _doublePi, - aString: 'Hello host!', - aByteArray: Uint8List.fromList([1, 2, 3]), - a4ByteArray: Int32List.fromList([4, 5, 6]), - a8ByteArray: Int64List.fromList([7, 8, 9]), - aFloatArray: Float64List.fromList([2.71828, _doublePi]), - anEnum: AnEnum.fortyTwo, - anObject: 1, - list: list, - stringList: stringList, - intList: intList, - doubleList: doubleList, - boolList: boolList, - map: map, - ); +void _compareAllClassesWrapper( + AllClassesWrapper? wrapperOne, AllClassesWrapper? wrapperTwo) { + expect(wrapperOne == null, wrapperTwo == null); + if (wrapperOne == null || wrapperTwo == null) { + return; + } - final AllNullableTypes genericAllNullableTypes = AllNullableTypes( - aNullableBool: true, - aNullableInt: _regularInt, - aNullableInt64: _biggerThanBigInt, - aNullableDouble: _doublePi, - aNullableString: 'Hello host!', - aNullableByteArray: Uint8List.fromList([1, 2, 3]), - aNullable4ByteArray: Int32List.fromList([4, 5, 6]), - aNullable8ByteArray: Int64List.fromList([7, 8, 9]), - aNullableFloatArray: Float64List.fromList([2.71828, _doublePi]), - nullableNestedList: >[ - [true, false], - [false, true] - ], - nullableMapWithAnnotations: {}, - nullableMapWithObject: {}, - aNullableEnum: AnEnum.fourHundredTwentyTwo, - aNullableObject: 0, - list: list, - stringList: stringList, - intList: intList, - doubleList: doubleList, - boolList: boolList, - map: map, + _compareAllNullableTypes( + wrapperOne.allNullableTypes, wrapperTwo.allNullableTypes); + __compareAllNullableTypesWithoutRecursion( + wrapperOne.allNullableTypesWithoutRecursion, + wrapperTwo.allNullableTypesWithoutRecursion, ); + _compareAllTypes(wrapperOne.allTypes, wrapperTwo.allTypes); +} - final List allNullableTypesList = [ - genericAllNullableTypes, - AllNullableTypes(), - null, - ]; - - final AllNullableTypes recursiveAllNullableTypes = AllNullableTypes( - aNullableBool: true, - aNullableInt: _regularInt, - aNullableInt64: _biggerThanBigInt, - aNullableDouble: _doublePi, - aNullableString: 'Hello host!', - aNullableByteArray: Uint8List.fromList([1, 2, 3]), - aNullable4ByteArray: Int32List.fromList([4, 5, 6]), - aNullable8ByteArray: Int64List.fromList([7, 8, 9]), - aNullableFloatArray: Float64List.fromList([2.71828, _doublePi]), - nullableNestedList: >[ - [true, false], - [false, true] - ], - nullableMapWithAnnotations: {}, - nullableMapWithObject: {}, - aNullableEnum: AnEnum.fourHundredTwentyTwo, - aNullableObject: 0, - allNullableTypes: genericAllNullableTypes, - list: list, - stringList: stringList, - intList: intList, - doubleList: doubleList, - boolList: boolList, - nestedClassList: allNullableTypesList, - map: map, - ); +final Map _map = { + 'a': 1, + 'b': 2.0, + 'c': 'three', + 'd': false, + 'e': null +}; + +final List _list = [ + 'Thing 1', + 2, + true, + 3.14, + null, +]; + +final List _stringList = [ + 'Thing 1', + '2', + 'true', + '3.14', + null, +]; + +final List _intList = [ + 1, + 2, + 3, + 4, + null, +]; + +final List _doubleList = [ + 1, + 2.99999, + 3, + 3.14, + null, +]; + +final List _boolList = [ + true, + false, + true, + false, + null, +]; + +final AllTypes _genericAllTypes = AllTypes( + aBool: true, + anInt: _regularInt, + anInt64: _biggerThanBigInt, + aDouble: _doublePi, + aString: 'Hello host!', + aByteArray: Uint8List.fromList([1, 2, 3]), + a4ByteArray: Int32List.fromList([4, 5, 6]), + a8ByteArray: Int64List.fromList([7, 8, 9]), + aFloatArray: Float64List.fromList([2.71828, _doublePi]), + anEnum: AnEnum.fortyTwo, + // ignore: avoid_redundant_argument_values + anotherEnum: AnotherEnum.justInCase, + anObject: 1, + list: _list, + stringList: _stringList, + intList: _intList, + doubleList: _doubleList, + boolList: _boolList, + map: _map, +); + +final AllNullableTypes _genericAllNullableTypes = AllNullableTypes( + aNullableBool: true, + aNullableInt: _regularInt, + aNullableInt64: _biggerThanBigInt, + aNullableDouble: _doublePi, + aNullableString: 'Hello host!', + aNullableByteArray: Uint8List.fromList([1, 2, 3]), + aNullable4ByteArray: Int32List.fromList([4, 5, 6]), + aNullable8ByteArray: Int64List.fromList([7, 8, 9]), + aNullableFloatArray: Float64List.fromList([2.71828, _doublePi]), + nullableNestedList: >[ + [true, false], + [false, true] + ], + nullableMapWithAnnotations: {}, + nullableMapWithObject: {}, + aNullableEnum: AnEnum.fourHundredTwentyTwo, + anotherNullableEnum: AnotherEnum.justInCase, + aNullableObject: 0, + list: _list, + stringList: _stringList, + intList: _intList, + doubleList: _doubleList, + boolList: _boolList, + map: _map, +); + +final List _allNullableTypesList = [ + _genericAllNullableTypes, + AllNullableTypes(), + null, +]; + +final AllNullableTypes _recursiveAllNullableTypes = AllNullableTypes( + aNullableBool: true, + aNullableInt: _regularInt, + aNullableInt64: _biggerThanBigInt, + aNullableDouble: _doublePi, + aNullableString: 'Hello host!', + aNullableByteArray: Uint8List.fromList([1, 2, 3]), + aNullable4ByteArray: Int32List.fromList([4, 5, 6]), + aNullable8ByteArray: Int64List.fromList([7, 8, 9]), + aNullableFloatArray: Float64List.fromList([2.71828, _doublePi]), + nullableNestedList: >[ + [true, false], + [false, true] + ], + nullableMapWithAnnotations: {}, + nullableMapWithObject: {}, + aNullableEnum: AnEnum.fourHundredTwentyTwo, + anotherNullableEnum: AnotherEnum.justInCase, + aNullableObject: 0, + allNullableTypes: _genericAllNullableTypes, + list: _list, + stringList: _stringList, + intList: _intList, + doubleList: _doubleList, + boolList: _boolList, + nestedClassList: _allNullableTypesList, + map: _map, +); + +final AllNullableTypesWithoutRecursion + __genericAllNullableTypesWithoutRecursion = + AllNullableTypesWithoutRecursion( + aNullableBool: true, + aNullableInt: _regularInt, + aNullableInt64: _biggerThanBigInt, + aNullableDouble: _doublePi, + aNullableString: 'Hello host!', + aNullableByteArray: Uint8List.fromList([1, 2, 3]), + aNullable4ByteArray: Int32List.fromList([4, 5, 6]), + aNullable8ByteArray: Int64List.fromList([7, 8, 9]), + aNullableFloatArray: Float64List.fromList([2.71828, _doublePi]), + nullableNestedList: >[ + [true, false], + [false, true] + ], + nullableMapWithAnnotations: {}, + nullableMapWithObject: {}, + aNullableEnum: AnEnum.fourHundredTwentyTwo, + anotherNullableEnum: AnotherEnum.justInCase, + aNullableObject: 0, + list: _list, + stringList: _stringList, + intList: _intList, + doubleList: _doubleList, + boolList: _boolList, + map: _map, +); - final AllNullableTypesWithoutRecursion - genericAllNullableTypesWithoutRecursion = - AllNullableTypesWithoutRecursion( - aNullableBool: true, - aNullableInt: _regularInt, - aNullableInt64: _biggerThanBigInt, - aNullableDouble: _doublePi, - aNullableString: 'Hello host!', - aNullableByteArray: Uint8List.fromList([1, 2, 3]), - aNullable4ByteArray: Int32List.fromList([4, 5, 6]), - aNullable8ByteArray: Int64List.fromList([7, 8, 9]), - aNullableFloatArray: Float64List.fromList([2.71828, _doublePi]), - nullableNestedList: >[ - [true, false], - [false, true] - ], - nullableMapWithAnnotations: {}, - nullableMapWithObject: {}, - aNullableEnum: AnEnum.fourHundredTwentyTwo, - aNullableObject: 0, - list: list, - stringList: stringList, - intList: intList, - doubleList: doubleList, - boolList: boolList, - map: map, - ); +/// Sets up and runs the integration tests. +void runPigeonIntegrationTests(TargetGenerator targetGenerator) { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); group('Host sync API tests', () { testWidgets('basic void->void call works', (WidgetTester _) async { @@ -379,8 +374,8 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { (WidgetTester _) async { final HostIntegrationCoreApi api = HostIntegrationCoreApi(); - final AllTypes echoObject = await api.echoAllTypes(genericAllTypes); - compareAllTypes(echoObject, genericAllTypes); + final AllTypes echoObject = await api.echoAllTypes(_genericAllTypes); + _compareAllTypes(echoObject, _genericAllTypes); }); testWidgets('all nullable datatypes serialize and deserialize correctly', @@ -388,9 +383,9 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { final HostIntegrationCoreApi api = HostIntegrationCoreApi(); final AllNullableTypes? echoObject = - await api.echoAllNullableTypes(recursiveAllNullableTypes); + await api.echoAllNullableTypes(_recursiveAllNullableTypes); - compareAllNullableTypes(echoObject, recursiveAllNullableTypes); + _compareAllNullableTypes(echoObject, _recursiveAllNullableTypes); }); testWidgets('all null datatypes serialize and deserialize correctly', @@ -401,7 +396,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { final AllNullableTypes? echoNullFilledClass = await api.echoAllNullableTypes(allTypesNull); - compareAllNullableTypes(allTypesNull, echoNullFilledClass); + _compareAllNullableTypes(allTypesNull, echoNullFilledClass); }); testWidgets('Classes with list of null serialize and deserialize correctly', @@ -414,7 +409,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { final AllNullableTypes? echoNullFilledClass = await api.echoAllNullableTypes(nullableListTypes); - compareAllNullableTypes(nullableListTypes, echoNullFilledClass); + _compareAllNullableTypes(nullableListTypes, echoNullFilledClass); }); testWidgets('Classes with map of null serialize and deserialize correctly', @@ -427,7 +422,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { final AllNullableTypes? echoNullFilledClass = await api.echoAllNullableTypes(nullableListTypes); - compareAllNullableTypes(nullableListTypes, echoNullFilledClass); + _compareAllNullableTypes(nullableListTypes, echoNullFilledClass); }); testWidgets( @@ -437,10 +432,10 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { final AllNullableTypesWithoutRecursion? echoObject = await api.echoAllNullableTypesWithoutRecursion( - genericAllNullableTypesWithoutRecursion); + __genericAllNullableTypesWithoutRecursion); - compareAllNullableTypesWithoutRecursion( - echoObject, genericAllNullableTypesWithoutRecursion); + __compareAllNullableTypesWithoutRecursion( + echoObject, __genericAllNullableTypesWithoutRecursion); }); testWidgets( @@ -453,7 +448,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { final AllNullableTypesWithoutRecursion? echoNullFilledClass = await api.echoAllNullableTypesWithoutRecursion(allTypesNull); - compareAllNullableTypesWithoutRecursion( + __compareAllNullableTypesWithoutRecursion( allTypesNull, echoNullFilledClass); }); @@ -470,7 +465,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { final AllNullableTypesWithoutRecursion? echoNullFilledClass = await api.echoAllNullableTypesWithoutRecursion(nullableListTypes); - compareAllNullableTypesWithoutRecursion( + __compareAllNullableTypesWithoutRecursion( nullableListTypes, echoNullFilledClass); }); @@ -487,7 +482,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { final AllNullableTypesWithoutRecursion? echoNullFilledClass = await api.echoAllNullableTypesWithoutRecursion(nullableListTypes); - compareAllNullableTypesWithoutRecursion( + __compareAllNullableTypesWithoutRecursion( nullableListTypes, echoNullFilledClass); }); @@ -525,10 +520,10 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { final HostIntegrationCoreApi api = HostIntegrationCoreApi(); final AllClassesWrapper sentObject = AllClassesWrapper( - allNullableTypes: recursiveAllNullableTypes, + allNullableTypes: _recursiveAllNullableTypes, allNullableTypesWithoutRecursion: - genericAllNullableTypesWithoutRecursion, - allTypes: genericAllTypes); + __genericAllNullableTypesWithoutRecursion, + allTypes: _genericAllTypes); final String? receivedString = await api.extractNestedNullableString(sentObject); @@ -552,12 +547,12 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { final AllClassesWrapper sentWrapper = AllClassesWrapper( allNullableTypes: AllNullableTypes(), allNullableTypesWithoutRecursion: AllNullableTypesWithoutRecursion(), - allTypes: genericAllTypes, + allTypes: _genericAllTypes, ); final AllClassesWrapper receivedClassWrapper = await api.echoClassWrapper(sentWrapper); - compareAllClassesWrapper(sentWrapper, receivedClassWrapper); + _compareAllClassesWrapper(sentWrapper, receivedClassWrapper); }); testWidgets('nested null classes can serialize and deserialize correctly', @@ -571,7 +566,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { final AllClassesWrapper receivedClassWrapper = await api.echoClassWrapper(sentWrapper); - compareAllClassesWrapper(sentWrapper, receivedClassWrapper); + _compareAllClassesWrapper(sentWrapper, receivedClassWrapper); }); testWidgets( @@ -738,6 +733,15 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { expect(receivedEnum, sentEnum); }); + testWidgets('enums serialize and deserialize correctly (again)', + (WidgetTester _) async { + final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + + const AnotherEnum sentEnum = AnotherEnum.justInCase; + final AnotherEnum receivedEnum = await api.echoAnotherEnum(sentEnum); + expect(receivedEnum, sentEnum); + }); + testWidgets('multi word enums serialize and deserialize correctly', (WidgetTester _) async { final HostIntegrationCoreApi api = HostIntegrationCoreApi(); @@ -952,6 +956,15 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { expect(echoEnum, sentEnum); }); + testWidgets('nullable enums serialize and deserialize correctly (again)', + (WidgetTester _) async { + final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + + const AnotherEnum sentEnum = AnotherEnum.justInCase; + final AnotherEnum? echoEnum = await api.echoAnotherNullableEnum(sentEnum); + expect(echoEnum, sentEnum); + }); + testWidgets('multi word nullable enums serialize and deserialize correctly', (WidgetTester _) async { final HostIntegrationCoreApi api = HostIntegrationCoreApi(); @@ -986,6 +999,15 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { expect(echoEnum, sentEnum); }); + testWidgets('null enums serialize and deserialize correctly (again)', + (WidgetTester _) async { + final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + + const AnotherEnum? sentEnum = null; + final AnotherEnum? echoEnum = await api.echoAnotherNullableEnum(sentEnum); + expect(echoEnum, sentEnum); + }); + testWidgets('null classes serialize and deserialize correctly', (WidgetTester _) async { final HostIntegrationCoreApi api = HostIntegrationCoreApi(); @@ -1069,9 +1091,9 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { (WidgetTester _) async { final HostIntegrationCoreApi api = HostIntegrationCoreApi(); - final AllTypes echoObject = await api.echoAsyncAllTypes(genericAllTypes); + final AllTypes echoObject = await api.echoAsyncAllTypes(_genericAllTypes); - compareAllTypes(echoObject, genericAllTypes); + _compareAllTypes(echoObject, _genericAllTypes); }); testWidgets( @@ -1080,9 +1102,9 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { final HostIntegrationCoreApi api = HostIntegrationCoreApi(); final AllNullableTypes? echoObject = await api - .echoAsyncNullableAllNullableTypes(recursiveAllNullableTypes); + .echoAsyncNullableAllNullableTypes(_recursiveAllNullableTypes); - compareAllNullableTypes(echoObject, recursiveAllNullableTypes); + _compareAllNullableTypes(echoObject, _recursiveAllNullableTypes); }); testWidgets('all null datatypes async serialize and deserialize correctly', @@ -1093,7 +1115,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { final AllNullableTypes? echoNullFilledClass = await api.echoAsyncNullableAllNullableTypes(allTypesNull); - compareAllNullableTypes(echoNullFilledClass, allTypesNull); + _compareAllNullableTypes(echoNullFilledClass, allTypesNull); }); testWidgets( @@ -1103,10 +1125,10 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { final AllNullableTypesWithoutRecursion? echoObject = await api.echoAsyncNullableAllNullableTypesWithoutRecursion( - genericAllNullableTypesWithoutRecursion); + __genericAllNullableTypesWithoutRecursion); - compareAllNullableTypesWithoutRecursion( - echoObject, genericAllNullableTypesWithoutRecursion); + __compareAllNullableTypesWithoutRecursion( + echoObject, __genericAllNullableTypesWithoutRecursion); }); testWidgets( @@ -1119,7 +1141,7 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { final AllNullableTypesWithoutRecursion? echoNullFilledClass = await api .echoAsyncNullableAllNullableTypesWithoutRecursion(allTypesNull); - compareAllNullableTypesWithoutRecursion( + __compareAllNullableTypesWithoutRecursion( echoNullFilledClass, allTypesNull); }); @@ -1236,6 +1258,15 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { expect(echoEnum, sentEnum); }); + testWidgets('enums serialize and deserialize correctly (again)', + (WidgetTester _) async { + final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + + const AnotherEnum sentEnum = AnotherEnum.justInCase; + final AnotherEnum echoEnum = await api.echoAnotherAsyncEnum(sentEnum); + expect(echoEnum, sentEnum); + }); + testWidgets('multi word enums serialize and deserialize correctly', (WidgetTester _) async { final HostIntegrationCoreApi api = HostIntegrationCoreApi(); @@ -1362,6 +1393,16 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { expect(echoEnum, sentEnum); }); + testWidgets('nullable enums serialize and deserialize correctly (again)', + (WidgetTester _) async { + final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + + const AnotherEnum sentEnum = AnotherEnum.justInCase; + final AnotherEnum? echoEnum = + await api.echoAnotherAsyncNullableEnum(sentEnum); + expect(echoEnum, sentEnum); + }); + testWidgets('nullable enums serialize and deserialize correctly', (WidgetTester _) async { final HostIntegrationCoreApi api = HostIntegrationCoreApi(); @@ -1445,6 +1486,16 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { final AnEnum? echoEnum = await api.echoAsyncNullableEnum(null); expect(echoEnum, sentEnum); }); + + testWidgets('null enums serialize and deserialize correctly', + (WidgetTester _) async { + final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + + const AnotherEnum? sentEnum = null; + final AnotherEnum? echoEnum = + await api.echoAnotherAsyncNullableEnum(null); + expect(echoEnum, sentEnum); + }); }); group('Host API with suffix', () { @@ -1521,9 +1572,9 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { final HostIntegrationCoreApi api = HostIntegrationCoreApi(); final AllTypes echoObject = - await api.callFlutterEchoAllTypes(genericAllTypes); + await api.callFlutterEchoAllTypes(_genericAllTypes); - compareAllTypes(echoObject, genericAllTypes); + _compareAllTypes(echoObject, _genericAllTypes); }); testWidgets( @@ -1675,6 +1726,16 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { expect(echoEnum, sentEnum); }); + testWidgets('enums serialize and deserialize correctly (again)', + (WidgetTester _) async { + final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + + const AnotherEnum sentEnum = AnotherEnum.justInCase; + final AnotherEnum echoEnum = + await api.callFlutterEchoAnotherEnum(sentEnum); + expect(echoEnum, sentEnum); + }); + testWidgets('multi word enums serialize and deserialize correctly', (WidgetTester _) async { final HostIntegrationCoreApi api = HostIntegrationCoreApi(); @@ -1848,6 +1909,16 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { expect(echoEnum, sentEnum); }); + testWidgets('nullable enums serialize and deserialize correctly (again)', + (WidgetTester _) async { + final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + + const AnotherEnum sentEnum = AnotherEnum.justInCase; + final AnotherEnum? echoEnum = + await api.callFlutterEchoAnotherNullableEnum(sentEnum); + expect(echoEnum, sentEnum); + }); + testWidgets('multi word nullable enums serialize and deserialize correctly', (WidgetTester _) async { final HostIntegrationCoreApi api = HostIntegrationCoreApi(); @@ -1865,6 +1936,16 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { final AnEnum? echoEnum = await api.callFlutterEchoNullableEnum(sentEnum); expect(echoEnum, sentEnum); }); + + testWidgets('null enums serialize and deserialize correctly (again)', + (WidgetTester _) async { + final HostIntegrationCoreApi api = HostIntegrationCoreApi(); + + const AnotherEnum? sentEnum = null; + final AnotherEnum? echoEnum = + await api.callFlutterEchoAnotherNullableEnum(sentEnum); + expect(echoEnum, sentEnum); + }); }); group('Flutter API with suffix', () { @@ -1962,6 +2043,9 @@ class _FlutterApiTestImplementation implements FlutterIntegrationCoreApi { @override AnEnum echoEnum(AnEnum anEnum) => anEnum; + @override + AnotherEnum echoAnotherEnum(AnotherEnum anotherEnum) => anotherEnum; + @override bool? echoNullableBool(bool? aBool) => aBool; @@ -1986,6 +2070,9 @@ class _FlutterApiTestImplementation implements FlutterIntegrationCoreApi { @override AnEnum? echoNullableEnum(AnEnum? anEnum) => anEnum; + @override + AnotherEnum? echoAnotherNullableEnum(AnotherEnum? anotherEnum) => anotherEnum; + @override Future noopAsync() async {} diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/background_platform_channels.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/background_platform_channels.gen.dart index e9e063126c1..9fb5e58df03 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/background_platform_channels.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/background_platform_channels.gen.dart @@ -29,41 +29,41 @@ class BackgroundApi2Host { /// BinaryMessenger will be used which routes to the host platform. BackgroundApi2Host( {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) - : __pigeon_binaryMessenger = binaryMessenger, - __pigeon_messageChannelSuffix = + : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; - final BinaryMessenger? __pigeon_binaryMessenger; + final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - final String __pigeon_messageChannelSuffix; + final String pigeonVar_messageChannelSuffix; Future add(int x, int y) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.BackgroundApi2Host.add$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.BackgroundApi2Host.add$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([x, y]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([x, y]) 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 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 int?)!; + return (pigeonVar_replyList[0] as int?)!; } } } diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart index e192a84ceea..762b5d77502 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart @@ -38,6 +38,10 @@ enum AnEnum { fourHundredTwentyTwo, } +enum AnotherEnum { + justInCase, +} + /// A class containing all supported types. class AllTypes { AllTypes({ @@ -50,6 +54,7 @@ class AllTypes { required this.a8ByteArray, required this.aFloatArray, this.anEnum = AnEnum.one, + this.anotherEnum = AnotherEnum.justInCase, this.aString = '', this.anObject = 0, required this.list, @@ -78,6 +83,8 @@ class AllTypes { AnEnum anEnum; + AnotherEnum anotherEnum; + String aString; Object anObject; @@ -105,6 +112,7 @@ class AllTypes { a8ByteArray, aFloatArray, anEnum, + anotherEnum, aString, anObject, list, @@ -128,14 +136,15 @@ class AllTypes { a8ByteArray: result[6]! as Int64List, aFloatArray: result[7]! as Float64List, anEnum: result[8]! as AnEnum, - aString: result[9]! as String, - anObject: result[10]!, - list: result[11]! as List, - stringList: (result[12] as List?)!.cast(), - intList: (result[13] as List?)!.cast(), - doubleList: (result[14] as List?)!.cast(), - boolList: (result[15] as List?)!.cast(), - map: result[16]! as Map, + anotherEnum: result[9]! as AnotherEnum, + aString: result[10]! as String, + anObject: result[11]!, + list: result[12]! as List, + stringList: (result[13] as List?)!.cast(), + intList: (result[14] as List?)!.cast(), + doubleList: (result[15] as List?)!.cast(), + boolList: (result[16] as List?)!.cast(), + map: result[17]! as Map, ); } } @@ -155,6 +164,7 @@ class AllNullableTypes { this.nullableMapWithAnnotations, this.nullableMapWithObject, this.aNullableEnum, + this.anotherNullableEnum, this.aNullableString, this.aNullableObject, this.allNullableTypes, @@ -191,6 +201,8 @@ class AllNullableTypes { AnEnum? aNullableEnum; + AnotherEnum? anotherNullableEnum; + String? aNullableString; Object? aNullableObject; @@ -225,6 +237,7 @@ class AllNullableTypes { nullableMapWithAnnotations, nullableMapWithObject, aNullableEnum, + anotherNullableEnum, aNullableString, aNullableObject, allNullableTypes, @@ -255,17 +268,18 @@ class AllNullableTypes { nullableMapWithObject: (result[10] as Map?)?.cast(), aNullableEnum: result[11] as AnEnum?, - aNullableString: result[12] as String?, - aNullableObject: result[13], - allNullableTypes: result[14] as AllNullableTypes?, - list: result[15] as List?, - stringList: (result[16] as List?)?.cast(), - intList: (result[17] as List?)?.cast(), - doubleList: (result[18] as List?)?.cast(), - boolList: (result[19] as List?)?.cast(), + anotherNullableEnum: result[12] as AnotherEnum?, + aNullableString: result[13] as String?, + aNullableObject: result[14], + allNullableTypes: result[15] as AllNullableTypes?, + list: result[16] as List?, + stringList: (result[17] as List?)?.cast(), + intList: (result[18] as List?)?.cast(), + doubleList: (result[19] as List?)?.cast(), + boolList: (result[20] as List?)?.cast(), nestedClassList: - (result[20] as List?)?.cast(), - map: result[21] as Map?, + (result[21] as List?)?.cast(), + map: result[22] as Map?, ); } } @@ -287,6 +301,7 @@ class AllNullableTypesWithoutRecursion { this.nullableMapWithAnnotations, this.nullableMapWithObject, this.aNullableEnum, + this.anotherNullableEnum, this.aNullableString, this.aNullableObject, this.list, @@ -321,6 +336,8 @@ class AllNullableTypesWithoutRecursion { AnEnum? aNullableEnum; + AnotherEnum? anotherNullableEnum; + String? aNullableString; Object? aNullableObject; @@ -351,6 +368,7 @@ class AllNullableTypesWithoutRecursion { nullableMapWithAnnotations, nullableMapWithObject, aNullableEnum, + anotherNullableEnum, aNullableString, aNullableObject, list, @@ -379,14 +397,15 @@ class AllNullableTypesWithoutRecursion { nullableMapWithObject: (result[10] as Map?)?.cast(), aNullableEnum: result[11] as AnEnum?, - aNullableString: result[12] as String?, - aNullableObject: result[13], - list: result[14] as List?, - stringList: (result[15] as List?)?.cast(), - intList: (result[16] as List?)?.cast(), - doubleList: (result[17] as List?)?.cast(), - boolList: (result[18] as List?)?.cast(), - map: result[19] as Map?, + anotherNullableEnum: result[12] as AnotherEnum?, + aNullableString: result[13] as String?, + aNullableObject: result[14], + list: result[15] as List?, + stringList: (result[16] as List?)?.cast(), + intList: (result[17] as List?)?.cast(), + doubleList: (result[18] as List?)?.cast(), + boolList: (result[19] as List?)?.cast(), + map: result[20] as Map?, ); } } @@ -454,24 +473,27 @@ class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { - if (value is AllTypes) { + if (value is AnEnum) { buffer.putUint8(129); + writeValue(buffer, value.index); + } else if (value is AnotherEnum) { + buffer.putUint8(130); + writeValue(buffer, value.index); + } else if (value is AllTypes) { + buffer.putUint8(131); writeValue(buffer, value.encode()); } else if (value is AllNullableTypes) { - buffer.putUint8(130); + buffer.putUint8(132); writeValue(buffer, value.encode()); } else if (value is AllNullableTypesWithoutRecursion) { - buffer.putUint8(131); + buffer.putUint8(133); writeValue(buffer, value.encode()); } else if (value is AllClassesWrapper) { - buffer.putUint8(132); + buffer.putUint8(134); writeValue(buffer, value.encode()); } else if (value is TestMessage) { - buffer.putUint8(133); + buffer.putUint8(135); writeValue(buffer, value.encode()); - } else if (value is AnEnum) { - buffer.putUint8(134); - writeValue(buffer, value.index); } else { super.writeValue(buffer, value); } @@ -481,18 +503,21 @@ class _PigeonCodec extends StandardMessageCodec { Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { case 129: - return AllTypes.decode(readValue(buffer)!); + final int? value = readValue(buffer) as int?; + return value == null ? null : AnEnum.values[value]; case 130: - return AllNullableTypes.decode(readValue(buffer)!); + final int? value = readValue(buffer) as int?; + return value == null ? null : AnotherEnum.values[value]; case 131: - return AllNullableTypesWithoutRecursion.decode(readValue(buffer)!); + return AllTypes.decode(readValue(buffer)!); case 132: - return AllClassesWrapper.decode(readValue(buffer)!); + return AllNullableTypes.decode(readValue(buffer)!); case 133: - return TestMessage.decode(readValue(buffer)!); + return AllNullableTypesWithoutRecursion.decode(readValue(buffer)!); case 134: - final int? value = readValue(buffer) as int?; - return value == null ? null : AnEnum.values[value]; + return AllClassesWrapper.decode(readValue(buffer)!); + case 135: + return TestMessage.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); } @@ -507,35 +532,35 @@ class HostIntegrationCoreApi { /// BinaryMessenger will be used which routes to the host platform. HostIntegrationCoreApi( {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) - : __pigeon_binaryMessenger = binaryMessenger, - __pigeon_messageChannelSuffix = + : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; - final BinaryMessenger? __pigeon_binaryMessenger; + final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - final String __pigeon_messageChannelSuffix; + final String pigeonVar_messageChannelSuffix; /// A no-op function taking no arguments and returning no value, to sanity /// test basic calling. Future noop() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noop$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noop$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; @@ -544,78 +569,78 @@ class HostIntegrationCoreApi { /// Returns the passed object, to test serialization and deserialization. Future echoAllTypes(AllTypes everything) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllTypes$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllTypes$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([everything]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([everything]) 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 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 AllTypes?)!; + return (pigeonVar_replyList[0] as AllTypes?)!; } } /// Returns an error, to test error handling. Future throwError() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwError$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwError$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]; + return pigeonVar_replyList[0]; } } /// Returns an error from a void function, to test error handling. Future throwErrorFromVoid() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwErrorFromVoid$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwErrorFromVoid$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; @@ -624,443 +649,473 @@ class HostIntegrationCoreApi { /// Returns a Flutter error, to test error handling. Future throwFlutterError() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwFlutterError$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwFlutterError$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]; + return pigeonVar_replyList[0]; } } /// Returns passed in int. Future echoInt(int anInt) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoInt$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoInt$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([anInt]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([anInt]) 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 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 int?)!; + return (pigeonVar_replyList[0] as int?)!; } } /// Returns passed in double. Future echoDouble(double aDouble) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoDouble$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoDouble$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([aDouble]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([aDouble]) 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 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 double?)!; + return (pigeonVar_replyList[0] as double?)!; } } /// Returns the passed in boolean. Future echoBool(bool aBool) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoBool$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoBool$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([aBool]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([aBool]) 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 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 bool?)!; + return (pigeonVar_replyList[0] as bool?)!; } } /// Returns the passed in string. Future echoString(String aString) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoString$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoString$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([aString]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([aString]) 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 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 String?)!; + return (pigeonVar_replyList[0] as String?)!; } } /// Returns the passed in Uint8List. Future echoUint8List(Uint8List aUint8List) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoUint8List$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoUint8List$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([aUint8List]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([aUint8List]) 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 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 Uint8List?)!; + return (pigeonVar_replyList[0] as Uint8List?)!; } } /// Returns the passed in generic Object. Future echoObject(Object anObject) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoObject$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoObject$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([anObject]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([anObject]) 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 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]!; + return pigeonVar_replyList[0]!; } } /// Returns the passed list, to test serialization and deserialization. Future> echoList(List list) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoList$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoList$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([list]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([list]) 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 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 the passed map, to test serialization and deserialization. Future> echoMap(Map aMap) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoMap$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoMap$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([aMap]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([aMap]) 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 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 Map?)! + return (pigeonVar_replyList[0] as Map?)! .cast(); } } /// Returns the passed map to test nested class serialization and deserialization. Future echoClassWrapper(AllClassesWrapper wrapper) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoClassWrapper$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoClassWrapper$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([wrapper]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([wrapper]) 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 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 AllClassesWrapper?)!; + return (pigeonVar_replyList[0] as AllClassesWrapper?)!; } } /// Returns the passed enum to test serialization and deserialization. Future echoEnum(AnEnum anEnum) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoEnum$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoEnum$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([anEnum]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([anEnum]) 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 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 AnEnum?)!; + return (pigeonVar_replyList[0] as AnEnum?)!; + } + } + + /// Returns the passed enum to test serialization and deserialization. + Future echoAnotherEnum(AnotherEnum anotherEnum) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAnotherEnum$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([anotherEnum]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else if (pigeonVar_replyList[0] == null) { + throw PlatformException( + code: 'null-error', + message: 'Host platform returned null value for non-null return value.', + ); + } else { + return (pigeonVar_replyList[0] as AnotherEnum?)!; } } /// Returns the default string. Future echoNamedDefaultString({String aString = 'default'}) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedDefaultString$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedDefaultString$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([aString]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([aString]) 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 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 String?)!; + return (pigeonVar_replyList[0] as String?)!; } } /// Returns passed in double. Future echoOptionalDefaultDouble([double aDouble = 3.14]) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalDefaultDouble$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalDefaultDouble$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([aDouble]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([aDouble]) 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 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 double?)!; + return (pigeonVar_replyList[0] as double?)!; } } /// Returns passed in int. Future echoRequiredInt({required int anInt}) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoRequiredInt$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoRequiredInt$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([anInt]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([anInt]) 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 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 int?)!; + return (pigeonVar_replyList[0] as int?)!; } } /// Returns the passed object, to test serialization and deserialization. Future echoAllNullableTypes( AllNullableTypes? everything) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllNullableTypes$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllNullableTypes$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([everything]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([everything]) 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 AllNullableTypes?); + return (pigeonVar_replyList[0] as AllNullableTypes?); } } @@ -1068,52 +1123,52 @@ class HostIntegrationCoreApi { Future echoAllNullableTypesWithoutRecursion( AllNullableTypesWithoutRecursion? everything) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllNullableTypesWithoutRecursion$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllNullableTypesWithoutRecursion$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([everything]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([everything]) 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 AllNullableTypesWithoutRecursion?); + return (pigeonVar_replyList[0] as AllNullableTypesWithoutRecursion?); } } /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. Future extractNestedNullableString(AllClassesWrapper wrapper) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.extractNestedNullableString$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.extractNestedNullableString$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([wrapper]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([wrapper]) 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 String?); + return (pigeonVar_replyList[0] as String?); } } @@ -1121,63 +1176,63 @@ class HostIntegrationCoreApi { /// sending of nested objects. Future createNestedNullableString( String? nullableString) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.createNestedNullableString$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.createNestedNullableString$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([nullableString]) 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 AllClassesWrapper?)!; + return (pigeonVar_replyList[0] as AllClassesWrapper?)!; } } /// Returns passed in arguments of multiple types. Future sendMultipleNullableTypes( bool? aNullableBool, int? aNullableInt, String? aNullableString) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.sendMultipleNullableTypes$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.sendMultipleNullableTypes$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([aNullableBool, aNullableInt, aNullableString]) 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 AllNullableTypes?)!; + return (pigeonVar_replyList[0] as AllNullableTypes?)!; } } @@ -1185,332 +1240,356 @@ class HostIntegrationCoreApi { Future sendMultipleNullableTypesWithoutRecursion(bool? aNullableBool, int? aNullableInt, String? aNullableString) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.sendMultipleNullableTypesWithoutRecursion$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.sendMultipleNullableTypesWithoutRecursion$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([aNullableBool, aNullableInt, aNullableString]) 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 AllNullableTypesWithoutRecursion?)!; + return (pigeonVar_replyList[0] as AllNullableTypesWithoutRecursion?)!; } } /// Returns passed in int. Future echoNullableInt(int? aNullableInt) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableInt$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableInt$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([aNullableInt]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([aNullableInt]) 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 int?); + return (pigeonVar_replyList[0] as int?); } } /// Returns passed in double. Future echoNullableDouble(double? aNullableDouble) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableDouble$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableDouble$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([aNullableDouble]) 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 double?); + return (pigeonVar_replyList[0] as double?); } } /// Returns the passed in boolean. Future echoNullableBool(bool? aNullableBool) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableBool$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableBool$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([aNullableBool]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = await pigeonVar_channel + .send([aNullableBool]) 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 bool?); + return (pigeonVar_replyList[0] as bool?); } } /// Returns the passed in string. Future echoNullableString(String? aNullableString) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableString$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableString$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([aNullableString]) 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?); } } /// Returns the passed in Uint8List. Future echoNullableUint8List( Uint8List? aNullableUint8List) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableUint8List$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableUint8List$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([aNullableUint8List]) 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 Uint8List?); + return (pigeonVar_replyList[0] as Uint8List?); } } /// Returns the passed in generic Object. Future echoNullableObject(Object? aNullableObject) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableObject$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableObject$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([aNullableObject]) 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]; + return pigeonVar_replyList[0]; } } /// Returns the passed list, to test serialization and deserialization. Future?> echoNullableList(List? aNullableList) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableList$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableList$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([aNullableList]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = await pigeonVar_channel + .send([aNullableList]) 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 List?)?.cast(); + return (pigeonVar_replyList[0] as List?)?.cast(); } } /// Returns the passed map, to test serialization and deserialization. Future?> echoNullableMap( Map? aNullableMap) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableMap$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableMap$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([aNullableMap]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([aNullableMap]) 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 Map?) + return (pigeonVar_replyList[0] as Map?) ?.cast(); } } Future echoNullableEnum(AnEnum? anEnum) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableEnum$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableEnum$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([anEnum]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else { + return (pigeonVar_replyList[0] as AnEnum?); + } + } + + Future echoAnotherNullableEnum(AnotherEnum? anotherEnum) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAnotherNullableEnum$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([anEnum]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([anotherEnum]) 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 AnEnum?); + return (pigeonVar_replyList[0] as AnotherEnum?); } } /// Returns passed in int. Future echoOptionalNullableInt([int? aNullableInt]) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalNullableInt$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalNullableInt$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([aNullableInt]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([aNullableInt]) 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 int?); + return (pigeonVar_replyList[0] as int?); } } /// Returns the passed in string. Future echoNamedNullableString({String? aNullableString}) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedNullableString$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedNullableString$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([aNullableString]) 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?); } } /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. Future noopAsync() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noopAsync$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noopAsync$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; @@ -1519,319 +1598,349 @@ class HostIntegrationCoreApi { /// Returns passed in int asynchronously. Future echoAsyncInt(int anInt) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncInt$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncInt$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([anInt]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([anInt]) 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 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 int?)!; + return (pigeonVar_replyList[0] as int?)!; } } /// Returns passed in double asynchronously. Future echoAsyncDouble(double aDouble) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncDouble$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncDouble$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([aDouble]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([aDouble]) 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 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 double?)!; + return (pigeonVar_replyList[0] as double?)!; } } /// Returns the passed in boolean asynchronously. Future echoAsyncBool(bool aBool) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncBool$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncBool$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([aBool]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([aBool]) 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 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 bool?)!; + return (pigeonVar_replyList[0] as bool?)!; } } /// Returns the passed string asynchronously. Future echoAsyncString(String aString) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncString$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncString$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([aString]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([aString]) 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 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 String?)!; + return (pigeonVar_replyList[0] as String?)!; } } /// Returns the passed in Uint8List asynchronously. Future echoAsyncUint8List(Uint8List aUint8List) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncUint8List$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncUint8List$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([aUint8List]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([aUint8List]) 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 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 Uint8List?)!; + return (pigeonVar_replyList[0] as Uint8List?)!; } } /// Returns the passed in generic Object asynchronously. Future echoAsyncObject(Object anObject) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncObject$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncObject$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([anObject]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([anObject]) 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 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]!; + return pigeonVar_replyList[0]!; } } /// Returns the passed list, to test asynchronous serialization and deserialization. Future> echoAsyncList(List list) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncList$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncList$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([list]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([list]) 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 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 the passed map, to test asynchronous serialization and deserialization. Future> echoAsyncMap(Map aMap) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncMap$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncMap$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([aMap]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([aMap]) 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 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 Map?)! + return (pigeonVar_replyList[0] as Map?)! .cast(); } } /// Returns the passed enum, to test asynchronous serialization and deserialization. Future echoAsyncEnum(AnEnum anEnum) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncEnum$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncEnum$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([anEnum]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else if (pigeonVar_replyList[0] == null) { + throw PlatformException( + code: 'null-error', + message: 'Host platform returned null value for non-null return value.', + ); + } else { + return (pigeonVar_replyList[0] as AnEnum?)!; + } + } + + /// Returns the passed enum, to test asynchronous serialization and deserialization. + Future echoAnotherAsyncEnum(AnotherEnum anotherEnum) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAnotherAsyncEnum$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([anEnum]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([anotherEnum]) 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 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 AnEnum?)!; + return (pigeonVar_replyList[0] as AnotherEnum?)!; } } /// Responds with an error from an async function returning a value. Future throwAsyncError() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncError$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncError$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]; + return pigeonVar_replyList[0]; } } /// Responds with an error from an async void function. Future throwAsyncErrorFromVoid() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncErrorFromVoid$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncErrorFromVoid$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; @@ -1840,82 +1949,82 @@ class HostIntegrationCoreApi { /// Responds with a Flutter error from an async function returning a value. Future throwAsyncFlutterError() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncFlutterError$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncFlutterError$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]; + return pigeonVar_replyList[0]; } } /// Returns the passed object, to test async serialization and deserialization. Future echoAsyncAllTypes(AllTypes everything) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncAllTypes$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncAllTypes$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([everything]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([everything]) 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 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 AllTypes?)!; + return (pigeonVar_replyList[0] as AllTypes?)!; } } /// Returns the passed object, to test serialization and deserialization. Future echoAsyncNullableAllNullableTypes( AllNullableTypes? everything) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableAllNullableTypes$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableAllNullableTypes$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([everything]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([everything]) 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 AllNullableTypes?); + return (pigeonVar_replyList[0] as AllNullableTypes?); } } @@ -1923,274 +2032,300 @@ class HostIntegrationCoreApi { Future echoAsyncNullableAllNullableTypesWithoutRecursion( AllNullableTypesWithoutRecursion? everything) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableAllNullableTypesWithoutRecursion$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableAllNullableTypesWithoutRecursion$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([everything]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([everything]) 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 AllNullableTypesWithoutRecursion?); + return (pigeonVar_replyList[0] as AllNullableTypesWithoutRecursion?); } } /// Returns passed in int asynchronously. Future echoAsyncNullableInt(int? anInt) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableInt$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableInt$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([anInt]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([anInt]) 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 int?); + return (pigeonVar_replyList[0] as int?); } } /// Returns passed in double asynchronously. Future echoAsyncNullableDouble(double? aDouble) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableDouble$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableDouble$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([aDouble]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([aDouble]) 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 double?); + return (pigeonVar_replyList[0] as double?); } } /// Returns the passed in boolean asynchronously. Future echoAsyncNullableBool(bool? aBool) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableBool$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableBool$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([aBool]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([aBool]) 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 bool?); + return (pigeonVar_replyList[0] as bool?); } } /// Returns the passed string asynchronously. Future echoAsyncNullableString(String? aString) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableString$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableString$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([aString]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([aString]) 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 String?); + return (pigeonVar_replyList[0] as String?); } } /// Returns the passed in Uint8List asynchronously. Future echoAsyncNullableUint8List(Uint8List? aUint8List) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableUint8List$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableUint8List$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([aUint8List]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([aUint8List]) 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 Uint8List?); + return (pigeonVar_replyList[0] as Uint8List?); } } /// Returns the passed in generic Object asynchronously. Future echoAsyncNullableObject(Object? anObject) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableObject$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableObject$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([anObject]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([anObject]) 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]; + return pigeonVar_replyList[0]; } } /// Returns the passed list, to test asynchronous serialization and deserialization. Future?> echoAsyncNullableList(List? list) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableList$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableList$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([list]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([list]) 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 List?)?.cast(); + return (pigeonVar_replyList[0] as List?)?.cast(); } } /// Returns the passed map, to test asynchronous serialization and deserialization. Future?> echoAsyncNullableMap( Map? aMap) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableMap$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableMap$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([aMap]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([aMap]) 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 Map?) + return (pigeonVar_replyList[0] as Map?) ?.cast(); } } /// Returns the passed enum, to test asynchronous serialization and deserialization. Future echoAsyncNullableEnum(AnEnum? anEnum) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableEnum$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableEnum$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([anEnum]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else { + return (pigeonVar_replyList[0] as AnEnum?); + } + } + + /// Returns the passed enum, to test asynchronous serialization and deserialization. + Future echoAnotherAsyncNullableEnum( + AnotherEnum? anotherEnum) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAnotherAsyncNullableEnum$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([anEnum]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([anotherEnum]) 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 AnEnum?); + return (pigeonVar_replyList[0] as AnotherEnum?); } } Future callFlutterNoop() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterNoop$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterNoop$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; @@ -2198,47 +2333,47 @@ class HostIntegrationCoreApi { } Future callFlutterThrowError() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowError$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowError$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]; + return pigeonVar_replyList[0]; } } Future callFlutterThrowErrorFromVoid() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowErrorFromVoid$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowErrorFromVoid$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; @@ -2246,603 +2381,658 @@ class HostIntegrationCoreApi { } Future callFlutterEchoAllTypes(AllTypes everything) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllTypes$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllTypes$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([everything]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([everything]) 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 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 AllTypes?)!; + return (pigeonVar_replyList[0] as AllTypes?)!; } } Future callFlutterEchoAllNullableTypes( AllNullableTypes? everything) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllNullableTypes$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllNullableTypes$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([everything]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([everything]) 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 AllNullableTypes?); + return (pigeonVar_replyList[0] as AllNullableTypes?); } } Future callFlutterSendMultipleNullableTypes( bool? aNullableBool, int? aNullableInt, String? aNullableString) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterSendMultipleNullableTypes$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterSendMultipleNullableTypes$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([aNullableBool, aNullableInt, aNullableString]) 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 AllNullableTypes?)!; + return (pigeonVar_replyList[0] as AllNullableTypes?)!; } } Future callFlutterEchoAllNullableTypesWithoutRecursion( AllNullableTypesWithoutRecursion? everything) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllNullableTypesWithoutRecursion$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllNullableTypesWithoutRecursion$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([everything]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([everything]) 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 AllNullableTypesWithoutRecursion?); + return (pigeonVar_replyList[0] as AllNullableTypesWithoutRecursion?); } } Future callFlutterSendMultipleNullableTypesWithoutRecursion(bool? aNullableBool, int? aNullableInt, String? aNullableString) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterSendMultipleNullableTypesWithoutRecursion$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterSendMultipleNullableTypesWithoutRecursion$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([aNullableBool, aNullableInt, aNullableString]) 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 AllNullableTypesWithoutRecursion?)!; + return (pigeonVar_replyList[0] as AllNullableTypesWithoutRecursion?)!; } } Future callFlutterEchoBool(bool aBool) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoBool$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoBool$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([aBool]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([aBool]) 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 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 bool?)!; + return (pigeonVar_replyList[0] as bool?)!; } } Future callFlutterEchoInt(int anInt) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoInt$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoInt$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([anInt]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([anInt]) 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 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 int?)!; + return (pigeonVar_replyList[0] as int?)!; } } Future callFlutterEchoDouble(double aDouble) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoDouble$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoDouble$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([aDouble]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([aDouble]) 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 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 double?)!; + return (pigeonVar_replyList[0] as double?)!; } } Future callFlutterEchoString(String aString) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoString$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoString$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([aString]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([aString]) 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 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 String?)!; + return (pigeonVar_replyList[0] as String?)!; } } Future callFlutterEchoUint8List(Uint8List list) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoUint8List$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoUint8List$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([list]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([list]) 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 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 Uint8List?)!; + return (pigeonVar_replyList[0] as Uint8List?)!; } } Future> callFlutterEchoList(List list) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoList$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoList$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([list]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([list]) 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 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> callFlutterEchoMap( Map aMap) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoMap$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoMap$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([aMap]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([aMap]) 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 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 Map?)! + return (pigeonVar_replyList[0] as Map?)! .cast(); } } Future callFlutterEchoEnum(AnEnum anEnum) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoEnum$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoEnum$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([anEnum]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([anEnum]) 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 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 AnEnum?)!; + return (pigeonVar_replyList[0] as AnEnum?)!; + } + } + + Future callFlutterEchoAnotherEnum( + AnotherEnum anotherEnum) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAnotherEnum$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([anotherEnum]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else if (pigeonVar_replyList[0] == null) { + throw PlatformException( + code: 'null-error', + message: 'Host platform returned null value for non-null return value.', + ); + } else { + return (pigeonVar_replyList[0] as AnotherEnum?)!; } } Future callFlutterEchoNullableBool(bool? aBool) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableBool$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableBool$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([aBool]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([aBool]) 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 bool?); + return (pigeonVar_replyList[0] as bool?); } } Future callFlutterEchoNullableInt(int? anInt) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableInt$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableInt$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([anInt]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([anInt]) 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 int?); + return (pigeonVar_replyList[0] as int?); } } Future callFlutterEchoNullableDouble(double? aDouble) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableDouble$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableDouble$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([aDouble]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([aDouble]) 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 double?); + return (pigeonVar_replyList[0] as double?); } } Future callFlutterEchoNullableString(String? aString) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableString$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableString$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([aString]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([aString]) 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 String?); + return (pigeonVar_replyList[0] as String?); } } Future callFlutterEchoNullableUint8List(Uint8List? list) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableUint8List$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableUint8List$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([list]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([list]) 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 Uint8List?); + return (pigeonVar_replyList[0] as Uint8List?); } } Future?> callFlutterEchoNullableList( List? list) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableList$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableList$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([list]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([list]) 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 List?)?.cast(); + return (pigeonVar_replyList[0] as List?)?.cast(); } } Future?> callFlutterEchoNullableMap( Map? aMap) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableMap$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableMap$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([aMap]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([aMap]) 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 Map?) + return (pigeonVar_replyList[0] as Map?) ?.cast(); } } Future callFlutterEchoNullableEnum(AnEnum? anEnum) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableEnum$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableEnum$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([anEnum]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([anEnum]) 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 AnEnum?); + return (pigeonVar_replyList[0] as AnEnum?); + } + } + + Future callFlutterEchoAnotherNullableEnum( + AnotherEnum? anotherEnum) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAnotherNullableEnum$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([anotherEnum]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else { + return (pigeonVar_replyList[0] as AnotherEnum?); } } Future callFlutterSmallApiEchoString(String aString) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterSmallApiEchoString$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterSmallApiEchoString$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([aString]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([aString]) 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 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 String?)!; + return (pigeonVar_replyList[0] as String?)!; } } } @@ -2908,6 +3098,9 @@ abstract class FlutterIntegrationCoreApi { /// Returns the passed enum to test serialization and deserialization. AnEnum echoEnum(AnEnum anEnum); + /// Returns the passed enum to test serialization and deserialization. + AnotherEnum echoAnotherEnum(AnotherEnum anotherEnum); + /// Returns the passed boolean, to test serialization and deserialization. bool? echoNullableBool(bool? aBool); @@ -2932,6 +3125,9 @@ abstract class FlutterIntegrationCoreApi { /// Returns the passed enum to test serialization and deserialization. AnEnum? echoNullableEnum(AnEnum? anEnum); + /// Returns the passed enum to test serialization and deserialization. + AnotherEnum? echoAnotherNullableEnum(AnotherEnum? anotherEnum); + /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. Future noopAsync(); @@ -2947,15 +3143,16 @@ abstract class FlutterIntegrationCoreApi { messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noop$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { try { api.noop(); return wrapResponse(empty: true); @@ -2969,15 +3166,16 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwError$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { try { final Object? output = api.throwError(); return wrapResponse(result: output); @@ -2991,15 +3189,16 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwErrorFromVoid$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { try { api.throwErrorFromVoid(); return wrapResponse(empty: true); @@ -3013,15 +3212,16 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllTypes$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllTypes was null.'); final List args = (message as List?)!; @@ -3041,15 +3241,16 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllNullableTypes$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllNullableTypes was null.'); final List args = (message as List?)!; @@ -3069,15 +3270,16 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.sendMultipleNullableTypes$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.sendMultipleNullableTypes was null.'); final List args = (message as List?)!; @@ -3098,15 +3300,16 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllNullableTypesWithoutRecursion$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllNullableTypesWithoutRecursion was null.'); final List args = (message as List?)!; @@ -3126,15 +3329,16 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.sendMultipleNullableTypesWithoutRecursion$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.sendMultipleNullableTypesWithoutRecursion was null.'); final List args = (message as List?)!; @@ -3156,15 +3360,16 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoBool$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoBool was null.'); final List args = (message as List?)!; @@ -3184,15 +3389,16 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoInt$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoInt was null.'); final List args = (message as List?)!; @@ -3212,15 +3418,16 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoDouble$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoDouble was null.'); final List args = (message as List?)!; @@ -3240,15 +3447,16 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoString$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoString was null.'); final List args = (message as List?)!; @@ -3268,15 +3476,16 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoUint8List$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoUint8List was null.'); final List args = (message as List?)!; @@ -3296,15 +3505,16 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoList$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoList was null.'); final List args = (message as List?)!; @@ -3325,15 +3535,16 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoMap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoMap was null.'); final List args = (message as List?)!; @@ -3354,15 +3565,16 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoEnum$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoEnum was null.'); final List args = (message as List?)!; @@ -3382,15 +3594,45 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAnotherEnum$messageChannelSuffix', + pigeonChannelCodec, + binaryMessenger: binaryMessenger); + if (api == null) { + pigeonVar_channel.setMessageHandler(null); + } else { + pigeonVar_channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAnotherEnum was null.'); + final List args = (message as List?)!; + final AnotherEnum? arg_anotherEnum = (args[0] as AnotherEnum?); + assert(arg_anotherEnum != null, + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAnotherEnum was null, expected non-null AnotherEnum.'); + try { + final AnotherEnum output = api.echoAnotherEnum(arg_anotherEnum!); + return wrapResponse(result: output); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } + }); + } + } + { + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableBool$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableBool was null.'); final List args = (message as List?)!; @@ -3408,15 +3650,16 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableInt$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableInt was null.'); final List args = (message as List?)!; @@ -3434,15 +3677,16 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableDouble$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableDouble was null.'); final List args = (message as List?)!; @@ -3460,15 +3704,16 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableString$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableString was null.'); final List args = (message as List?)!; @@ -3486,15 +3731,16 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableUint8List$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableUint8List was null.'); final List args = (message as List?)!; @@ -3512,15 +3758,16 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableList$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableList was null.'); final List args = (message as List?)!; @@ -3539,15 +3786,16 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableMap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableMap was null.'); final List args = (message as List?)!; @@ -3566,15 +3814,16 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableEnum$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableEnum was null.'); final List args = (message as List?)!; @@ -3592,15 +3841,44 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAnotherNullableEnum$messageChannelSuffix', + pigeonChannelCodec, + binaryMessenger: binaryMessenger); + if (api == null) { + pigeonVar_channel.setMessageHandler(null); + } else { + pigeonVar_channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAnotherNullableEnum was null.'); + final List args = (message as List?)!; + final AnotherEnum? arg_anotherEnum = (args[0] as AnotherEnum?); + try { + final AnotherEnum? output = + api.echoAnotherNullableEnum(arg_anotherEnum); + return wrapResponse(result: output); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } + }); + } + } + { + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noopAsync$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { try { await api.noopAsync(); return wrapResponse(empty: true); @@ -3614,15 +3892,16 @@ abstract class FlutterIntegrationCoreApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAsyncString$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAsyncString was null.'); final List args = (message as List?)!; @@ -3651,33 +3930,33 @@ class HostTrivialApi { /// BinaryMessenger will be used which routes to the host platform. HostTrivialApi( {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) - : __pigeon_binaryMessenger = binaryMessenger, - __pigeon_messageChannelSuffix = + : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; - final BinaryMessenger? __pigeon_binaryMessenger; + final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - final String __pigeon_messageChannelSuffix; + final String pigeonVar_messageChannelSuffix; Future noop() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostTrivialApi.noop$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostTrivialApi.noop$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; @@ -3692,62 +3971,62 @@ class HostSmallApi { /// BinaryMessenger will be used which routes to the host platform. HostSmallApi( {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) - : __pigeon_binaryMessenger = binaryMessenger, - __pigeon_messageChannelSuffix = + : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; - final BinaryMessenger? __pigeon_binaryMessenger; + final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - final String __pigeon_messageChannelSuffix; + final String pigeonVar_messageChannelSuffix; Future echo(String aString) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.echo$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.echo$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([aString]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([aString]) 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 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 String?)!; + return (pigeonVar_replyList[0] as String?)!; } } Future voidVoid() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.voidVoid$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.voidVoid$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; @@ -3771,15 +4050,16 @@ abstract class FlutterSmallApi { messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoWrappedList$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoWrappedList was null.'); final List args = (message as List?)!; @@ -3799,15 +4079,16 @@ abstract class FlutterSmallApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoString$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoString was null.'); final List args = (message as List?)!; diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/enum.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/enum.gen.dart index e2ca92672ed..c20e922fdea 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/enum.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/enum.gen.dart @@ -72,12 +72,12 @@ class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { - if (value is DataWithEnum) { + if (value is EnumState) { buffer.putUint8(129); - writeValue(buffer, value.encode()); - } else if (value is EnumState) { - buffer.putUint8(130); writeValue(buffer, value.index); + } else if (value is DataWithEnum) { + buffer.putUint8(130); + writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -87,10 +87,10 @@ class _PigeonCodec extends StandardMessageCodec { Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { case 129: - return DataWithEnum.decode(readValue(buffer)!); - case 130: final int? value = readValue(buffer) as int?; return value == null ? null : EnumState.values[value]; + case 130: + return DataWithEnum.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); } @@ -104,42 +104,42 @@ class EnumApi2Host { /// BinaryMessenger will be used which routes to the host platform. EnumApi2Host( {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) - : __pigeon_binaryMessenger = binaryMessenger, - __pigeon_messageChannelSuffix = + : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; - final BinaryMessenger? __pigeon_binaryMessenger; + final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - final String __pigeon_messageChannelSuffix; + final String pigeonVar_messageChannelSuffix; /// This comment is to test method documentation comments. Future echo(DataWithEnum data) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.EnumApi2Host.echo$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.EnumApi2Host.echo$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([data]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([data]) 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 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 DataWithEnum?)!; + return (pigeonVar_replyList[0] as DataWithEnum?)!; } } } @@ -159,15 +159,16 @@ abstract class EnumApi2Flutter { messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.EnumApi2Flutter.echo$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.EnumApi2Flutter.echo was null.'); final List args = (message as List?)!; diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/flutter_unittests.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/flutter_unittests.gen.dart index 61e4b97a5fe..07e0958447e 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/flutter_unittests.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/flutter_unittests.gen.dart @@ -151,128 +151,128 @@ class Api { /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. Api({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) - : __pigeon_binaryMessenger = binaryMessenger, - __pigeon_messageChannelSuffix = + : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; - final BinaryMessenger? __pigeon_binaryMessenger; + final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - final String __pigeon_messageChannelSuffix; + final String pigeonVar_messageChannelSuffix; Future search(FlutterSearchRequest request) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.Api.search$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.Api.search$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([request]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([request]) 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 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 FlutterSearchReply?)!; + return (pigeonVar_replyList[0] as FlutterSearchReply?)!; } } Future doSearches(FlutterSearchRequests request) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.Api.doSearches$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.Api.doSearches$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([request]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([request]) 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 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 FlutterSearchReplies?)!; + return (pigeonVar_replyList[0] as FlutterSearchReplies?)!; } } Future echo(FlutterSearchRequests requests) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.Api.echo$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.Api.echo$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([requests]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([requests]) 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 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 FlutterSearchRequests?)!; + return (pigeonVar_replyList[0] as FlutterSearchRequests?)!; } } Future anInt(int value) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.Api.anInt$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.Api.anInt$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([value]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([value]) 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 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 int?)!; + return (pigeonVar_replyList[0] as int?)!; } } } diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/message.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/message.gen.dart index fb7e65c9483..19c10427c3d 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/message.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/message.gen.dart @@ -144,18 +144,18 @@ class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { - if (value is MessageSearchRequest) { + if (value is MessageRequestState) { buffer.putUint8(129); - writeValue(buffer, value.encode()); - } else if (value is MessageSearchReply) { + writeValue(buffer, value.index); + } else if (value is MessageSearchRequest) { buffer.putUint8(130); writeValue(buffer, value.encode()); - } else if (value is MessageNested) { + } else if (value is MessageSearchReply) { buffer.putUint8(131); writeValue(buffer, value.encode()); - } else if (value is MessageRequestState) { + } else if (value is MessageNested) { buffer.putUint8(132); - writeValue(buffer, value.index); + writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -165,14 +165,14 @@ class _PigeonCodec extends StandardMessageCodec { Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { case 129: - return MessageSearchRequest.decode(readValue(buffer)!); + final int? value = readValue(buffer) as int?; + return value == null ? null : MessageRequestState.values[value]; case 130: - return MessageSearchReply.decode(readValue(buffer)!); + return MessageSearchRequest.decode(readValue(buffer)!); case 131: - return MessageNested.decode(readValue(buffer)!); + return MessageSearchReply.decode(readValue(buffer)!); case 132: - final int? value = readValue(buffer) as int?; - return value == null ? null : MessageRequestState.values[value]; + return MessageNested.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); } @@ -188,36 +188,36 @@ class MessageApi { /// BinaryMessenger will be used which routes to the host platform. MessageApi( {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) - : __pigeon_binaryMessenger = binaryMessenger, - __pigeon_messageChannelSuffix = + : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; - final BinaryMessenger? __pigeon_binaryMessenger; + final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - final String __pigeon_messageChannelSuffix; + final String pigeonVar_messageChannelSuffix; /// This comment is to test documentation comments. /// /// This comment also tests multiple line comments. Future initialize() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.MessageApi.initialize$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.MessageApi.initialize$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; @@ -226,31 +226,31 @@ class MessageApi { /// This comment is to test method documentation comments. Future search(MessageSearchRequest request) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.MessageApi.search$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.MessageApi.search$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([request]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([request]) 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 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 MessageSearchReply?)!; + return (pigeonVar_replyList[0] as MessageSearchReply?)!; } } } @@ -262,44 +262,44 @@ class MessageNestedApi { /// BinaryMessenger will be used which routes to the host platform. MessageNestedApi( {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) - : __pigeon_binaryMessenger = binaryMessenger, - __pigeon_messageChannelSuffix = + : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; - final BinaryMessenger? __pigeon_binaryMessenger; + final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - final String __pigeon_messageChannelSuffix; + final String pigeonVar_messageChannelSuffix; /// This comment is to test method documentation comments. /// /// This comment also tests multiple line comments. Future search(MessageNested nested) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.MessageNestedApi.search$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.MessageNestedApi.search$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([nested]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([nested]) 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 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 MessageSearchReply?)!; + return (pigeonVar_replyList[0] as MessageSearchReply?)!; } } } @@ -319,15 +319,16 @@ abstract class MessageFlutterSearchApi { messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.MessageFlutterSearchApi.search$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.MessageFlutterSearchApi.search was null.'); final List args = (message as List?)!; diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/multiple_arity.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/multiple_arity.gen.dart index 33b984077af..0ccb1f5e643 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/multiple_arity.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/multiple_arity.gen.dart @@ -40,41 +40,41 @@ class MultipleArityHostApi { /// BinaryMessenger will be used which routes to the host platform. MultipleArityHostApi( {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) - : __pigeon_binaryMessenger = binaryMessenger, - __pigeon_messageChannelSuffix = + : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; - final BinaryMessenger? __pigeon_binaryMessenger; + final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - final String __pigeon_messageChannelSuffix; + final String pigeonVar_messageChannelSuffix; Future subtract(int x, int y) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.MultipleArityHostApi.subtract$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.MultipleArityHostApi.subtract$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([x, y]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([x, y]) 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 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 int?)!; + return (pigeonVar_replyList[0] as int?)!; } } } @@ -92,15 +92,16 @@ abstract class MultipleArityFlutterApi { messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.MultipleArityFlutterApi.subtract$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.MultipleArityFlutterApi.subtract was null.'); final List args = (message as List?)!; diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/non_null_fields.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/non_null_fields.gen.dart index c9c7fe5a638..ce111714138 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/non_null_fields.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/non_null_fields.gen.dart @@ -127,18 +127,18 @@ class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { - if (value is NonNullFieldSearchRequest) { + if (value is ReplyType) { buffer.putUint8(129); - writeValue(buffer, value.encode()); - } else if (value is ExtraData) { + writeValue(buffer, value.index); + } else if (value is NonNullFieldSearchRequest) { buffer.putUint8(130); writeValue(buffer, value.encode()); - } else if (value is NonNullFieldSearchReply) { + } else if (value is ExtraData) { buffer.putUint8(131); writeValue(buffer, value.encode()); - } else if (value is ReplyType) { + } else if (value is NonNullFieldSearchReply) { buffer.putUint8(132); - writeValue(buffer, value.index); + writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -148,14 +148,14 @@ class _PigeonCodec extends StandardMessageCodec { Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { case 129: - return NonNullFieldSearchRequest.decode(readValue(buffer)!); + final int? value = readValue(buffer) as int?; + return value == null ? null : ReplyType.values[value]; case 130: - return ExtraData.decode(readValue(buffer)!); + return NonNullFieldSearchRequest.decode(readValue(buffer)!); case 131: - return NonNullFieldSearchReply.decode(readValue(buffer)!); + return ExtraData.decode(readValue(buffer)!); case 132: - final int? value = readValue(buffer) as int?; - return value == null ? null : ReplyType.values[value]; + return NonNullFieldSearchReply.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); } @@ -168,42 +168,42 @@ class NonNullFieldHostApi { /// BinaryMessenger will be used which routes to the host platform. NonNullFieldHostApi( {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) - : __pigeon_binaryMessenger = binaryMessenger, - __pigeon_messageChannelSuffix = + : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; - final BinaryMessenger? __pigeon_binaryMessenger; + final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - final String __pigeon_messageChannelSuffix; + final String pigeonVar_messageChannelSuffix; Future search( NonNullFieldSearchRequest nested) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.NonNullFieldHostApi.search$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.NonNullFieldHostApi.search$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([nested]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([nested]) 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 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 NonNullFieldSearchReply?)!; + return (pigeonVar_replyList[0] as NonNullFieldSearchReply?)!; } } } @@ -221,15 +221,16 @@ abstract class NonNullFieldFlutterApi { messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.NonNullFieldFlutterApi.search$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.NonNullFieldFlutterApi.search was null.'); final List args = (message as List?)!; diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/null_fields.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/null_fields.gen.dart index 578a7c28c31..672dccad4a3 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/null_fields.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/null_fields.gen.dart @@ -106,15 +106,15 @@ class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { - if (value is NullFieldsSearchRequest) { + if (value is NullFieldsSearchReplyType) { buffer.putUint8(129); - writeValue(buffer, value.encode()); - } else if (value is NullFieldsSearchReply) { + writeValue(buffer, value.index); + } else if (value is NullFieldsSearchRequest) { buffer.putUint8(130); writeValue(buffer, value.encode()); - } else if (value is NullFieldsSearchReplyType) { + } else if (value is NullFieldsSearchReply) { buffer.putUint8(131); - writeValue(buffer, value.index); + writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -124,12 +124,12 @@ class _PigeonCodec extends StandardMessageCodec { Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { case 129: - return NullFieldsSearchRequest.decode(readValue(buffer)!); - case 130: - return NullFieldsSearchReply.decode(readValue(buffer)!); - case 131: final int? value = readValue(buffer) as int?; return value == null ? null : NullFieldsSearchReplyType.values[value]; + case 130: + return NullFieldsSearchRequest.decode(readValue(buffer)!); + case 131: + return NullFieldsSearchReply.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); } @@ -142,41 +142,41 @@ class NullFieldsHostApi { /// BinaryMessenger will be used which routes to the host platform. NullFieldsHostApi( {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) - : __pigeon_binaryMessenger = binaryMessenger, - __pigeon_messageChannelSuffix = + : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; - final BinaryMessenger? __pigeon_binaryMessenger; + final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - final String __pigeon_messageChannelSuffix; + final String pigeonVar_messageChannelSuffix; Future search(NullFieldsSearchRequest nested) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.NullFieldsHostApi.search$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.NullFieldsHostApi.search$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([nested]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([nested]) 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 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 NullFieldsSearchReply?)!; + return (pigeonVar_replyList[0] as NullFieldsSearchReply?)!; } } } @@ -194,15 +194,16 @@ abstract class NullFieldsFlutterApi { messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.NullFieldsFlutterApi.search$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.NullFieldsFlutterApi.search was null.'); final List args = (message as List?)!; diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/nullable_returns.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/nullable_returns.gen.dart index 72ea0ae7363..6f69283f744 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/nullable_returns.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/nullable_returns.gen.dart @@ -40,36 +40,36 @@ class NullableReturnHostApi { /// BinaryMessenger will be used which routes to the host platform. NullableReturnHostApi( {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) - : __pigeon_binaryMessenger = binaryMessenger, - __pigeon_messageChannelSuffix = + : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; - final BinaryMessenger? __pigeon_binaryMessenger; + final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - final String __pigeon_messageChannelSuffix; + final String pigeonVar_messageChannelSuffix; Future doit() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.NullableReturnHostApi.doit$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.NullableReturnHostApi.doit$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 int?); + return (pigeonVar_replyList[0] as int?); } } } @@ -87,15 +87,16 @@ abstract class NullableReturnFlutterApi { messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.NullableReturnFlutterApi.doit$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { try { final int? output = api.doit(); return wrapResponse(result: output); @@ -117,41 +118,41 @@ class NullableArgHostApi { /// BinaryMessenger will be used which routes to the host platform. NullableArgHostApi( {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) - : __pigeon_binaryMessenger = binaryMessenger, - __pigeon_messageChannelSuffix = + : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; - final BinaryMessenger? __pigeon_binaryMessenger; + final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - final String __pigeon_messageChannelSuffix; + final String pigeonVar_messageChannelSuffix; Future doit(int? x) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.NullableArgHostApi.doit$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.NullableArgHostApi.doit$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([x]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([x]) 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 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 int?)!; + return (pigeonVar_replyList[0] as int?)!; } } } @@ -169,15 +170,16 @@ abstract class NullableArgFlutterApi { messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.NullableArgFlutterApi.doit$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.NullableArgFlutterApi.doit was null.'); final List args = (message as List?)!; @@ -203,36 +205,36 @@ class NullableCollectionReturnHostApi { /// BinaryMessenger will be used which routes to the host platform. NullableCollectionReturnHostApi( {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) - : __pigeon_binaryMessenger = binaryMessenger, - __pigeon_messageChannelSuffix = + : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; - final BinaryMessenger? __pigeon_binaryMessenger; + final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - final String __pigeon_messageChannelSuffix; + final String pigeonVar_messageChannelSuffix; Future?> doit() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.NullableCollectionReturnHostApi.doit$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.NullableCollectionReturnHostApi.doit$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 List?)?.cast(); + return (pigeonVar_replyList[0] as List?)?.cast(); } } } @@ -250,15 +252,16 @@ abstract class NullableCollectionReturnFlutterApi { messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.NullableCollectionReturnFlutterApi.doit$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { try { final List? output = api.doit(); return wrapResponse(result: output); @@ -280,41 +283,41 @@ class NullableCollectionArgHostApi { /// BinaryMessenger will be used which routes to the host platform. NullableCollectionArgHostApi( {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) - : __pigeon_binaryMessenger = binaryMessenger, - __pigeon_messageChannelSuffix = + : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; - final BinaryMessenger? __pigeon_binaryMessenger; + final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - final String __pigeon_messageChannelSuffix; + final String pigeonVar_messageChannelSuffix; Future> doit(List? x) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.NullableCollectionArgHostApi.doit$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.NullableCollectionArgHostApi.doit$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([x]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([x]) 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 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(); } } } @@ -332,15 +335,16 @@ abstract class NullableCollectionArgFlutterApi { messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.NullableCollectionArgFlutterApi.doit$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.NullableCollectionArgFlutterApi.doit was null.'); final List args = (message as List?)!; diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/primitive.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/primitive.gen.dart index 8ac914eb6fa..552938c43ae 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/primitive.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/primitive.gen.dart @@ -40,273 +40,273 @@ class PrimitiveHostApi { /// BinaryMessenger will be used which routes to the host platform. PrimitiveHostApi( {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) - : __pigeon_binaryMessenger = binaryMessenger, - __pigeon_messageChannelSuffix = + : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; - final BinaryMessenger? __pigeon_binaryMessenger; + final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - final String __pigeon_messageChannelSuffix; + final String pigeonVar_messageChannelSuffix; Future anInt(int value) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.anInt$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.anInt$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([value]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([value]) 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 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 int?)!; + return (pigeonVar_replyList[0] as int?)!; } } Future aBool(bool value) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.aBool$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.aBool$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([value]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([value]) 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 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 bool?)!; + return (pigeonVar_replyList[0] as bool?)!; } } Future aString(String value) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.aString$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.aString$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([value]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([value]) 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 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 String?)!; + return (pigeonVar_replyList[0] as String?)!; } } Future aDouble(double value) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.aDouble$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.aDouble$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([value]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([value]) 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 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 double?)!; + return (pigeonVar_replyList[0] as double?)!; } } Future> aMap(Map value) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.aMap$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.aMap$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([value]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([value]) 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 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 Map?)!; + return (pigeonVar_replyList[0] as Map?)!; } } Future> aList(List value) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.aList$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.aList$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([value]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([value]) 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 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?)!; + return (pigeonVar_replyList[0] as List?)!; } } Future anInt32List(Int32List value) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.anInt32List$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.anInt32List$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([value]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([value]) 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 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 Int32List?)!; + return (pigeonVar_replyList[0] as Int32List?)!; } } Future> aBoolList(List value) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.aBoolList$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.aBoolList$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([value]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([value]) 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 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> aStringIntMap(Map value) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.aStringIntMap$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.aStringIntMap$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([value]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([value]) 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 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 Map?)! + return (pigeonVar_replyList[0] as Map?)! .cast(); } } @@ -341,15 +341,16 @@ abstract class PrimitiveFlutterApi { messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.anInt$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.anInt was null.'); final List args = (message as List?)!; @@ -369,15 +370,16 @@ abstract class PrimitiveFlutterApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aBool$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aBool was null.'); final List args = (message as List?)!; @@ -397,15 +399,16 @@ abstract class PrimitiveFlutterApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aString$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aString was null.'); final List args = (message as List?)!; @@ -425,15 +428,16 @@ abstract class PrimitiveFlutterApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aDouble$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aDouble was null.'); final List args = (message as List?)!; @@ -453,15 +457,16 @@ abstract class PrimitiveFlutterApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aMap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aMap was null.'); final List args = (message as List?)!; @@ -482,15 +487,16 @@ abstract class PrimitiveFlutterApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aList$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aList was null.'); final List args = (message as List?)!; @@ -510,15 +516,16 @@ abstract class PrimitiveFlutterApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.anInt32List$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.anInt32List was null.'); final List args = (message as List?)!; @@ -538,15 +545,16 @@ abstract class PrimitiveFlutterApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aBoolList$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aBoolList was null.'); final List args = (message as List?)!; @@ -567,15 +575,16 @@ abstract class PrimitiveFlutterApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aStringIntMap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aStringIntMap was null.'); final List args = (message as List?)!; diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/proxy_api_tests.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/proxy_api_tests.gen.dart index 97dbbc67559..977356f8ae1 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/proxy_api_tests.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/proxy_api_tests.gen.dart @@ -38,13 +38,13 @@ List wrapResponse( /// All implementers are expected to be [immutable] as defined by the annotation /// and override [pigeon_copy] returning an instance of itself. @immutable -abstract class PigeonProxyApiBaseClass { - /// Construct a [PigeonProxyApiBaseClass]. - PigeonProxyApiBaseClass({ +abstract class PigeonInternalProxyApiBaseClass { + /// Construct a [PigeonInternalProxyApiBaseClass]. + PigeonInternalProxyApiBaseClass({ this.pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, + PigeonInternalInstanceManager? pigeon_instanceManager, }) : pigeon_instanceManager = - pigeon_instanceManager ?? PigeonInstanceManager.instance; + pigeon_instanceManager ?? PigeonInternalInstanceManager.instance; /// Sends and receives binary data across the Flutter platform barrier. /// @@ -55,17 +55,17 @@ abstract class PigeonProxyApiBaseClass { /// Maintains instances stored to communicate with native language objects. @protected - final PigeonInstanceManager pigeon_instanceManager; + final PigeonInternalInstanceManager pigeon_instanceManager; /// Instantiates and returns a functionally identical object to oneself. /// /// Outside of tests, this method should only ever be called by - /// [PigeonInstanceManager]. + /// [PigeonInternalInstanceManager]. /// /// Subclasses should always override their parent's implementation of this /// method. @protected - PigeonProxyApiBaseClass pigeon_copy(); + PigeonInternalProxyApiBaseClass pigeon_copy(); } /// Maintains instances used to communicate with the native objects they @@ -83,9 +83,10 @@ abstract class PigeonProxyApiBaseClass { /// is added as a weak reference with the same identifier. This prevents a /// scenario where the weak referenced instance was released and then later /// returned by the host platform. -class PigeonInstanceManager { - /// Constructs a [PigeonInstanceManager]. - PigeonInstanceManager({required void Function(int) onWeakReferenceRemoved}) { +class PigeonInternalInstanceManager { + /// Constructs a [PigeonInternalInstanceManager]. + PigeonInternalInstanceManager( + {required void Function(int) onWeakReferenceRemoved}) { this.onWeakReferenceRemoved = (int identifier) { _weakInstances.remove(identifier); onWeakReferenceRemoved(identifier); @@ -99,12 +100,12 @@ class PigeonInstanceManager { // 0 <= n < 2^16. static const int _maxDartCreatedIdentifier = 65536; - /// The default [PigeonInstanceManager] used by ProxyApis. + /// The default [PigeonInternalInstanceManager] used by ProxyApis. /// /// On creation, this manager makes a call to clear the native /// InstanceManager. This is to prevent identifier conflicts after a host /// restart. - static final PigeonInstanceManager instance = _initInstance(); + static final PigeonInternalInstanceManager instance = _initInstance(); // Expando is used because it doesn't prevent its keys from becoming // inaccessible. This allows the manager to efficiently retrieve an identifier @@ -115,10 +116,10 @@ class PigeonInstanceManager { // by calling instanceManager.getIdentifier() inside of `==` while this was a // HashMap). final Expando _identifiers = Expando(); - final Map> _weakInstances = - >{}; - final Map _strongInstances = - {}; + final Map> + _weakInstances = >{}; + final Map _strongInstances = + {}; late final Finalizer _finalizer; int _nextIdentifier = 0; @@ -126,17 +127,19 @@ class PigeonInstanceManager { /// or becomes inaccessible. late final void Function(int) onWeakReferenceRemoved; - static PigeonInstanceManager _initInstance() { + static PigeonInternalInstanceManager _initInstance() { WidgetsFlutterBinding.ensureInitialized(); - final _PigeonInstanceManagerApi api = _PigeonInstanceManagerApi(); - // Clears the native `PigeonInstanceManager` on the initial use of the Dart one. + final _PigeonInternalInstanceManagerApi api = + _PigeonInternalInstanceManagerApi(); + // Clears the native `PigeonInternalInstanceManager` on the initial use of the Dart one. api.clear(); - final PigeonInstanceManager instanceManager = PigeonInstanceManager( + final PigeonInternalInstanceManager instanceManager = + PigeonInternalInstanceManager( onWeakReferenceRemoved: (int identifier) { api.removeStrongReference(identifier); }, ); - _PigeonInstanceManagerApi.setUpMessageHandlers( + _PigeonInternalInstanceManagerApi.setUpMessageHandlers( instanceManager: instanceManager); ProxyApiTestClass.pigeon_setUpMessageHandlers( pigeon_instanceManager: instanceManager); @@ -155,7 +158,7 @@ class PigeonInstanceManager { /// Throws assertion error if the instance has already been added. /// /// Returns the randomly generated id of the [instance] added. - int addDartCreatedInstance(PigeonProxyApiBaseClass instance) { + int addDartCreatedInstance(PigeonInternalProxyApiBaseClass instance) { final int identifier = _nextUniqueIdentifier(); _addInstanceWithIdentifier(instance, identifier); return identifier; @@ -169,7 +172,7 @@ class PigeonInstanceManager { /// /// This does not remove the strong referenced instance associated with /// [instance]. This can be done with [remove]. - int? removeWeakReference(PigeonProxyApiBaseClass instance) { + int? removeWeakReference(PigeonInternalProxyApiBaseClass instance) { final int? identifier = getIdentifier(instance); if (identifier == null) { return null; @@ -191,7 +194,7 @@ class PigeonInstanceManager { /// /// This does not remove the weak referenced instance associated with /// [identifier]. This can be done with [removeWeakReference]. - T? remove(int identifier) { + T? remove(int identifier) { return _strongInstances.remove(identifier) as T?; } @@ -207,19 +210,20 @@ class PigeonInstanceManager { /// /// This method also expects the host `InstanceManager` to have a strong /// reference to the instance the identifier is associated with. - T? getInstanceWithWeakReference( + T? getInstanceWithWeakReference( int identifier) { - final PigeonProxyApiBaseClass? weakInstance = + final PigeonInternalProxyApiBaseClass? weakInstance = _weakInstances[identifier]?.target; if (weakInstance == null) { - final PigeonProxyApiBaseClass? strongInstance = + final PigeonInternalProxyApiBaseClass? strongInstance = _strongInstances[identifier]; if (strongInstance != null) { - final PigeonProxyApiBaseClass copy = strongInstance.pigeon_copy(); + final PigeonInternalProxyApiBaseClass copy = + strongInstance.pigeon_copy(); _identifiers[copy] = identifier; _weakInstances[identifier] = - WeakReference(copy); + WeakReference(copy); _finalizer.attach(copy, identifier, detach: copy); return copy as T; } @@ -230,7 +234,7 @@ class PigeonInstanceManager { } /// Retrieves the identifier associated with instance. - int? getIdentifier(PigeonProxyApiBaseClass instance) { + int? getIdentifier(PigeonInternalProxyApiBaseClass instance) { return _identifiers[instance]; } @@ -244,22 +248,22 @@ class PigeonInstanceManager { /// /// Returns unique identifier of the [instance] added. void addHostCreatedInstance( - PigeonProxyApiBaseClass instance, int identifier) { + PigeonInternalProxyApiBaseClass instance, int identifier) { _addInstanceWithIdentifier(instance, identifier); } void _addInstanceWithIdentifier( - PigeonProxyApiBaseClass instance, int identifier) { + PigeonInternalProxyApiBaseClass instance, int identifier) { assert(!containsIdentifier(identifier)); assert(getIdentifier(instance) == null); assert(identifier >= 0); _identifiers[instance] = identifier; _weakInstances[identifier] = - WeakReference(instance); + WeakReference(instance); _finalizer.attach(instance, identifier, detach: instance); - final PigeonProxyApiBaseClass copy = instance.pigeon_copy(); + final PigeonInternalProxyApiBaseClass copy = instance.pigeon_copy(); _identifiers[copy] = identifier; _strongInstances[identifier] = copy; } @@ -280,13 +284,13 @@ class PigeonInstanceManager { } } -/// Generated API for managing the Dart and native `PigeonInstanceManager`s. -class _PigeonInstanceManagerApi { - /// Constructor for [_PigeonInstanceManagerApi]. - _PigeonInstanceManagerApi({BinaryMessenger? binaryMessenger}) - : __pigeon_binaryMessenger = binaryMessenger; +/// Generated API for managing the Dart and native `PigeonInternalInstanceManager`s. +class _PigeonInternalInstanceManagerApi { + /// Constructor for [_PigeonInternalInstanceManagerApi]. + _PigeonInternalInstanceManagerApi({BinaryMessenger? binaryMessenger}) + : pigeonVar_binaryMessenger = binaryMessenger; - final BinaryMessenger? __pigeon_binaryMessenger; + final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = StandardMessageCodec(); @@ -294,26 +298,27 @@ class _PigeonInstanceManagerApi { static void setUpMessageHandlers({ bool pigeon_clearHandlers = false, BinaryMessenger? binaryMessenger, - PigeonInstanceManager? instanceManager, + PigeonInternalInstanceManager? instanceManager, }) { { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.pigeon_integration_tests.PigeonInstanceManagerApi.removeStrongReference', + 'dev.flutter.pigeon.pigeon_integration_tests.PigeonInternalInstanceManagerApi.removeStrongReference', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (pigeon_clearHandlers) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PigeonInstanceManagerApi.removeStrongReference was null.'); + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PigeonInternalInstanceManagerApi.removeStrongReference was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, - 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PigeonInstanceManagerApi.removeStrongReference was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PigeonInternalInstanceManagerApi.removeStrongReference was null, expected non-null int.'); try { - (instanceManager ?? PigeonInstanceManager.instance) + (instanceManager ?? PigeonInternalInstanceManager.instance) .remove(arg_identifier!); return wrapResponse(empty: true); } on PlatformException catch (e) { @@ -328,50 +333,50 @@ class _PigeonInstanceManagerApi { } Future removeStrongReference(int identifier) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.PigeonInstanceManagerApi.removeStrongReference'; - final BasicMessageChannel __pigeon_channel = + const String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.PigeonInternalInstanceManagerApi.removeStrongReference'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([identifier]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([identifier]) 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; } } - /// Clear the native `PigeonInstanceManager`. + /// Clear the native `PigeonInternalInstanceManager`. /// /// This is typically called after a hot restart. Future clear() async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.pigeon_integration_tests.PigeonInstanceManagerApi.clear'; - final BasicMessageChannel __pigeon_channel = + const String pigeonVar_channelName = + 'dev.flutter.pigeon.pigeon_integration_tests.PigeonInternalInstanceManagerApi.clear'; + 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; @@ -379,12 +384,12 @@ class _PigeonInstanceManagerApi { } } -class _PigeonProxyApiBaseCodec extends _PigeonCodec { - const _PigeonProxyApiBaseCodec(this.instanceManager); - final PigeonInstanceManager instanceManager; +class _PigeonInternalProxyApiBaseCodec extends _PigeonCodec { + const _PigeonInternalProxyApiBaseCodec(this.instanceManager); + final PigeonInternalInstanceManager instanceManager; @override void writeValue(WriteBuffer buffer, Object? value) { - if (value is PigeonProxyApiBaseClass) { + if (value is PigeonInternalProxyApiBaseClass) { buffer.putUint8(128); writeValue(buffer, instanceManager.getIdentifier(value)); } else { @@ -504,23 +509,23 @@ class ProxyApiTestClass extends ProxyApiSuperClass ProxyApiTestEnum? nullableEnumParam, ProxyApiSuperClass? nullableProxyApiParam, }) : super.pigeon_detached() { - final int __pigeon_instanceIdentifier = + final int pigeonVar_instanceIdentifier = pigeon_instanceManager.addDartCreatedInstance(this); - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; () async { - const String __pigeon_channelName = + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.pigeon_defaultConstructor'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([ - __pigeon_instanceIdentifier, + final List? pigeonVar_replyList = + await pigeonVar_channel.send([ + pigeonVar_instanceIdentifier, aBool, anInt, aDouble, @@ -558,13 +563,13 @@ class ProxyApiTestClass extends ProxyApiSuperClass nullableEnumParam, nullableProxyApiParam ]) 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; @@ -575,7 +580,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass /// Constructs [ProxyApiTestClass] without creating the associated native object. /// /// This should only be used by subclasses created by this library or to - /// create copies for an [PigeonInstanceManager]. + /// create copies for an [PigeonInternalInstanceManager]. @protected ProxyApiTestClass.pigeon_detached({ super.pigeon_binaryMessenger, @@ -626,8 +631,9 @@ class ProxyApiTestClass extends ProxyApiSuperClass this.flutterEchoAsyncString, }) : super.pigeon_detached(); - late final _PigeonProxyApiBaseCodec __pigeon_codecProxyApiTestClass = - _PigeonProxyApiBaseCodec(pigeon_instanceManager); + late final _PigeonInternalProxyApiBaseCodec + _pigeonVar_codecProxyApiTestClass = + _PigeonInternalProxyApiBaseCodec(pigeon_instanceManager); final bool aBool; @@ -683,7 +689,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass /// ); /// ``` /// - /// Alternatively, [PigeonInstanceManager.removeWeakReference] can be used to + /// Alternatively, [PigeonInternalInstanceManager.removeWeakReference] can be used to /// release the associated Native object manually. final void Function(ProxyApiTestClass pigeon_instance)? flutterNoop; @@ -704,7 +710,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass /// ); /// ``` /// - /// Alternatively, [PigeonInstanceManager.removeWeakReference] can be used to + /// Alternatively, [PigeonInternalInstanceManager.removeWeakReference] can be used to /// release the associated Native object manually. final Object? Function(ProxyApiTestClass pigeon_instance)? flutterThrowError; @@ -725,7 +731,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass /// ); /// ``` /// - /// Alternatively, [PigeonInstanceManager.removeWeakReference] can be used to + /// Alternatively, [PigeonInternalInstanceManager.removeWeakReference] can be used to /// release the associated Native object manually. final void Function(ProxyApiTestClass pigeon_instance)? flutterThrowErrorFromVoid; @@ -747,7 +753,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass /// ); /// ``` /// - /// Alternatively, [PigeonInstanceManager.removeWeakReference] can be used to + /// Alternatively, [PigeonInternalInstanceManager.removeWeakReference] can be used to /// release the associated Native object manually. final bool Function( ProxyApiTestClass pigeon_instance, @@ -771,7 +777,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass /// ); /// ``` /// - /// Alternatively, [PigeonInstanceManager.removeWeakReference] can be used to + /// Alternatively, [PigeonInternalInstanceManager.removeWeakReference] can be used to /// release the associated Native object manually. final int Function( ProxyApiTestClass pigeon_instance, @@ -795,7 +801,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass /// ); /// ``` /// - /// Alternatively, [PigeonInstanceManager.removeWeakReference] can be used to + /// Alternatively, [PigeonInternalInstanceManager.removeWeakReference] can be used to /// release the associated Native object manually. final double Function( ProxyApiTestClass pigeon_instance, @@ -819,7 +825,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass /// ); /// ``` /// - /// Alternatively, [PigeonInstanceManager.removeWeakReference] can be used to + /// Alternatively, [PigeonInternalInstanceManager.removeWeakReference] can be used to /// release the associated Native object manually. final String Function( ProxyApiTestClass pigeon_instance, @@ -843,7 +849,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass /// ); /// ``` /// - /// Alternatively, [PigeonInstanceManager.removeWeakReference] can be used to + /// Alternatively, [PigeonInternalInstanceManager.removeWeakReference] can be used to /// release the associated Native object manually. final Uint8List Function( ProxyApiTestClass pigeon_instance, @@ -867,7 +873,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass /// ); /// ``` /// - /// Alternatively, [PigeonInstanceManager.removeWeakReference] can be used to + /// Alternatively, [PigeonInternalInstanceManager.removeWeakReference] can be used to /// release the associated Native object manually. final List Function( ProxyApiTestClass pigeon_instance, @@ -892,7 +898,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass /// ); /// ``` /// - /// Alternatively, [PigeonInstanceManager.removeWeakReference] can be used to + /// Alternatively, [PigeonInternalInstanceManager.removeWeakReference] can be used to /// release the associated Native object manually. final List Function( ProxyApiTestClass pigeon_instance, @@ -916,7 +922,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass /// ); /// ``` /// - /// Alternatively, [PigeonInstanceManager.removeWeakReference] can be used to + /// Alternatively, [PigeonInternalInstanceManager.removeWeakReference] can be used to /// release the associated Native object manually. final Map Function( ProxyApiTestClass pigeon_instance, @@ -941,7 +947,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass /// ); /// ``` /// - /// Alternatively, [PigeonInstanceManager.removeWeakReference] can be used to + /// Alternatively, [PigeonInternalInstanceManager.removeWeakReference] can be used to /// release the associated Native object manually. final Map Function( ProxyApiTestClass pigeon_instance, @@ -965,7 +971,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass /// ); /// ``` /// - /// Alternatively, [PigeonInstanceManager.removeWeakReference] can be used to + /// Alternatively, [PigeonInternalInstanceManager.removeWeakReference] can be used to /// release the associated Native object manually. final ProxyApiTestEnum Function( ProxyApiTestClass pigeon_instance, @@ -989,7 +995,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass /// ); /// ``` /// - /// Alternatively, [PigeonInstanceManager.removeWeakReference] can be used to + /// Alternatively, [PigeonInternalInstanceManager.removeWeakReference] can be used to /// release the associated Native object manually. final ProxyApiSuperClass Function( ProxyApiTestClass pigeon_instance, @@ -1013,7 +1019,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass /// ); /// ``` /// - /// Alternatively, [PigeonInstanceManager.removeWeakReference] can be used to + /// Alternatively, [PigeonInternalInstanceManager.removeWeakReference] can be used to /// release the associated Native object manually. final bool? Function( ProxyApiTestClass pigeon_instance, @@ -1037,7 +1043,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass /// ); /// ``` /// - /// Alternatively, [PigeonInstanceManager.removeWeakReference] can be used to + /// Alternatively, [PigeonInternalInstanceManager.removeWeakReference] can be used to /// release the associated Native object manually. final int? Function( ProxyApiTestClass pigeon_instance, @@ -1061,7 +1067,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass /// ); /// ``` /// - /// Alternatively, [PigeonInstanceManager.removeWeakReference] can be used to + /// Alternatively, [PigeonInternalInstanceManager.removeWeakReference] can be used to /// release the associated Native object manually. final double? Function( ProxyApiTestClass pigeon_instance, @@ -1085,7 +1091,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass /// ); /// ``` /// - /// Alternatively, [PigeonInstanceManager.removeWeakReference] can be used to + /// Alternatively, [PigeonInternalInstanceManager.removeWeakReference] can be used to /// release the associated Native object manually. final String? Function( ProxyApiTestClass pigeon_instance, @@ -1109,7 +1115,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass /// ); /// ``` /// - /// Alternatively, [PigeonInstanceManager.removeWeakReference] can be used to + /// Alternatively, [PigeonInternalInstanceManager.removeWeakReference] can be used to /// release the associated Native object manually. final Uint8List? Function( ProxyApiTestClass pigeon_instance, @@ -1133,7 +1139,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass /// ); /// ``` /// - /// Alternatively, [PigeonInstanceManager.removeWeakReference] can be used to + /// Alternatively, [PigeonInternalInstanceManager.removeWeakReference] can be used to /// release the associated Native object manually. final List? Function( ProxyApiTestClass pigeon_instance, @@ -1157,7 +1163,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass /// ); /// ``` /// - /// Alternatively, [PigeonInstanceManager.removeWeakReference] can be used to + /// Alternatively, [PigeonInternalInstanceManager.removeWeakReference] can be used to /// release the associated Native object manually. final Map? Function( ProxyApiTestClass pigeon_instance, @@ -1181,7 +1187,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass /// ); /// ``` /// - /// Alternatively, [PigeonInstanceManager.removeWeakReference] can be used to + /// Alternatively, [PigeonInternalInstanceManager.removeWeakReference] can be used to /// release the associated Native object manually. final ProxyApiTestEnum? Function( ProxyApiTestClass pigeon_instance, @@ -1205,7 +1211,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass /// ); /// ``` /// - /// Alternatively, [PigeonInstanceManager.removeWeakReference] can be used to + /// Alternatively, [PigeonInternalInstanceManager.removeWeakReference] can be used to /// release the associated Native object manually. final ProxyApiSuperClass? Function( ProxyApiTestClass pigeon_instance, @@ -1230,7 +1236,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass /// ); /// ``` /// - /// Alternatively, [PigeonInstanceManager.removeWeakReference] can be used to + /// Alternatively, [PigeonInternalInstanceManager.removeWeakReference] can be used to /// release the associated Native object manually. final Future Function(ProxyApiTestClass pigeon_instance)? flutterNoopAsync; @@ -1252,7 +1258,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass /// ); /// ``` /// - /// Alternatively, [PigeonInstanceManager.removeWeakReference] can be used to + /// Alternatively, [PigeonInternalInstanceManager.removeWeakReference] can be used to /// release the associated Native object manually. final Future Function( ProxyApiTestClass pigeon_instance, @@ -1262,15 +1268,15 @@ class ProxyApiTestClass extends ProxyApiSuperClass @override final void Function(ProxyApiInterface pigeon_instance)? anInterfaceMethod; - late final ProxyApiSuperClass attachedField = __pigeon_attachedField(); + late final ProxyApiSuperClass attachedField = pigeonVar_attachedField(); static final ProxyApiSuperClass staticAttachedField = - __pigeon_staticAttachedField(); + pigeonVar_staticAttachedField(); static void pigeon_setUpMessageHandlers({ bool pigeon_clearHandlers = false, BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, + PigeonInternalInstanceManager? pigeon_instanceManager, ProxyApiTestClass Function( bool aBool, int anInt, @@ -1380,20 +1386,21 @@ class ProxyApiTestClass extends ProxyApiSuperClass String aString, )? flutterEchoAsyncString, }) { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - _PigeonProxyApiBaseCodec( - pigeon_instanceManager ?? PigeonInstanceManager.instance); + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _PigeonInternalProxyApiBaseCodec( + pigeon_instanceManager ?? PigeonInternalInstanceManager.instance); final BinaryMessenger? binaryMessenger = pigeon_binaryMessenger; { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.pigeon_newInstance', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (pigeon_clearHandlers) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.pigeon_newInstance was null.'); final List args = (message as List?)!; @@ -1444,7 +1451,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass final ProxyApiSuperClass? arg_aNullableProxyApi = (args[18] as ProxyApiSuperClass?); try { - (pigeon_instanceManager ?? PigeonInstanceManager.instance) + (pigeon_instanceManager ?? PigeonInternalInstanceManager.instance) .addHostCreatedInstance( pigeon_newInstance?.call( arg_aBool!, @@ -1501,15 +1508,16 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterNoop', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (pigeon_clearHandlers) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterNoop was null.'); final List args = (message as List?)!; @@ -1532,15 +1540,16 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterThrowError', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (pigeon_clearHandlers) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterThrowError was null.'); final List args = (message as List?)!; @@ -1564,15 +1573,16 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterThrowErrorFromVoid', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (pigeon_clearHandlers) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterThrowErrorFromVoid was null.'); final List args = (message as List?)!; @@ -1596,15 +1606,16 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoBool', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (pigeon_clearHandlers) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoBool was null.'); final List args = (message as List?)!; @@ -1631,15 +1642,16 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoInt', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (pigeon_clearHandlers) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoInt was null.'); final List args = (message as List?)!; @@ -1666,15 +1678,16 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoDouble', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (pigeon_clearHandlers) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoDouble was null.'); final List args = (message as List?)!; @@ -1701,15 +1714,16 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoString', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (pigeon_clearHandlers) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoString was null.'); final List args = (message as List?)!; @@ -1736,15 +1750,16 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoUint8List', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (pigeon_clearHandlers) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoUint8List was null.'); final List args = (message as List?)!; @@ -1771,15 +1786,16 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoList', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (pigeon_clearHandlers) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoList was null.'); final List args = (message as List?)!; @@ -1807,15 +1823,16 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoProxyApiList', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (pigeon_clearHandlers) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoProxyApiList was null.'); final List args = (message as List?)!; @@ -1843,15 +1860,16 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoMap', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (pigeon_clearHandlers) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoMap was null.'); final List args = (message as List?)!; @@ -1879,15 +1897,16 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoProxyApiMap', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (pigeon_clearHandlers) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoProxyApiMap was null.'); final List args = (message as List?)!; @@ -1917,15 +1936,16 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoEnum', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (pigeon_clearHandlers) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoEnum was null.'); final List args = (message as List?)!; @@ -1952,15 +1972,16 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoProxyApi', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (pigeon_clearHandlers) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoProxyApi was null.'); final List args = (message as List?)!; @@ -1988,15 +2009,16 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableBool', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (pigeon_clearHandlers) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableBool was null.'); final List args = (message as List?)!; @@ -2021,15 +2043,16 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableInt', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (pigeon_clearHandlers) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableInt was null.'); final List args = (message as List?)!; @@ -2054,15 +2077,16 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableDouble', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (pigeon_clearHandlers) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableDouble was null.'); final List args = (message as List?)!; @@ -2087,15 +2111,16 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableString', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (pigeon_clearHandlers) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableString was null.'); final List args = (message as List?)!; @@ -2120,15 +2145,16 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableUint8List', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (pigeon_clearHandlers) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableUint8List was null.'); final List args = (message as List?)!; @@ -2153,15 +2179,16 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableList', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (pigeon_clearHandlers) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableList was null.'); final List args = (message as List?)!; @@ -2187,15 +2214,16 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableMap', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (pigeon_clearHandlers) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableMap was null.'); final List args = (message as List?)!; @@ -2221,15 +2249,16 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableEnum', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (pigeon_clearHandlers) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableEnum was null.'); final List args = (message as List?)!; @@ -2254,15 +2283,16 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableProxyApi', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (pigeon_clearHandlers) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableProxyApi was null.'); final List args = (message as List?)!; @@ -2288,15 +2318,16 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterNoopAsync', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (pigeon_clearHandlers) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterNoopAsync was null.'); final List args = (message as List?)!; @@ -2319,15 +2350,16 @@ class ProxyApiTestClass extends ProxyApiSuperClass } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoAsyncString', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (pigeon_clearHandlers) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoAsyncString was null.'); final List args = (message as List?)!; @@ -2354,101 +2386,104 @@ class ProxyApiTestClass extends ProxyApiSuperClass } } - ProxyApiSuperClass __pigeon_attachedField() { - final ProxyApiSuperClass __pigeon_instance = + ProxyApiSuperClass pigeonVar_attachedField() { + final ProxyApiSuperClass pigeonVar_instance = ProxyApiSuperClass.pigeon_detached( pigeon_binaryMessenger: pigeon_binaryMessenger, pigeon_instanceManager: pigeon_instanceManager, ); - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - final int __pigeon_instanceIdentifier = - pigeon_instanceManager.addDartCreatedInstance(__pigeon_instance); + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + final int pigeonVar_instanceIdentifier = + pigeon_instanceManager.addDartCreatedInstance(pigeonVar_instance); () async { - const String __pigeon_channelName = + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.attachedField'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel - .send([this, __pigeon_instanceIdentifier]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = await pigeonVar_channel + .send([this, pigeonVar_instanceIdentifier]) + 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; } }(); - return __pigeon_instance; + return pigeonVar_instance; } - static ProxyApiSuperClass __pigeon_staticAttachedField() { - final ProxyApiSuperClass __pigeon_instance = + static ProxyApiSuperClass pigeonVar_staticAttachedField() { + final ProxyApiSuperClass pigeonVar_instance = ProxyApiSuperClass.pigeon_detached(); - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - _PigeonProxyApiBaseCodec(PigeonInstanceManager.instance); - final BinaryMessenger __pigeon_binaryMessenger = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _PigeonInternalProxyApiBaseCodec( + PigeonInternalInstanceManager.instance); + final BinaryMessenger pigeonVar_binaryMessenger = ServicesBinding.instance.defaultBinaryMessenger; - final int __pigeon_instanceIdentifier = PigeonInstanceManager.instance - .addDartCreatedInstance(__pigeon_instance); + final int pigeonVar_instanceIdentifier = PigeonInternalInstanceManager + .instance + .addDartCreatedInstance(pigeonVar_instance); () async { - const String __pigeon_channelName = + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.staticAttachedField'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel - .send([__pigeon_instanceIdentifier]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = await pigeonVar_channel + .send([pigeonVar_instanceIdentifier]) 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; } }(); - return __pigeon_instance; + return pigeonVar_instance; } /// A no-op function taking no arguments and returning no value, to sanity /// test basic calling. Future noop() async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.noop'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this]) 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; @@ -2457,54 +2492,54 @@ class ProxyApiTestClass extends ProxyApiSuperClass /// Returns an error, to test error handling. Future throwError() async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.throwError'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this]) 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]; + return pigeonVar_replyList[0]; } } /// Returns an error from a void function, to test error handling. Future throwErrorFromVoid() async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.throwErrorFromVoid'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this]) 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; @@ -2513,260 +2548,260 @@ class ProxyApiTestClass extends ProxyApiSuperClass /// Returns a Flutter error, to test error handling. Future throwFlutterError() async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.throwFlutterError'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this]) 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]; + return pigeonVar_replyList[0]; } } /// Returns passed in int. Future echoInt(int anInt) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoInt'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, anInt]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this, anInt]) 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 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 int?)!; + return (pigeonVar_replyList[0] as int?)!; } } /// Returns passed in double. Future echoDouble(double aDouble) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoDouble'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, aDouble]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = await pigeonVar_channel + .send([this, aDouble]) 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 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 double?)!; + return (pigeonVar_replyList[0] as double?)!; } } /// Returns the passed in boolean. Future echoBool(bool aBool) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoBool'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, aBool]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this, aBool]) 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 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 bool?)!; + return (pigeonVar_replyList[0] as bool?)!; } } /// Returns the passed in string. Future echoString(String aString) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoString'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, aString]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = await pigeonVar_channel + .send([this, aString]) 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 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 String?)!; + return (pigeonVar_replyList[0] as String?)!; } } /// Returns the passed in Uint8List. Future echoUint8List(Uint8List aUint8List) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoUint8List'; - final BasicMessageChannel __pigeon_channel = + 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([this, aUint8List]) 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 Uint8List?)!; + return (pigeonVar_replyList[0] as Uint8List?)!; } } /// Returns the passed in generic Object. Future echoObject(Object anObject) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoObject'; - final BasicMessageChannel __pigeon_channel = + 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([this, anObject]) 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]!; + return pigeonVar_replyList[0]!; } } /// Returns the passed list, to test serialization and deserialization. Future> echoList(List aList) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoList'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, aList]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this, aList]) 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 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(); } } @@ -2774,68 +2809,68 @@ class ProxyApiTestClass extends ProxyApiSuperClass /// deserialization. Future> echoProxyApiList( List aList) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoProxyApiList'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, aList]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this, aList]) 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 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?)! + return (pigeonVar_replyList[0] as List?)! .cast(); } } /// Returns the passed map, to test serialization and deserialization. Future> echoMap(Map aMap) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoMap'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, aMap]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this, aMap]) 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 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 Map?)! + return (pigeonVar_replyList[0] as Map?)! .cast(); } } @@ -2844,411 +2879,411 @@ class ProxyApiTestClass extends ProxyApiSuperClass /// deserialization. Future> echoProxyApiMap( Map aMap) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoProxyApiMap'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, aMap]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this, aMap]) 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 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 Map?)! + return (pigeonVar_replyList[0] as Map?)! .cast(); } } /// Returns the passed enum to test serialization and deserialization. Future echoEnum(ProxyApiTestEnum anEnum) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoEnum'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, anEnum]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this, anEnum]) 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 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 ProxyApiTestEnum?)!; + return (pigeonVar_replyList[0] as ProxyApiTestEnum?)!; } } /// Returns the passed ProxyApi to test serialization and deserialization. Future echoProxyApi(ProxyApiSuperClass aProxyApi) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoProxyApi'; - final BasicMessageChannel __pigeon_channel = + 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([this, aProxyApi]) 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 ProxyApiSuperClass?)!; + return (pigeonVar_replyList[0] as ProxyApiSuperClass?)!; } } /// Returns passed in int. Future echoNullableInt(int? aNullableInt) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoNullableInt'; - final BasicMessageChannel __pigeon_channel = + 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([this, aNullableInt]) 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 int?); + return (pigeonVar_replyList[0] as int?); } } /// Returns passed in double. Future echoNullableDouble(double? aNullableDouble) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoNullableDouble'; - final BasicMessageChannel __pigeon_channel = + 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([this, aNullableDouble]) 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 double?); + return (pigeonVar_replyList[0] as double?); } } /// Returns the passed in boolean. Future echoNullableBool(bool? aNullableBool) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoNullableBool'; - final BasicMessageChannel __pigeon_channel = + 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([this, aNullableBool]) 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 bool?); + return (pigeonVar_replyList[0] as bool?); } } /// Returns the passed in string. Future echoNullableString(String? aNullableString) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoNullableString'; - final BasicMessageChannel __pigeon_channel = + 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([this, aNullableString]) 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?); } } /// Returns the passed in Uint8List. Future echoNullableUint8List( Uint8List? aNullableUint8List) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoNullableUint8List'; - final BasicMessageChannel __pigeon_channel = + 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([this, aNullableUint8List]) 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 Uint8List?); + return (pigeonVar_replyList[0] as Uint8List?); } } /// Returns the passed in generic Object. Future echoNullableObject(Object? aNullableObject) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoNullableObject'; - final BasicMessageChannel __pigeon_channel = + 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([this, aNullableObject]) 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]; + return pigeonVar_replyList[0]; } } /// Returns the passed list, to test serialization and deserialization. Future?> echoNullableList(List? aNullableList) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoNullableList'; - final BasicMessageChannel __pigeon_channel = + 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([this, aNullableList]) 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 List?)?.cast(); + return (pigeonVar_replyList[0] as List?)?.cast(); } } /// Returns the passed map, to test serialization and deserialization. Future?> echoNullableMap( Map? aNullableMap) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoNullableMap'; - final BasicMessageChannel __pigeon_channel = + 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([this, aNullableMap]) 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 Map?) + return (pigeonVar_replyList[0] as Map?) ?.cast(); } } Future echoNullableEnum( ProxyApiTestEnum? aNullableEnum) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoNullableEnum'; - final BasicMessageChannel __pigeon_channel = + 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([this, aNullableEnum]) 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 ProxyApiTestEnum?); + return (pigeonVar_replyList[0] as ProxyApiTestEnum?); } } /// Returns the passed ProxyApi to test serialization and deserialization. Future echoNullableProxyApi( ProxyApiSuperClass? aNullableProxyApi) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoNullableProxyApi'; - final BasicMessageChannel __pigeon_channel = + 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([this, aNullableProxyApi]) 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 ProxyApiSuperClass?); + return (pigeonVar_replyList[0] as ProxyApiSuperClass?); } } /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. Future noopAsync() async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.noopAsync'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this]) 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; @@ -3257,352 +3292,352 @@ class ProxyApiTestClass extends ProxyApiSuperClass /// Returns passed in int asynchronously. Future echoAsyncInt(int anInt) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncInt'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, anInt]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this, anInt]) 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 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 int?)!; + return (pigeonVar_replyList[0] as int?)!; } } /// Returns passed in double asynchronously. Future echoAsyncDouble(double aDouble) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncDouble'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, aDouble]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = await pigeonVar_channel + .send([this, aDouble]) 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 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 double?)!; + return (pigeonVar_replyList[0] as double?)!; } } /// Returns the passed in boolean asynchronously. Future echoAsyncBool(bool aBool) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncBool'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, aBool]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this, aBool]) 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 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 bool?)!; + return (pigeonVar_replyList[0] as bool?)!; } } /// Returns the passed string asynchronously. Future echoAsyncString(String aString) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncString'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, aString]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = await pigeonVar_channel + .send([this, aString]) 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 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 String?)!; + return (pigeonVar_replyList[0] as String?)!; } } /// Returns the passed in Uint8List asynchronously. Future echoAsyncUint8List(Uint8List aUint8List) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncUint8List'; - final BasicMessageChannel __pigeon_channel = + 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([this, aUint8List]) 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 Uint8List?)!; + return (pigeonVar_replyList[0] as Uint8List?)!; } } /// Returns the passed in generic Object asynchronously. Future echoAsyncObject(Object anObject) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncObject'; - final BasicMessageChannel __pigeon_channel = + 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([this, anObject]) 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]!; + return pigeonVar_replyList[0]!; } } /// Returns the passed list, to test asynchronous serialization and deserialization. Future> echoAsyncList(List aList) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncList'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, aList]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this, aList]) 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 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 the passed map, to test asynchronous serialization and deserialization. Future> echoAsyncMap(Map aMap) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncMap'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, aMap]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this, aMap]) 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 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 Map?)! + return (pigeonVar_replyList[0] as Map?)! .cast(); } } /// Returns the passed enum, to test asynchronous serialization and deserialization. Future echoAsyncEnum(ProxyApiTestEnum anEnum) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncEnum'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, anEnum]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this, anEnum]) 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 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 ProxyApiTestEnum?)!; + return (pigeonVar_replyList[0] as ProxyApiTestEnum?)!; } } /// Responds with an error from an async function returning a value. Future throwAsyncError() async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.throwAsyncError'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this]) 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]; + return pigeonVar_replyList[0]; } } /// Responds with an error from an async void function. Future throwAsyncErrorFromVoid() async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.throwAsyncErrorFromVoid'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this]) 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; @@ -3611,254 +3646,254 @@ class ProxyApiTestClass extends ProxyApiSuperClass /// Responds with a Flutter error from an async function returning a value. Future throwAsyncFlutterError() async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.throwAsyncFlutterError'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this]) 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]; + return pigeonVar_replyList[0]; } } /// Returns passed in int asynchronously. Future echoAsyncNullableInt(int? anInt) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncNullableInt'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, anInt]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this, anInt]) 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 int?); + return (pigeonVar_replyList[0] as int?); } } /// Returns passed in double asynchronously. Future echoAsyncNullableDouble(double? aDouble) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncNullableDouble'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, aDouble]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = await pigeonVar_channel + .send([this, aDouble]) 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 double?); + return (pigeonVar_replyList[0] as double?); } } /// Returns the passed in boolean asynchronously. Future echoAsyncNullableBool(bool? aBool) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncNullableBool'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, aBool]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this, aBool]) 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 bool?); + return (pigeonVar_replyList[0] as bool?); } } /// Returns the passed string asynchronously. Future echoAsyncNullableString(String? aString) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncNullableString'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, aString]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = await pigeonVar_channel + .send([this, aString]) 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 String?); + return (pigeonVar_replyList[0] as String?); } } /// Returns the passed in Uint8List asynchronously. Future echoAsyncNullableUint8List(Uint8List? aUint8List) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncNullableUint8List'; - final BasicMessageChannel __pigeon_channel = + 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([this, aUint8List]) 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 Uint8List?); + return (pigeonVar_replyList[0] as Uint8List?); } } /// Returns the passed in generic Object asynchronously. Future echoAsyncNullableObject(Object? anObject) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncNullableObject'; - final BasicMessageChannel __pigeon_channel = + 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([this, anObject]) 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]; + return pigeonVar_replyList[0]; } } /// Returns the passed list, to test asynchronous serialization and deserialization. Future?> echoAsyncNullableList(List? aList) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncNullableList'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, aList]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this, aList]) 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 List?)?.cast(); + return (pigeonVar_replyList[0] as List?)?.cast(); } } /// Returns the passed map, to test asynchronous serialization and deserialization. Future?> echoAsyncNullableMap( Map? aMap) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncNullableMap'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, aMap]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this, aMap]) 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 Map?) + return (pigeonVar_replyList[0] as Map?) ?.cast(); } } @@ -3866,57 +3901,57 @@ class ProxyApiTestClass extends ProxyApiSuperClass /// Returns the passed enum, to test asynchronous serialization and deserialization. Future echoAsyncNullableEnum( ProxyApiTestEnum? anEnum) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncNullableEnum'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, anEnum]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this, anEnum]) 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 ProxyApiTestEnum?); + return (pigeonVar_replyList[0] as ProxyApiTestEnum?); } } static Future staticNoop({ BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, + PigeonInternalInstanceManager? pigeon_instanceManager, }) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - _PigeonProxyApiBaseCodec( - pigeon_instanceManager ?? PigeonInstanceManager.instance); - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _PigeonInternalProxyApiBaseCodec( + pigeon_instanceManager ?? PigeonInternalInstanceManager.instance); + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.staticNoop'; - final BasicMessageChannel __pigeon_channel = + 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; @@ -3926,65 +3961,65 @@ class ProxyApiTestClass extends ProxyApiSuperClass static Future echoStaticString( String aString, { BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, + PigeonInternalInstanceManager? pigeon_instanceManager, }) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - _PigeonProxyApiBaseCodec( - pigeon_instanceManager ?? PigeonInstanceManager.instance); - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _PigeonInternalProxyApiBaseCodec( + pigeon_instanceManager ?? PigeonInternalInstanceManager.instance); + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoStaticString'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([aString]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([aString]) 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 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 String?)!; + return (pigeonVar_replyList[0] as String?)!; } } static Future staticAsyncNoop({ BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, + PigeonInternalInstanceManager? pigeon_instanceManager, }) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - _PigeonProxyApiBaseCodec( - pigeon_instanceManager ?? PigeonInstanceManager.instance); - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _PigeonInternalProxyApiBaseCodec( + pigeon_instanceManager ?? PigeonInternalInstanceManager.instance); + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.staticAsyncNoop'; - final BasicMessageChannel __pigeon_channel = + 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; @@ -3992,26 +4027,26 @@ class ProxyApiTestClass extends ProxyApiSuperClass } Future callFlutterNoop() async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterNoop'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this]) 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; @@ -4019,53 +4054,53 @@ class ProxyApiTestClass extends ProxyApiSuperClass } Future callFlutterThrowError() async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterThrowError'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this]) 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]; + return pigeonVar_replyList[0]; } } Future callFlutterThrowErrorFromVoid() async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterThrowErrorFromVoid'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this]) 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; @@ -4073,634 +4108,634 @@ class ProxyApiTestClass extends ProxyApiSuperClass } Future callFlutterEchoBool(bool aBool) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoBool'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, aBool]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this, aBool]) 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 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 bool?)!; + return (pigeonVar_replyList[0] as bool?)!; } } Future callFlutterEchoInt(int anInt) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoInt'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, anInt]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this, anInt]) 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 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 int?)!; + return (pigeonVar_replyList[0] as int?)!; } } Future callFlutterEchoDouble(double aDouble) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoDouble'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, aDouble]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = await pigeonVar_channel + .send([this, aDouble]) 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 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 double?)!; + return (pigeonVar_replyList[0] as double?)!; } } Future callFlutterEchoString(String aString) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoString'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, aString]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = await pigeonVar_channel + .send([this, aString]) 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 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 String?)!; + return (pigeonVar_replyList[0] as String?)!; } } Future callFlutterEchoUint8List(Uint8List aUint8List) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoUint8List'; - final BasicMessageChannel __pigeon_channel = + 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([this, aUint8List]) 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 Uint8List?)!; + return (pigeonVar_replyList[0] as Uint8List?)!; } } Future> callFlutterEchoList(List aList) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoList'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, aList]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this, aList]) 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 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> callFlutterEchoProxyApiList( List aList) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoProxyApiList'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, aList]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this, aList]) 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 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?)! + return (pigeonVar_replyList[0] as List?)! .cast(); } } Future> callFlutterEchoMap( Map aMap) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoMap'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, aMap]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this, aMap]) 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 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 Map?)! + return (pigeonVar_replyList[0] as Map?)! .cast(); } } Future> callFlutterEchoProxyApiMap( Map aMap) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoProxyApiMap'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, aMap]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this, aMap]) 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 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 Map?)! + return (pigeonVar_replyList[0] as Map?)! .cast(); } } Future callFlutterEchoEnum(ProxyApiTestEnum anEnum) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoEnum'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, anEnum]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this, anEnum]) 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 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 ProxyApiTestEnum?)!; + return (pigeonVar_replyList[0] as ProxyApiTestEnum?)!; } } Future callFlutterEchoProxyApi( ProxyApiSuperClass aProxyApi) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoProxyApi'; - final BasicMessageChannel __pigeon_channel = + 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([this, aProxyApi]) 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 ProxyApiSuperClass?)!; + return (pigeonVar_replyList[0] as ProxyApiSuperClass?)!; } } Future callFlutterEchoNullableBool(bool? aBool) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoNullableBool'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, aBool]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this, aBool]) 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 bool?); + return (pigeonVar_replyList[0] as bool?); } } Future callFlutterEchoNullableInt(int? anInt) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoNullableInt'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, anInt]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this, anInt]) 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 int?); + return (pigeonVar_replyList[0] as int?); } } Future callFlutterEchoNullableDouble(double? aDouble) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoNullableDouble'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, aDouble]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = await pigeonVar_channel + .send([this, aDouble]) 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 double?); + return (pigeonVar_replyList[0] as double?); } } Future callFlutterEchoNullableString(String? aString) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoNullableString'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, aString]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = await pigeonVar_channel + .send([this, aString]) 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 String?); + return (pigeonVar_replyList[0] as String?); } } Future callFlutterEchoNullableUint8List( Uint8List? aUint8List) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoNullableUint8List'; - final BasicMessageChannel __pigeon_channel = + 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([this, aUint8List]) 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 Uint8List?); + return (pigeonVar_replyList[0] as Uint8List?); } } Future?> callFlutterEchoNullableList( List? aList) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoNullableList'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, aList]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this, aList]) 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 List?)?.cast(); + return (pigeonVar_replyList[0] as List?)?.cast(); } } Future?> callFlutterEchoNullableMap( Map? aMap) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoNullableMap'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, aMap]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this, aMap]) 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 Map?) + return (pigeonVar_replyList[0] as Map?) ?.cast(); } } Future callFlutterEchoNullableEnum( ProxyApiTestEnum? anEnum) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoNullableEnum'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, anEnum]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this, anEnum]) 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 ProxyApiTestEnum?); + return (pigeonVar_replyList[0] as ProxyApiTestEnum?); } } Future callFlutterEchoNullableProxyApi( ProxyApiSuperClass? aProxyApi) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoNullableProxyApi'; - final BasicMessageChannel __pigeon_channel = + 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([this, aProxyApi]) 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 ProxyApiSuperClass?); + return (pigeonVar_replyList[0] as ProxyApiSuperClass?); } } Future callFlutterNoopAsync() async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterNoopAsync'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this]) 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; @@ -4708,34 +4743,34 @@ class ProxyApiTestClass extends ProxyApiSuperClass } Future callFlutterEchoAsyncString(String aString) async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiTestClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiTestClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoAsyncString'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this, aString]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = await pigeonVar_channel + .send([this, aString]) 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 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 String?)!; + return (pigeonVar_replyList[0] as String?)!; } } @@ -4793,34 +4828,34 @@ class ProxyApiTestClass extends ProxyApiSuperClass } /// ProxyApi to serve as a super class to the core ProxyApi class. -class ProxyApiSuperClass extends PigeonProxyApiBaseClass { +class ProxyApiSuperClass extends PigeonInternalProxyApiBaseClass { ProxyApiSuperClass({ super.pigeon_binaryMessenger, super.pigeon_instanceManager, }) { - final int __pigeon_instanceIdentifier = + final int pigeonVar_instanceIdentifier = pigeon_instanceManager.addDartCreatedInstance(this); - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiSuperClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiSuperClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; () async { - const String __pigeon_channelName = + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiSuperClass.pigeon_defaultConstructor'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel - .send([__pigeon_instanceIdentifier]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = await pigeonVar_channel + .send([pigeonVar_instanceIdentifier]) 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; @@ -4831,36 +4866,38 @@ class ProxyApiSuperClass extends PigeonProxyApiBaseClass { /// Constructs [ProxyApiSuperClass] without creating the associated native object. /// /// This should only be used by subclasses created by this library or to - /// create copies for an [PigeonInstanceManager]. + /// create copies for an [PigeonInternalInstanceManager]. @protected ProxyApiSuperClass.pigeon_detached({ super.pigeon_binaryMessenger, super.pigeon_instanceManager, }); - late final _PigeonProxyApiBaseCodec __pigeon_codecProxyApiSuperClass = - _PigeonProxyApiBaseCodec(pigeon_instanceManager); + late final _PigeonInternalProxyApiBaseCodec + _pigeonVar_codecProxyApiSuperClass = + _PigeonInternalProxyApiBaseCodec(pigeon_instanceManager); static void pigeon_setUpMessageHandlers({ bool pigeon_clearHandlers = false, BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, + PigeonInternalInstanceManager? pigeon_instanceManager, ProxyApiSuperClass Function()? pigeon_newInstance, }) { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - _PigeonProxyApiBaseCodec( - pigeon_instanceManager ?? PigeonInstanceManager.instance); + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _PigeonInternalProxyApiBaseCodec( + pigeon_instanceManager ?? PigeonInternalInstanceManager.instance); final BinaryMessenger? binaryMessenger = pigeon_binaryMessenger; { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiSuperClass.pigeon_newInstance', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (pigeon_clearHandlers) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiSuperClass.pigeon_newInstance was null.'); final List args = (message as List?)!; @@ -4868,7 +4905,7 @@ class ProxyApiSuperClass extends PigeonProxyApiBaseClass { assert(arg_pigeon_instanceIdentifier != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiSuperClass.pigeon_newInstance was null, expected non-null int.'); try { - (pigeon_instanceManager ?? PigeonInstanceManager.instance) + (pigeon_instanceManager ?? PigeonInternalInstanceManager.instance) .addHostCreatedInstance( pigeon_newInstance?.call() ?? ProxyApiSuperClass.pigeon_detached( @@ -4890,26 +4927,26 @@ class ProxyApiSuperClass extends PigeonProxyApiBaseClass { } Future aSuperMethod() async { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - __pigeon_codecProxyApiSuperClass; - final BinaryMessenger? __pigeon_binaryMessenger = pigeon_binaryMessenger; - const String __pigeon_channelName = + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecProxyApiSuperClass; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiSuperClass.aSuperMethod'; - final BasicMessageChannel __pigeon_channel = + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([this]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this]) 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; @@ -4926,11 +4963,11 @@ class ProxyApiSuperClass extends PigeonProxyApiBaseClass { } /// ProxyApi to serve as an interface to the core ProxyApi class. -class ProxyApiInterface extends PigeonProxyApiBaseClass { +class ProxyApiInterface extends PigeonInternalProxyApiBaseClass { /// Constructs [ProxyApiInterface] without creating the associated native object. /// /// This should only be used by subclasses created by this library or to - /// create copies for an [PigeonInstanceManager]. + /// create copies for an [PigeonInternalInstanceManager]. @protected ProxyApiInterface.pigeon_detached({ super.pigeon_binaryMessenger, @@ -4955,31 +4992,32 @@ class ProxyApiInterface extends PigeonProxyApiBaseClass { /// ); /// ``` /// - /// Alternatively, [PigeonInstanceManager.removeWeakReference] can be used to + /// Alternatively, [PigeonInternalInstanceManager.removeWeakReference] can be used to /// release the associated Native object manually. final void Function(ProxyApiInterface pigeon_instance)? anInterfaceMethod; static void pigeon_setUpMessageHandlers({ bool pigeon_clearHandlers = false, BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, + PigeonInternalInstanceManager? pigeon_instanceManager, ProxyApiInterface Function()? pigeon_newInstance, void Function(ProxyApiInterface pigeon_instance)? anInterfaceMethod, }) { - final _PigeonProxyApiBaseCodec pigeonChannelCodec = - _PigeonProxyApiBaseCodec( - pigeon_instanceManager ?? PigeonInstanceManager.instance); + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _PigeonInternalProxyApiBaseCodec( + pigeon_instanceManager ?? PigeonInternalInstanceManager.instance); final BinaryMessenger? binaryMessenger = pigeon_binaryMessenger; { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiInterface.pigeon_newInstance', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (pigeon_clearHandlers) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiInterface.pigeon_newInstance was null.'); final List args = (message as List?)!; @@ -4987,7 +5025,7 @@ class ProxyApiInterface extends PigeonProxyApiBaseClass { assert(arg_pigeon_instanceIdentifier != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiInterface.pigeon_newInstance was null, expected non-null int.'); try { - (pigeon_instanceManager ?? PigeonInstanceManager.instance) + (pigeon_instanceManager ?? PigeonInternalInstanceManager.instance) .addHostCreatedInstance( pigeon_newInstance?.call() ?? ProxyApiInterface.pigeon_detached( @@ -5008,15 +5046,16 @@ class ProxyApiInterface extends PigeonProxyApiBaseClass { } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.ProxyApiInterface.anInterfaceMethod', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (pigeon_clearHandlers) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.pigeon_integration_tests.ProxyApiInterface.anInterfaceMethod was null.'); final List args = (message as List?)!; diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/test/instance_manager_test.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/test/instance_manager_test.dart index aadce1b81d7..1b64950e0a9 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/test/instance_manager_test.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/test/instance_manager_test.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// This file specifically tests the test PigeonInstanceManager generated by core_tests. +// This file specifically tests the test PigeonInternalInstanceManager generated by core_tests. import 'package:flutter_test/flutter_test.dart'; import 'package:shared_test_plugin_code/src/generated/proxy_api_tests.gen.dart'; @@ -10,8 +10,8 @@ import 'package:shared_test_plugin_code/src/generated/proxy_api_tests.gen.dart'; void main() { group('InstanceManager', () { test('addHostCreatedInstance', () { - final PigeonInstanceManager instanceManager = - PigeonInstanceManager(onWeakReferenceRemoved: (_) {}); + final PigeonInternalInstanceManager instanceManager = + PigeonInternalInstanceManager(onWeakReferenceRemoved: (_) {}); final CopyableObject object = CopyableObject( pigeon_instanceManager: instanceManager, @@ -27,8 +27,8 @@ void main() { }); test('addHostCreatedInstance prevents already used objects and ids', () { - final PigeonInstanceManager instanceManager = - PigeonInstanceManager(onWeakReferenceRemoved: (_) {}); + final PigeonInternalInstanceManager instanceManager = + PigeonInternalInstanceManager(onWeakReferenceRemoved: (_) {}); final CopyableObject object = CopyableObject( pigeon_instanceManager: instanceManager, @@ -51,8 +51,8 @@ void main() { }); test('addFlutterCreatedInstance', () { - final PigeonInstanceManager instanceManager = - PigeonInstanceManager(onWeakReferenceRemoved: (_) {}); + final PigeonInternalInstanceManager instanceManager = + PigeonInternalInstanceManager(onWeakReferenceRemoved: (_) {}); final CopyableObject object = CopyableObject( pigeon_instanceManager: instanceManager, @@ -70,8 +70,9 @@ void main() { test('removeWeakReference', () { int? weakInstanceId; - final PigeonInstanceManager instanceManager = - PigeonInstanceManager(onWeakReferenceRemoved: (int instanceId) { + final PigeonInternalInstanceManager instanceManager = + PigeonInternalInstanceManager( + onWeakReferenceRemoved: (int instanceId) { weakInstanceId = instanceId; }); @@ -90,8 +91,8 @@ void main() { }); test('removeWeakReference removes only weak reference', () { - final PigeonInstanceManager instanceManager = - PigeonInstanceManager(onWeakReferenceRemoved: (_) {}); + final PigeonInternalInstanceManager instanceManager = + PigeonInternalInstanceManager(onWeakReferenceRemoved: (_) {}); final CopyableObject object = CopyableObject( pigeon_instanceManager: instanceManager, @@ -107,8 +108,8 @@ void main() { }); test('removeStrongReference', () { - final PigeonInstanceManager instanceManager = - PigeonInstanceManager(onWeakReferenceRemoved: (_) {}); + final PigeonInternalInstanceManager instanceManager = + PigeonInternalInstanceManager(onWeakReferenceRemoved: (_) {}); final CopyableObject object = CopyableObject( pigeon_instanceManager: instanceManager, @@ -121,8 +122,8 @@ void main() { }); test('removeStrongReference removes only strong reference', () { - final PigeonInstanceManager instanceManager = - PigeonInstanceManager(onWeakReferenceRemoved: (_) {}); + final PigeonInternalInstanceManager instanceManager = + PigeonInternalInstanceManager(onWeakReferenceRemoved: (_) {}); final CopyableObject object = CopyableObject( pigeon_instanceManager: instanceManager, @@ -137,8 +138,8 @@ void main() { }); test('getInstance can add a new weak reference', () { - final PigeonInstanceManager instanceManager = - PigeonInstanceManager(onWeakReferenceRemoved: (_) {}); + final PigeonInternalInstanceManager instanceManager = + PigeonInternalInstanceManager(onWeakReferenceRemoved: (_) {}); final CopyableObject object = CopyableObject( pigeon_instanceManager: instanceManager, @@ -156,7 +157,7 @@ void main() { }); } -class CopyableObject extends PigeonProxyApiBaseClass { +class CopyableObject extends PigeonInternalProxyApiBaseClass { // ignore: non_constant_identifier_names CopyableObject({super.pigeon_instanceManager}); diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/test/test_message.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/test/test_message.gen.dart index 27add325337..a67e2644e7f 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/test/test_message.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/test/test_message.gen.dart @@ -18,18 +18,18 @@ class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { - if (value is MessageSearchRequest) { + if (value is MessageRequestState) { buffer.putUint8(129); - writeValue(buffer, value.encode()); - } else if (value is MessageSearchReply) { + writeValue(buffer, value.index); + } else if (value is MessageSearchRequest) { buffer.putUint8(130); writeValue(buffer, value.encode()); - } else if (value is MessageNested) { + } else if (value is MessageSearchReply) { buffer.putUint8(131); writeValue(buffer, value.encode()); - } else if (value is MessageRequestState) { + } else if (value is MessageNested) { buffer.putUint8(132); - writeValue(buffer, value.index); + writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -39,14 +39,14 @@ class _PigeonCodec extends StandardMessageCodec { Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { case 129: - return MessageSearchRequest.decode(readValue(buffer)!); + final int? value = readValue(buffer) as int?; + return value == null ? null : MessageRequestState.values[value]; case 130: - return MessageSearchReply.decode(readValue(buffer)!); + return MessageSearchRequest.decode(readValue(buffer)!); case 131: - return MessageNested.decode(readValue(buffer)!); + return MessageSearchReply.decode(readValue(buffer)!); case 132: - final int? value = readValue(buffer) as int?; - return value == null ? null : MessageRequestState.values[value]; + return MessageNested.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); } @@ -77,17 +77,18 @@ abstract class TestHostApi { messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.MessageApi.initialize$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 { api.initialize(); @@ -102,17 +103,18 @@ abstract class TestHostApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.MessageApi.search$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.pigeon_integration_tests.MessageApi.search was null.'); @@ -155,17 +157,18 @@ abstract class TestNestedApi { messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.pigeon_integration_tests.MessageNestedApi.search$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.pigeon_integration_tests.MessageNestedApi.search was null.'); diff --git a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt index f90b5119611..2bf1533b71a 100644 --- a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt +++ b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt @@ -50,6 +50,16 @@ enum class AnEnum(val raw: Int) { } } +enum class AnotherEnum(val raw: Int) { + JUST_IN_CASE(0); + + companion object { + fun ofRaw(raw: Int): AnotherEnum? { + return values().firstOrNull { it.raw == raw } + } + } +} + /** * A class containing all supported types. * @@ -65,6 +75,7 @@ data class AllTypes( val a8ByteArray: LongArray, val aFloatArray: DoubleArray, val anEnum: AnEnum, + val anotherEnum: AnotherEnum, val aString: String, val anObject: Any, val list: List, @@ -75,25 +86,25 @@ data class AllTypes( val map: Map ) { companion object { - @Suppress("LocalVariableName") - fun fromList(__pigeon_list: List): AllTypes { - val aBool = __pigeon_list[0] as Boolean - val anInt = __pigeon_list[1].let { num -> if (num is Int) num.toLong() else num as Long } - val anInt64 = __pigeon_list[2].let { num -> if (num is Int) num.toLong() else num as Long } - val aDouble = __pigeon_list[3] as Double - val aByteArray = __pigeon_list[4] as ByteArray - val a4ByteArray = __pigeon_list[5] as IntArray - val a8ByteArray = __pigeon_list[6] as LongArray - val aFloatArray = __pigeon_list[7] as DoubleArray - val anEnum = __pigeon_list[8] as AnEnum - val aString = __pigeon_list[9] as String - val anObject = __pigeon_list[10] as Any - val list = __pigeon_list[11] as List - val stringList = __pigeon_list[12] as List - val intList = __pigeon_list[13] as List - val doubleList = __pigeon_list[14] as List - val boolList = __pigeon_list[15] as List - val map = __pigeon_list[16] as Map + fun fromList(pigeonVar_list: List): AllTypes { + val aBool = pigeonVar_list[0] as Boolean + val anInt = pigeonVar_list[1].let { num -> if (num is Int) num.toLong() else num as Long } + val anInt64 = pigeonVar_list[2].let { num -> if (num is Int) num.toLong() else num as Long } + val aDouble = pigeonVar_list[3] as Double + val aByteArray = pigeonVar_list[4] as ByteArray + val a4ByteArray = pigeonVar_list[5] as IntArray + val a8ByteArray = pigeonVar_list[6] as LongArray + val aFloatArray = pigeonVar_list[7] as DoubleArray + val anEnum = pigeonVar_list[8] as AnEnum + val anotherEnum = pigeonVar_list[9] as AnotherEnum + val aString = pigeonVar_list[10] as String + val anObject = pigeonVar_list[11] as Any + val list = pigeonVar_list[12] as List + val stringList = pigeonVar_list[13] as List + val intList = pigeonVar_list[14] as List + val doubleList = pigeonVar_list[15] as List + val boolList = pigeonVar_list[16] as List + val map = pigeonVar_list[17] as Map return AllTypes( aBool, anInt, @@ -104,6 +115,7 @@ data class AllTypes( a8ByteArray, aFloatArray, anEnum, + anotherEnum, aString, anObject, list, @@ -126,6 +138,7 @@ data class AllTypes( a8ByteArray, aFloatArray, anEnum, + anotherEnum, aString, anObject, list, @@ -156,6 +169,7 @@ data class AllNullableTypes( val nullableMapWithAnnotations: Map? = null, val nullableMapWithObject: Map? = null, val aNullableEnum: AnEnum? = null, + val anotherNullableEnum: AnotherEnum? = null, val aNullableString: String? = null, val aNullableObject: Any? = null, val allNullableTypes: AllNullableTypes? = null, @@ -168,32 +182,32 @@ data class AllNullableTypes( val map: Map? = null ) { companion object { - @Suppress("LocalVariableName") - fun fromList(__pigeon_list: List): AllNullableTypes { - val aNullableBool = __pigeon_list[0] as Boolean? + fun fromList(pigeonVar_list: List): AllNullableTypes { + val aNullableBool = pigeonVar_list[0] as Boolean? val aNullableInt = - __pigeon_list[1].let { num -> if (num is Int) num.toLong() else num as Long? } + pigeonVar_list[1].let { num -> if (num is Int) num.toLong() else num as Long? } val aNullableInt64 = - __pigeon_list[2].let { num -> if (num is Int) num.toLong() else num as Long? } - val aNullableDouble = __pigeon_list[3] as Double? - val aNullableByteArray = __pigeon_list[4] as ByteArray? - val aNullable4ByteArray = __pigeon_list[5] as IntArray? - val aNullable8ByteArray = __pigeon_list[6] as LongArray? - val aNullableFloatArray = __pigeon_list[7] as DoubleArray? - val nullableNestedList = __pigeon_list[8] as List?>? - val nullableMapWithAnnotations = __pigeon_list[9] as Map? - val nullableMapWithObject = __pigeon_list[10] as Map? - val aNullableEnum = __pigeon_list[11] as AnEnum? - val aNullableString = __pigeon_list[12] as String? - val aNullableObject = __pigeon_list[13] - val allNullableTypes = __pigeon_list[14] as AllNullableTypes? - val list = __pigeon_list[15] as List? - val stringList = __pigeon_list[16] as List? - val intList = __pigeon_list[17] as List? - val doubleList = __pigeon_list[18] as List? - val boolList = __pigeon_list[19] as List? - val nestedClassList = __pigeon_list[20] as List? - val map = __pigeon_list[21] as Map? + pigeonVar_list[2].let { num -> if (num is Int) num.toLong() else num as Long? } + val aNullableDouble = pigeonVar_list[3] as Double? + val aNullableByteArray = pigeonVar_list[4] as ByteArray? + val aNullable4ByteArray = pigeonVar_list[5] as IntArray? + val aNullable8ByteArray = pigeonVar_list[6] as LongArray? + val aNullableFloatArray = pigeonVar_list[7] as DoubleArray? + val nullableNestedList = pigeonVar_list[8] as List?>? + val nullableMapWithAnnotations = pigeonVar_list[9] as Map? + val nullableMapWithObject = pigeonVar_list[10] as Map? + val aNullableEnum = pigeonVar_list[11] as AnEnum? + val anotherNullableEnum = pigeonVar_list[12] as AnotherEnum? + val aNullableString = pigeonVar_list[13] as String? + val aNullableObject = pigeonVar_list[14] + val allNullableTypes = pigeonVar_list[15] as AllNullableTypes? + val list = pigeonVar_list[16] as List? + val stringList = pigeonVar_list[17] as List? + val intList = pigeonVar_list[18] as List? + val doubleList = pigeonVar_list[19] as List? + val boolList = pigeonVar_list[20] as List? + val nestedClassList = pigeonVar_list[21] as List? + val map = pigeonVar_list[22] as Map? return AllNullableTypes( aNullableBool, aNullableInt, @@ -207,6 +221,7 @@ data class AllNullableTypes( nullableMapWithAnnotations, nullableMapWithObject, aNullableEnum, + anotherNullableEnum, aNullableString, aNullableObject, allNullableTypes, @@ -234,6 +249,7 @@ data class AllNullableTypes( nullableMapWithAnnotations, nullableMapWithObject, aNullableEnum, + anotherNullableEnum, aNullableString, aNullableObject, allNullableTypes, @@ -267,6 +283,7 @@ data class AllNullableTypesWithoutRecursion( val nullableMapWithAnnotations: Map? = null, val nullableMapWithObject: Map? = null, val aNullableEnum: AnEnum? = null, + val anotherNullableEnum: AnotherEnum? = null, val aNullableString: String? = null, val aNullableObject: Any? = null, val list: List? = null, @@ -277,30 +294,30 @@ data class AllNullableTypesWithoutRecursion( val map: Map? = null ) { companion object { - @Suppress("LocalVariableName") - fun fromList(__pigeon_list: List): AllNullableTypesWithoutRecursion { - val aNullableBool = __pigeon_list[0] as Boolean? + fun fromList(pigeonVar_list: List): AllNullableTypesWithoutRecursion { + val aNullableBool = pigeonVar_list[0] as Boolean? val aNullableInt = - __pigeon_list[1].let { num -> if (num is Int) num.toLong() else num as Long? } + pigeonVar_list[1].let { num -> if (num is Int) num.toLong() else num as Long? } val aNullableInt64 = - __pigeon_list[2].let { num -> if (num is Int) num.toLong() else num as Long? } - val aNullableDouble = __pigeon_list[3] as Double? - val aNullableByteArray = __pigeon_list[4] as ByteArray? - val aNullable4ByteArray = __pigeon_list[5] as IntArray? - val aNullable8ByteArray = __pigeon_list[6] as LongArray? - val aNullableFloatArray = __pigeon_list[7] as DoubleArray? - val nullableNestedList = __pigeon_list[8] as List?>? - val nullableMapWithAnnotations = __pigeon_list[9] as Map? - val nullableMapWithObject = __pigeon_list[10] as Map? - val aNullableEnum = __pigeon_list[11] as AnEnum? - val aNullableString = __pigeon_list[12] as String? - val aNullableObject = __pigeon_list[13] - val list = __pigeon_list[14] as List? - val stringList = __pigeon_list[15] as List? - val intList = __pigeon_list[16] as List? - val doubleList = __pigeon_list[17] as List? - val boolList = __pigeon_list[18] as List? - val map = __pigeon_list[19] as Map? + pigeonVar_list[2].let { num -> if (num is Int) num.toLong() else num as Long? } + val aNullableDouble = pigeonVar_list[3] as Double? + val aNullableByteArray = pigeonVar_list[4] as ByteArray? + val aNullable4ByteArray = pigeonVar_list[5] as IntArray? + val aNullable8ByteArray = pigeonVar_list[6] as LongArray? + val aNullableFloatArray = pigeonVar_list[7] as DoubleArray? + val nullableNestedList = pigeonVar_list[8] as List?>? + val nullableMapWithAnnotations = pigeonVar_list[9] as Map? + val nullableMapWithObject = pigeonVar_list[10] as Map? + val aNullableEnum = pigeonVar_list[11] as AnEnum? + val anotherNullableEnum = pigeonVar_list[12] as AnotherEnum? + val aNullableString = pigeonVar_list[13] as String? + val aNullableObject = pigeonVar_list[14] + val list = pigeonVar_list[15] as List? + val stringList = pigeonVar_list[16] as List? + val intList = pigeonVar_list[17] as List? + val doubleList = pigeonVar_list[18] as List? + val boolList = pigeonVar_list[19] as List? + val map = pigeonVar_list[20] as Map? return AllNullableTypesWithoutRecursion( aNullableBool, aNullableInt, @@ -314,6 +331,7 @@ data class AllNullableTypesWithoutRecursion( nullableMapWithAnnotations, nullableMapWithObject, aNullableEnum, + anotherNullableEnum, aNullableString, aNullableObject, list, @@ -339,6 +357,7 @@ data class AllNullableTypesWithoutRecursion( nullableMapWithAnnotations, nullableMapWithObject, aNullableEnum, + anotherNullableEnum, aNullableString, aNullableObject, list, @@ -366,11 +385,10 @@ data class AllClassesWrapper( val allTypes: AllTypes? = null ) { companion object { - @Suppress("LocalVariableName") - fun fromList(__pigeon_list: List): AllClassesWrapper { - val allNullableTypes = __pigeon_list[0] as AllNullableTypes - val allNullableTypesWithoutRecursion = __pigeon_list[1] as AllNullableTypesWithoutRecursion? - val allTypes = __pigeon_list[2] as AllTypes? + fun fromList(pigeonVar_list: List): AllClassesWrapper { + val allNullableTypes = pigeonVar_list[0] as AllNullableTypes + val allNullableTypesWithoutRecursion = pigeonVar_list[1] as AllNullableTypesWithoutRecursion? + val allTypes = pigeonVar_list[2] as AllTypes? return AllClassesWrapper(allNullableTypes, allNullableTypesWithoutRecursion, allTypes) } } @@ -390,11 +408,9 @@ data class AllClassesWrapper( * Generated class from Pigeon that represents data sent in messages. */ data class TestMessage(val testList: List? = null) { - companion object { - @Suppress("LocalVariableName") - fun fromList(__pigeon_list: List): TestMessage { - val testList = __pigeon_list[0] as List? + fun fromList(pigeonVar_list: List): TestMessage { + val testList = pigeonVar_list[0] as List? return TestMessage(testList) } } @@ -410,54 +426,61 @@ private object CoreTestsPigeonCodec : StandardMessageCodec() { override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { return when (type) { 129.toByte() -> { - return (readValue(buffer) as? List)?.let { AllTypes.fromList(it) } + return (readValue(buffer) as Int?)?.let { AnEnum.ofRaw(it) } } 130.toByte() -> { - return (readValue(buffer) as? List)?.let { AllNullableTypes.fromList(it) } + return (readValue(buffer) as Int?)?.let { AnotherEnum.ofRaw(it) } } 131.toByte() -> { + return (readValue(buffer) as? List)?.let { AllTypes.fromList(it) } + } + 132.toByte() -> { + return (readValue(buffer) as? List)?.let { AllNullableTypes.fromList(it) } + } + 133.toByte() -> { return (readValue(buffer) as? List)?.let { AllNullableTypesWithoutRecursion.fromList(it) } } - 132.toByte() -> { + 134.toByte() -> { return (readValue(buffer) as? List)?.let { AllClassesWrapper.fromList(it) } } - 133.toByte() -> { + 135.toByte() -> { return (readValue(buffer) as? List)?.let { TestMessage.fromList(it) } } - 134.toByte() -> { - return (readValue(buffer) as Int?)?.let { AnEnum.ofRaw(it) } - } else -> super.readValueOfType(type, buffer) } } override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { when (value) { - is AllTypes -> { + is AnEnum -> { stream.write(129) - writeValue(stream, value.toList()) + writeValue(stream, value.raw) } - is AllNullableTypes -> { + is AnotherEnum -> { stream.write(130) - writeValue(stream, value.toList()) + writeValue(stream, value.raw) } - is AllNullableTypesWithoutRecursion -> { + is AllTypes -> { stream.write(131) writeValue(stream, value.toList()) } - is AllClassesWrapper -> { + is AllNullableTypes -> { stream.write(132) writeValue(stream, value.toList()) } - is TestMessage -> { + is AllNullableTypesWithoutRecursion -> { stream.write(133) writeValue(stream, value.toList()) } - is AnEnum -> { + is AllClassesWrapper -> { stream.write(134) - writeValue(stream, value.raw) + writeValue(stream, value.toList()) + } + is TestMessage -> { + stream.write(135) + writeValue(stream, value.toList()) } else -> super.writeValue(stream, value) } @@ -501,6 +524,8 @@ interface HostIntegrationCoreApi { fun echoClassWrapper(wrapper: AllClassesWrapper): AllClassesWrapper /** Returns the passed enum to test serialization and deserialization. */ fun echoEnum(anEnum: AnEnum): AnEnum + /** Returns the passed enum to test serialization and deserialization. */ + fun echoAnotherEnum(anotherEnum: AnotherEnum): AnotherEnum /** Returns the default string. */ fun echoNamedDefaultString(aString: String): String /** Returns passed in double. */ @@ -551,6 +576,8 @@ interface HostIntegrationCoreApi { fun echoNullableMap(aNullableMap: Map?): Map? fun echoNullableEnum(anEnum: AnEnum?): AnEnum? + + fun echoAnotherNullableEnum(anotherEnum: AnotherEnum?): AnotherEnum? /** Returns passed in int. */ fun echoOptionalNullableInt(aNullableInt: Long?): Long? /** Returns the passed in string. */ @@ -578,6 +605,8 @@ interface HostIntegrationCoreApi { fun echoAsyncMap(aMap: Map, callback: (Result>) -> Unit) /** Returns the passed enum, to test asynchronous serialization and deserialization. */ fun echoAsyncEnum(anEnum: AnEnum, callback: (Result) -> Unit) + /** Returns the passed enum, to test asynchronous serialization and deserialization. */ + fun echoAnotherAsyncEnum(anotherEnum: AnotherEnum, callback: (Result) -> Unit) /** Responds with an error from an async function returning a value. */ fun throwAsyncError(callback: (Result) -> Unit) /** Responds with an error from an async void function. */ @@ -617,6 +646,11 @@ interface HostIntegrationCoreApi { ) /** Returns the passed enum, to test asynchronous serialization and deserialization. */ fun echoAsyncNullableEnum(anEnum: AnEnum?, callback: (Result) -> Unit) + /** Returns the passed enum, to test asynchronous serialization and deserialization. */ + fun echoAnotherAsyncNullableEnum( + anotherEnum: AnotherEnum?, + callback: (Result) -> Unit + ) fun callFlutterNoop(callback: (Result) -> Unit) @@ -666,6 +700,8 @@ interface HostIntegrationCoreApi { fun callFlutterEchoEnum(anEnum: AnEnum, callback: (Result) -> Unit) + fun callFlutterEchoAnotherEnum(anotherEnum: AnotherEnum, callback: (Result) -> Unit) + fun callFlutterEchoNullableBool(aBool: Boolean?, callback: (Result) -> Unit) fun callFlutterEchoNullableInt(anInt: Long?, callback: (Result) -> Unit) @@ -685,6 +721,11 @@ interface HostIntegrationCoreApi { fun callFlutterEchoNullableEnum(anEnum: AnEnum?, callback: (Result) -> Unit) + fun callFlutterEchoAnotherNullableEnum( + anotherEnum: AnotherEnum?, + callback: (Result) -> Unit + ) + fun callFlutterSmallApiEchoString(aString: String, callback: (Result) -> Unit) companion object { @@ -1026,6 +1067,28 @@ interface HostIntegrationCoreApi { channel.setMessageHandler(null) } } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAnotherEnum$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val anotherEnumArg = args[0] as AnotherEnum + val wrapped: List = + try { + listOf(api.echoAnotherEnum(anotherEnumArg)) + } catch (exception: Throwable) { + wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } run { val channel = BasicMessageChannel( @@ -1433,6 +1496,28 @@ interface HostIntegrationCoreApi { channel.setMessageHandler(null) } } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAnotherNullableEnum$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val anotherEnumArg = args[0] as AnotherEnum? + val wrapped: List = + try { + listOf(api.echoAnotherNullableEnum(anotherEnumArg)) + } catch (exception: Throwable) { + wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } run { val channel = BasicMessageChannel( @@ -1715,6 +1800,30 @@ interface HostIntegrationCoreApi { channel.setMessageHandler(null) } } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAnotherAsyncEnum$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val anotherEnumArg = args[0] as AnotherEnum + api.echoAnotherAsyncEnum(anotherEnumArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } run { val channel = BasicMessageChannel( @@ -2070,6 +2179,30 @@ interface HostIntegrationCoreApi { channel.setMessageHandler(null) } } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAnotherAsyncNullableEnum$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val anotherEnumArg = args[0] as AnotherEnum? + api.echoAnotherAsyncNullableEnum(anotherEnumArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } run { val channel = BasicMessageChannel( @@ -2458,6 +2591,30 @@ interface HostIntegrationCoreApi { channel.setMessageHandler(null) } } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAnotherEnum$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val anotherEnumArg = args[0] as AnotherEnum + api.callFlutterEchoAnotherEnum(anotherEnumArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } run { val channel = BasicMessageChannel( @@ -2650,6 +2807,30 @@ interface HostIntegrationCoreApi { channel.setMessageHandler(null) } } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAnotherNullableEnum$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val anotherEnumArg = args[0] as AnotherEnum? + api.callFlutterEchoAnotherNullableEnum(anotherEnumArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } run { val channel = BasicMessageChannel( @@ -3110,6 +3291,33 @@ class FlutterIntegrationCoreApi( } } } + /** Returns the passed enum to test serialization and deserialization. */ + fun echoAnotherEnum(anotherEnumArg: AnotherEnum, callback: (Result) -> Unit) { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAnotherEnum$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(listOf(anotherEnumArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else if (it[0] == null) { + callback( + Result.failure( + FlutterError( + "null-error", + "Flutter api returned null value for non-null return value.", + ""))) + } else { + val output = it[0] as AnotherEnum + callback(Result.success(output)) + } + } else { + callback(Result.failure(createConnectionError(channelName))) + } + } + } /** Returns the passed boolean, to test serialization and deserialization. */ fun echoNullableBool(aBoolArg: Boolean?, callback: (Result) -> Unit) { val separatedMessageChannelSuffix = @@ -3273,6 +3481,29 @@ class FlutterIntegrationCoreApi( } } } + /** Returns the passed enum to test serialization and deserialization. */ + fun echoAnotherNullableEnum( + anotherEnumArg: AnotherEnum?, + callback: (Result) -> Unit + ) { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAnotherNullableEnum$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(listOf(anotherEnumArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + val output = it[0] as AnotherEnum? + callback(Result.success(output)) + } + } else { + callback(Result.failure(createConnectionError(channelName))) + } + } + } /** * A no-op function taking no arguments and returning no value, to sanity test basic asynchronous * calling. diff --git a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/TestPlugin.kt b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/TestPlugin.kt index 43ed1282d12..4c5a1f983b9 100644 --- a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/TestPlugin.kt +++ b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/TestPlugin.kt @@ -96,6 +96,10 @@ class TestPlugin : FlutterPlugin, HostIntegrationCoreApi { return anEnum } + override fun echoAnotherEnum(anotherEnum: AnotherEnum): AnotherEnum { + return anotherEnum + } + override fun echoNamedDefaultString(aString: String): String { return aString } @@ -174,6 +178,10 @@ class TestPlugin : FlutterPlugin, HostIntegrationCoreApi { return anEnum } + override fun echoAnotherNullableEnum(anotherEnum: AnotherEnum?): AnotherEnum? { + return anotherEnum + } + override fun echoOptionalNullableInt(aNullableInt: Long?): Long? { return aNullableInt } @@ -255,6 +263,13 @@ class TestPlugin : FlutterPlugin, HostIntegrationCoreApi { callback(Result.success(anEnum)) } + override fun echoAnotherAsyncEnum( + anotherEnum: AnotherEnum, + callback: (Result) -> Unit + ) { + callback(Result.success(anotherEnum)) + } + override fun echoAsyncNullableInt(anInt: Long?, callback: (Result) -> Unit) { callback(Result.success(anInt)) } @@ -297,6 +312,13 @@ class TestPlugin : FlutterPlugin, HostIntegrationCoreApi { callback(Result.success(anEnum)) } + override fun echoAnotherAsyncNullableEnum( + anotherEnum: AnotherEnum?, + callback: (Result) -> Unit + ) { + callback(Result.success(anotherEnum)) + } + override fun callFlutterNoop(callback: (Result) -> Unit) { flutterApi!!.noop { callback(Result.success(Unit)) } } @@ -375,10 +397,16 @@ class TestPlugin : FlutterPlugin, HostIntegrationCoreApi { } override fun callFlutterEchoEnum(anEnum: AnEnum, callback: (Result) -> Unit) { - // callback(Result.success(anEnum)) flutterApi!!.echoEnum(anEnum) { echo -> callback(echo) } } + override fun callFlutterEchoAnotherEnum( + anotherEnum: AnotherEnum, + callback: (Result) -> Unit + ) { + flutterApi!!.echoAnotherEnum(anotherEnum) { echo -> callback(echo) } + } + override fun callFlutterEchoAllNullableTypes( everything: AllNullableTypes?, callback: (Result) -> Unit @@ -433,6 +461,13 @@ class TestPlugin : FlutterPlugin, HostIntegrationCoreApi { flutterApi!!.echoNullableEnum(anEnum) { echo -> callback(echo) } } + override fun callFlutterEchoAnotherNullableEnum( + anotherEnum: AnotherEnum?, + callback: (Result) -> Unit + ) { + flutterApi!!.echoAnotherNullableEnum(anotherEnum) { echo -> callback(echo) } + } + override fun callFlutterSmallApiEchoString(aString: String, callback: (Result) -> Unit) { flutterSmallApiOne!!.echoString(aString) { echoOne -> flutterSmallApiTwo!!.echoString(aString) { echoTwo -> diff --git a/packages/pigeon/platform_tests/test_plugin/android/src/test/kotlin/com/example/test_plugin/AllDatatypesTest.kt b/packages/pigeon/platform_tests/test_plugin/android/src/test/kotlin/com/example/test_plugin/AllDatatypesTest.kt index 56e0111d63f..5834f34310a 100644 --- a/packages/pigeon/platform_tests/test_plugin/android/src/test/kotlin/com/example/test_plugin/AllDatatypesTest.kt +++ b/packages/pigeon/platform_tests/test_plugin/android/src/test/kotlin/com/example/test_plugin/AllDatatypesTest.kt @@ -32,6 +32,7 @@ internal class AllDatatypesTest { assertTrue(firstTypes.a8ByteArray.contentEquals(secondTypes.a8ByteArray)) assertTrue(firstTypes.aFloatArray.contentEquals(secondTypes.aFloatArray)) assertEquals(firstTypes.anEnum, secondTypes.anEnum) + assertEquals(firstTypes.anotherEnum, secondTypes.anotherEnum) assertEquals(firstTypes.anObject, secondTypes.anObject) assertEquals(firstTypes.list, secondTypes.list) assertEquals(firstTypes.boolList, secondTypes.boolList) @@ -59,6 +60,8 @@ internal class AllDatatypesTest { assertTrue(firstTypes.aNullableFloatArray.contentEquals(secondTypes.aNullableFloatArray)) assertEquals(firstTypes.nullableMapWithObject, secondTypes.nullableMapWithObject) assertEquals(firstTypes.aNullableObject, secondTypes.aNullableObject) + assertEquals(firstTypes.aNullableEnum, secondTypes.aNullableEnum) + assertEquals(firstTypes.anotherNullableEnum, secondTypes.anotherNullableEnum) assertEquals(firstTypes.list, secondTypes.list) assertEquals(firstTypes.boolList, secondTypes.boolList) assertEquals(firstTypes.doubleList, secondTypes.doubleList) @@ -171,6 +174,7 @@ internal class AllDatatypesTest { null, null, null, + null, null) val everything2 = AllNullableTypes.fromList(list2) diff --git a/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift b/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift index 2b95f040b48..00fd797edce 100644 --- a/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift +++ b/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift @@ -82,6 +82,10 @@ enum AnEnum: Int { case fourHundredTwentyTwo = 4 } +enum AnotherEnum: Int { + case justInCase = 0 +} + /// A class containing all supported types. /// /// Generated class from Pigeon that represents data sent in messages. @@ -95,6 +99,7 @@ struct AllTypes { var a8ByteArray: FlutterStandardTypedData var aFloatArray: FlutterStandardTypedData var anEnum: AnEnum + var anotherEnum: AnotherEnum var aString: String var anObject: Any var list: [Any?] @@ -105,26 +110,27 @@ struct AllTypes { var map: [AnyHashable: Any?] // swift-format-ignore: AlwaysUseLowerCamelCase - static func fromList(_ __pigeon_list: [Any?]) -> AllTypes? { - let aBool = __pigeon_list[0] as! Bool + static func fromList(_ pigeonVar_list: [Any?]) -> AllTypes? { + let aBool = pigeonVar_list[0] as! Bool let anInt = - __pigeon_list[1] is Int64 ? __pigeon_list[1] as! Int64 : Int64(__pigeon_list[1] as! Int32) + pigeonVar_list[1] is Int64 ? pigeonVar_list[1] as! Int64 : Int64(pigeonVar_list[1] as! Int32) let anInt64 = - __pigeon_list[2] is Int64 ? __pigeon_list[2] as! Int64 : Int64(__pigeon_list[2] as! Int32) - let aDouble = __pigeon_list[3] as! Double - let aByteArray = __pigeon_list[4] as! FlutterStandardTypedData - let a4ByteArray = __pigeon_list[5] as! FlutterStandardTypedData - let a8ByteArray = __pigeon_list[6] as! FlutterStandardTypedData - let aFloatArray = __pigeon_list[7] as! FlutterStandardTypedData - let anEnum = __pigeon_list[8] as! AnEnum - let aString = __pigeon_list[9] as! String - let anObject = __pigeon_list[10]! - let list = __pigeon_list[11] as! [Any?] - let stringList = __pigeon_list[12] as! [String?] - let intList = __pigeon_list[13] as! [Int64?] - let doubleList = __pigeon_list[14] as! [Double?] - let boolList = __pigeon_list[15] as! [Bool?] - let map = __pigeon_list[16] as! [AnyHashable: Any?] + pigeonVar_list[2] is Int64 ? pigeonVar_list[2] as! Int64 : Int64(pigeonVar_list[2] as! Int32) + let aDouble = pigeonVar_list[3] as! Double + let aByteArray = pigeonVar_list[4] as! FlutterStandardTypedData + let a4ByteArray = pigeonVar_list[5] as! FlutterStandardTypedData + let a8ByteArray = pigeonVar_list[6] as! FlutterStandardTypedData + let aFloatArray = pigeonVar_list[7] as! FlutterStandardTypedData + let anEnum = pigeonVar_list[8] as! AnEnum + let anotherEnum = pigeonVar_list[9] as! AnotherEnum + let aString = pigeonVar_list[10] as! String + let anObject = pigeonVar_list[11]! + let list = pigeonVar_list[12] as! [Any?] + let stringList = pigeonVar_list[13] as! [String?] + let intList = pigeonVar_list[14] as! [Int64?] + let doubleList = pigeonVar_list[15] as! [Double?] + let boolList = pigeonVar_list[16] as! [Bool?] + let map = pigeonVar_list[17] as! [AnyHashable: Any?] return AllTypes( aBool: aBool, @@ -136,6 +142,7 @@ struct AllTypes { a8ByteArray: a8ByteArray, aFloatArray: aFloatArray, anEnum: anEnum, + anotherEnum: anotherEnum, aString: aString, anObject: anObject, list: list, @@ -157,6 +164,7 @@ struct AllTypes { a8ByteArray, aFloatArray, anEnum, + anotherEnum, aString, anObject, list, @@ -186,6 +194,7 @@ class AllNullableTypes { nullableMapWithAnnotations: [String?: String?]? = nil, nullableMapWithObject: [String?: Any?]? = nil, aNullableEnum: AnEnum? = nil, + anotherNullableEnum: AnotherEnum? = nil, aNullableString: String? = nil, aNullableObject: Any? = nil, allNullableTypes: AllNullableTypes? = nil, @@ -209,6 +218,7 @@ class AllNullableTypes { self.nullableMapWithAnnotations = nullableMapWithAnnotations self.nullableMapWithObject = nullableMapWithObject self.aNullableEnum = aNullableEnum + self.anotherNullableEnum = anotherNullableEnum self.aNullableString = aNullableString self.aNullableObject = aNullableObject self.allNullableTypes = allNullableTypes @@ -232,6 +242,7 @@ class AllNullableTypes { var nullableMapWithAnnotations: [String?: String?]? var nullableMapWithObject: [String?: Any?]? var aNullableEnum: AnEnum? + var anotherNullableEnum: AnotherEnum? var aNullableString: String? var aNullableObject: Any? var allNullableTypes: AllNullableTypes? @@ -244,37 +255,38 @@ class AllNullableTypes { var map: [AnyHashable: Any?]? // swift-format-ignore: AlwaysUseLowerCamelCase - static func fromList(_ __pigeon_list: [Any?]) -> AllNullableTypes? { - let aNullableBool: Bool? = nilOrValue(__pigeon_list[0]) + static func fromList(_ pigeonVar_list: [Any?]) -> AllNullableTypes? { + let aNullableBool: Bool? = nilOrValue(pigeonVar_list[0]) let aNullableInt: Int64? = - isNullish(__pigeon_list[1]) + isNullish(pigeonVar_list[1]) ? nil - : (__pigeon_list[1] is Int64? - ? __pigeon_list[1] as! Int64? : Int64(__pigeon_list[1] as! Int32)) + : (pigeonVar_list[1] is Int64? + ? pigeonVar_list[1] as! Int64? : Int64(pigeonVar_list[1] as! Int32)) let aNullableInt64: Int64? = - isNullish(__pigeon_list[2]) + isNullish(pigeonVar_list[2]) ? nil - : (__pigeon_list[2] is Int64? - ? __pigeon_list[2] as! Int64? : Int64(__pigeon_list[2] as! Int32)) - let aNullableDouble: Double? = nilOrValue(__pigeon_list[3]) - let aNullableByteArray: FlutterStandardTypedData? = nilOrValue(__pigeon_list[4]) - let aNullable4ByteArray: FlutterStandardTypedData? = nilOrValue(__pigeon_list[5]) - let aNullable8ByteArray: FlutterStandardTypedData? = nilOrValue(__pigeon_list[6]) - let aNullableFloatArray: FlutterStandardTypedData? = nilOrValue(__pigeon_list[7]) - let nullableNestedList: [[Bool?]?]? = nilOrValue(__pigeon_list[8]) - let nullableMapWithAnnotations: [String?: String?]? = nilOrValue(__pigeon_list[9]) - let nullableMapWithObject: [String?: Any?]? = nilOrValue(__pigeon_list[10]) - let aNullableEnum: AnEnum? = nilOrValue(__pigeon_list[11]) - let aNullableString: String? = nilOrValue(__pigeon_list[12]) - let aNullableObject: Any? = __pigeon_list[13] - let allNullableTypes: AllNullableTypes? = nilOrValue(__pigeon_list[14]) - let list: [Any?]? = nilOrValue(__pigeon_list[15]) - let stringList: [String?]? = nilOrValue(__pigeon_list[16]) - let intList: [Int64?]? = nilOrValue(__pigeon_list[17]) - let doubleList: [Double?]? = nilOrValue(__pigeon_list[18]) - let boolList: [Bool?]? = nilOrValue(__pigeon_list[19]) - let nestedClassList: [AllNullableTypes?]? = nilOrValue(__pigeon_list[20]) - let map: [AnyHashable: Any?]? = nilOrValue(__pigeon_list[21]) + : (pigeonVar_list[2] is Int64? + ? pigeonVar_list[2] as! Int64? : Int64(pigeonVar_list[2] as! Int32)) + let aNullableDouble: Double? = nilOrValue(pigeonVar_list[3]) + let aNullableByteArray: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[4]) + let aNullable4ByteArray: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[5]) + let aNullable8ByteArray: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[6]) + let aNullableFloatArray: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[7]) + let nullableNestedList: [[Bool?]?]? = nilOrValue(pigeonVar_list[8]) + let nullableMapWithAnnotations: [String?: String?]? = nilOrValue(pigeonVar_list[9]) + let nullableMapWithObject: [String?: Any?]? = nilOrValue(pigeonVar_list[10]) + let aNullableEnum: AnEnum? = nilOrValue(pigeonVar_list[11]) + let anotherNullableEnum: AnotherEnum? = nilOrValue(pigeonVar_list[12]) + let aNullableString: String? = nilOrValue(pigeonVar_list[13]) + let aNullableObject: Any? = pigeonVar_list[14] + let allNullableTypes: AllNullableTypes? = nilOrValue(pigeonVar_list[15]) + let list: [Any?]? = nilOrValue(pigeonVar_list[16]) + let stringList: [String?]? = nilOrValue(pigeonVar_list[17]) + let intList: [Int64?]? = nilOrValue(pigeonVar_list[18]) + let doubleList: [Double?]? = nilOrValue(pigeonVar_list[19]) + let boolList: [Bool?]? = nilOrValue(pigeonVar_list[20]) + let nestedClassList: [AllNullableTypes?]? = nilOrValue(pigeonVar_list[21]) + let map: [AnyHashable: Any?]? = nilOrValue(pigeonVar_list[22]) return AllNullableTypes( aNullableBool: aNullableBool, @@ -289,6 +301,7 @@ class AllNullableTypes { nullableMapWithAnnotations: nullableMapWithAnnotations, nullableMapWithObject: nullableMapWithObject, aNullableEnum: aNullableEnum, + anotherNullableEnum: anotherNullableEnum, aNullableString: aNullableString, aNullableObject: aNullableObject, allNullableTypes: allNullableTypes, @@ -315,6 +328,7 @@ class AllNullableTypes { nullableMapWithAnnotations, nullableMapWithObject, aNullableEnum, + anotherNullableEnum, aNullableString, aNullableObject, allNullableTypes, @@ -347,6 +361,7 @@ struct AllNullableTypesWithoutRecursion { var nullableMapWithAnnotations: [String?: String?]? = nil var nullableMapWithObject: [String?: Any?]? = nil var aNullableEnum: AnEnum? = nil + var anotherNullableEnum: AnotherEnum? = nil var aNullableString: String? = nil var aNullableObject: Any? = nil var list: [Any?]? = nil @@ -357,35 +372,36 @@ struct AllNullableTypesWithoutRecursion { var map: [AnyHashable: Any?]? = nil // swift-format-ignore: AlwaysUseLowerCamelCase - static func fromList(_ __pigeon_list: [Any?]) -> AllNullableTypesWithoutRecursion? { - let aNullableBool: Bool? = nilOrValue(__pigeon_list[0]) + static func fromList(_ pigeonVar_list: [Any?]) -> AllNullableTypesWithoutRecursion? { + let aNullableBool: Bool? = nilOrValue(pigeonVar_list[0]) let aNullableInt: Int64? = - isNullish(__pigeon_list[1]) + isNullish(pigeonVar_list[1]) ? nil - : (__pigeon_list[1] is Int64? - ? __pigeon_list[1] as! Int64? : Int64(__pigeon_list[1] as! Int32)) + : (pigeonVar_list[1] is Int64? + ? pigeonVar_list[1] as! Int64? : Int64(pigeonVar_list[1] as! Int32)) let aNullableInt64: Int64? = - isNullish(__pigeon_list[2]) + isNullish(pigeonVar_list[2]) ? nil - : (__pigeon_list[2] is Int64? - ? __pigeon_list[2] as! Int64? : Int64(__pigeon_list[2] as! Int32)) - let aNullableDouble: Double? = nilOrValue(__pigeon_list[3]) - let aNullableByteArray: FlutterStandardTypedData? = nilOrValue(__pigeon_list[4]) - let aNullable4ByteArray: FlutterStandardTypedData? = nilOrValue(__pigeon_list[5]) - let aNullable8ByteArray: FlutterStandardTypedData? = nilOrValue(__pigeon_list[6]) - let aNullableFloatArray: FlutterStandardTypedData? = nilOrValue(__pigeon_list[7]) - let nullableNestedList: [[Bool?]?]? = nilOrValue(__pigeon_list[8]) - let nullableMapWithAnnotations: [String?: String?]? = nilOrValue(__pigeon_list[9]) - let nullableMapWithObject: [String?: Any?]? = nilOrValue(__pigeon_list[10]) - let aNullableEnum: AnEnum? = nilOrValue(__pigeon_list[11]) - let aNullableString: String? = nilOrValue(__pigeon_list[12]) - let aNullableObject: Any? = __pigeon_list[13] - let list: [Any?]? = nilOrValue(__pigeon_list[14]) - let stringList: [String?]? = nilOrValue(__pigeon_list[15]) - let intList: [Int64?]? = nilOrValue(__pigeon_list[16]) - let doubleList: [Double?]? = nilOrValue(__pigeon_list[17]) - let boolList: [Bool?]? = nilOrValue(__pigeon_list[18]) - let map: [AnyHashable: Any?]? = nilOrValue(__pigeon_list[19]) + : (pigeonVar_list[2] is Int64? + ? pigeonVar_list[2] as! Int64? : Int64(pigeonVar_list[2] as! Int32)) + let aNullableDouble: Double? = nilOrValue(pigeonVar_list[3]) + let aNullableByteArray: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[4]) + let aNullable4ByteArray: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[5]) + let aNullable8ByteArray: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[6]) + let aNullableFloatArray: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[7]) + let nullableNestedList: [[Bool?]?]? = nilOrValue(pigeonVar_list[8]) + let nullableMapWithAnnotations: [String?: String?]? = nilOrValue(pigeonVar_list[9]) + let nullableMapWithObject: [String?: Any?]? = nilOrValue(pigeonVar_list[10]) + let aNullableEnum: AnEnum? = nilOrValue(pigeonVar_list[11]) + let anotherNullableEnum: AnotherEnum? = nilOrValue(pigeonVar_list[12]) + let aNullableString: String? = nilOrValue(pigeonVar_list[13]) + let aNullableObject: Any? = pigeonVar_list[14] + let list: [Any?]? = nilOrValue(pigeonVar_list[15]) + let stringList: [String?]? = nilOrValue(pigeonVar_list[16]) + let intList: [Int64?]? = nilOrValue(pigeonVar_list[17]) + let doubleList: [Double?]? = nilOrValue(pigeonVar_list[18]) + let boolList: [Bool?]? = nilOrValue(pigeonVar_list[19]) + let map: [AnyHashable: Any?]? = nilOrValue(pigeonVar_list[20]) return AllNullableTypesWithoutRecursion( aNullableBool: aNullableBool, @@ -400,6 +416,7 @@ struct AllNullableTypesWithoutRecursion { nullableMapWithAnnotations: nullableMapWithAnnotations, nullableMapWithObject: nullableMapWithObject, aNullableEnum: aNullableEnum, + anotherNullableEnum: anotherNullableEnum, aNullableString: aNullableString, aNullableObject: aNullableObject, list: list, @@ -424,6 +441,7 @@ struct AllNullableTypesWithoutRecursion { nullableMapWithAnnotations, nullableMapWithObject, aNullableEnum, + anotherNullableEnum, aNullableString, aNullableObject, list, @@ -449,11 +467,11 @@ struct AllClassesWrapper { var allTypes: AllTypes? = nil // swift-format-ignore: AlwaysUseLowerCamelCase - static func fromList(_ __pigeon_list: [Any?]) -> AllClassesWrapper? { - let allNullableTypes = __pigeon_list[0] as! AllNullableTypes + static func fromList(_ pigeonVar_list: [Any?]) -> AllClassesWrapper? { + let allNullableTypes = pigeonVar_list[0] as! AllNullableTypes let allNullableTypesWithoutRecursion: AllNullableTypesWithoutRecursion? = nilOrValue( - __pigeon_list[1]) - let allTypes: AllTypes? = nilOrValue(__pigeon_list[2]) + pigeonVar_list[1]) + let allTypes: AllTypes? = nilOrValue(pigeonVar_list[2]) return AllClassesWrapper( allNullableTypes: allNullableTypes, @@ -477,8 +495,8 @@ struct TestMessage { var testList: [Any?]? = nil // swift-format-ignore: AlwaysUseLowerCamelCase - static func fromList(_ __pigeon_list: [Any?]) -> TestMessage? { - let testList: [Any?]? = nilOrValue(__pigeon_list[0]) + static func fromList(_ pigeonVar_list: [Any?]) -> TestMessage? { + let testList: [Any?]? = nilOrValue(pigeonVar_list[0]) return TestMessage( testList: testList @@ -490,26 +508,32 @@ struct TestMessage { ] } } + private class CoreTestsPigeonCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { case 129: - return AllTypes.fromList(self.readValue() as! [Any?]) + let enumResultAsInt: Int? = nilOrValue(self.readValue() as? Int) + if let enumResultAsInt = enumResultAsInt { + return AnEnum(rawValue: enumResultAsInt) + } + return nil case 130: - return AllNullableTypes.fromList(self.readValue() as! [Any?]) + let enumResultAsInt: Int? = nilOrValue(self.readValue() as? Int) + if let enumResultAsInt = enumResultAsInt { + return AnotherEnum(rawValue: enumResultAsInt) + } + return nil case 131: - return AllNullableTypesWithoutRecursion.fromList(self.readValue() as! [Any?]) + return AllTypes.fromList(self.readValue() as! [Any?]) case 132: - return AllClassesWrapper.fromList(self.readValue() as! [Any?]) + return AllNullableTypes.fromList(self.readValue() as! [Any?]) case 133: - return TestMessage.fromList(self.readValue() as! [Any?]) + return AllNullableTypesWithoutRecursion.fromList(self.readValue() as! [Any?]) case 134: - var enumResult: AnEnum? = nil - let enumResultAsInt: Int? = nilOrValue(self.readValue() as? Int) - if let enumResultAsInt = enumResultAsInt { - enumResult = AnEnum(rawValue: enumResultAsInt) - } - return enumResult + return AllClassesWrapper.fromList(self.readValue() as! [Any?]) + case 135: + return TestMessage.fromList(self.readValue() as! [Any?]) default: return super.readValue(ofType: type) } @@ -518,24 +542,27 @@ private class CoreTestsPigeonCodecReader: FlutterStandardReader { private class CoreTestsPigeonCodecWriter: FlutterStandardWriter { override func writeValue(_ value: Any) { - if let value = value as? AllTypes { + if let value = value as? AnEnum { super.writeByte(129) + super.writeValue(value.rawValue) + } else if let value = value as? AnotherEnum { + super.writeByte(130) + super.writeValue(value.rawValue) + } else if let value = value as? AllTypes { + super.writeByte(131) super.writeValue(value.toList()) } else if let value = value as? AllNullableTypes { - super.writeByte(130) + super.writeByte(132) super.writeValue(value.toList()) } else if let value = value as? AllNullableTypesWithoutRecursion { - super.writeByte(131) + super.writeByte(133) super.writeValue(value.toList()) } else if let value = value as? AllClassesWrapper { - super.writeByte(132) + super.writeByte(134) super.writeValue(value.toList()) } else if let value = value as? TestMessage { - super.writeByte(133) + super.writeByte(135) super.writeValue(value.toList()) - } else if let value = value as? AnEnum { - super.writeByte(134) - super.writeValue(value.rawValue) } else { super.writeValue(value) } @@ -592,6 +619,8 @@ protocol HostIntegrationCoreApi { func echo(_ wrapper: AllClassesWrapper) throws -> AllClassesWrapper /// Returns the passed enum to test serialization and deserialization. func echo(_ anEnum: AnEnum) throws -> AnEnum + /// Returns the passed enum to test serialization and deserialization. + func echo(_ anotherEnum: AnotherEnum) throws -> AnotherEnum /// Returns the default string. func echoNamedDefault(_ aString: String) throws -> String /// Returns passed in double. @@ -634,6 +663,7 @@ protocol HostIntegrationCoreApi { /// Returns the passed map, to test serialization and deserialization. func echoNullable(_ aNullableMap: [String?: Any?]?) throws -> [String?: Any?]? func echoNullable(_ anEnum: AnEnum?) throws -> AnEnum? + func echoNullable(_ anotherEnum: AnotherEnum?) throws -> AnotherEnum? /// Returns passed in int. func echoOptional(_ aNullableInt: Int64?) throws -> Int64? /// Returns the passed in string. @@ -662,6 +692,9 @@ protocol HostIntegrationCoreApi { _ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) /// Returns the passed enum, to test asynchronous serialization and deserialization. func echoAsync(_ anEnum: AnEnum, completion: @escaping (Result) -> Void) + /// Returns the passed enum, to test asynchronous serialization and deserialization. + func echoAsync( + _ anotherEnum: AnotherEnum, completion: @escaping (Result) -> Void) /// Responds with an error from an async function returning a value. func throwAsyncError(completion: @escaping (Result) -> Void) /// Responds with an error from an async void function. @@ -699,6 +732,9 @@ protocol HostIntegrationCoreApi { _ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) /// Returns the passed enum, to test asynchronous serialization and deserialization. func echoAsyncNullable(_ anEnum: AnEnum?, completion: @escaping (Result) -> Void) + /// Returns the passed enum, to test asynchronous serialization and deserialization. + func echoAsyncNullable( + _ anotherEnum: AnotherEnum?, completion: @escaping (Result) -> Void) func callFlutterNoop(completion: @escaping (Result) -> Void) func callFlutterThrowError(completion: @escaping (Result) -> Void) func callFlutterThrowErrorFromVoid(completion: @escaping (Result) -> Void) @@ -727,6 +763,8 @@ protocol HostIntegrationCoreApi { func callFlutterEcho( _ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) func callFlutterEcho(_ anEnum: AnEnum, completion: @escaping (Result) -> Void) + func callFlutterEcho( + _ anotherEnum: AnotherEnum, completion: @escaping (Result) -> Void) func callFlutterEchoNullable(_ aBool: Bool?, completion: @escaping (Result) -> Void) func callFlutterEchoNullable( _ anInt: Int64?, completion: @escaping (Result) -> Void) @@ -741,8 +779,10 @@ protocol HostIntegrationCoreApi { _ list: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void) func callFlutterEchoNullable( _ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) - func callFlutterNullableEcho( + func callFlutterEchoNullable( _ anEnum: AnEnum?, completion: @escaping (Result) -> Void) + func callFlutterEchoNullable( + _ anotherEnum: AnotherEnum?, completion: @escaping (Result) -> Void) func callFlutterSmallApiEcho( _ aString: String, completion: @escaping (Result) -> Void) } @@ -1034,6 +1074,25 @@ class HostIntegrationCoreApiSetup { } else { echoEnumChannel.setMessageHandler(nil) } + /// Returns the passed enum to test serialization and deserialization. + let echoAnotherEnumChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAnotherEnum\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + echoAnotherEnumChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let anotherEnumArg = args[0] as! AnotherEnum + do { + let result = try api.echo(anotherEnumArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } + } + } else { + echoAnotherEnumChannel.setMessageHandler(nil) + } /// Returns the default string. let echoNamedDefaultStringChannel = FlutterBasicMessageChannel( name: @@ -1389,6 +1448,24 @@ class HostIntegrationCoreApiSetup { } else { echoNullableEnumChannel.setMessageHandler(nil) } + let echoAnotherNullableEnumChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAnotherNullableEnum\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + echoAnotherNullableEnumChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let anotherEnumArg: AnotherEnum? = nilOrValue(args[0]) + do { + let result = try api.echoNullable(anotherEnumArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } + } + } else { + echoAnotherNullableEnumChannel.setMessageHandler(nil) + } /// Returns passed in int. let echoOptionalNullableIntChannel = FlutterBasicMessageChannel( name: @@ -1638,6 +1715,27 @@ class HostIntegrationCoreApiSetup { } else { echoAsyncEnumChannel.setMessageHandler(nil) } + /// Returns the passed enum, to test asynchronous serialization and deserialization. + let echoAnotherAsyncEnumChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAnotherAsyncEnum\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + echoAnotherAsyncEnumChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let anotherEnumArg = args[0] as! AnotherEnum + api.echoAsync(anotherEnumArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + echoAnotherAsyncEnumChannel.setMessageHandler(nil) + } /// Responds with an error from an async function returning a value. let throwAsyncErrorChannel = FlutterBasicMessageChannel( name: @@ -1949,6 +2047,27 @@ class HostIntegrationCoreApiSetup { } else { echoAsyncNullableEnumChannel.setMessageHandler(nil) } + /// Returns the passed enum, to test asynchronous serialization and deserialization. + let echoAnotherAsyncNullableEnumChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAnotherAsyncNullableEnum\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + echoAnotherAsyncNullableEnumChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let anotherEnumArg: AnotherEnum? = nilOrValue(args[0]) + api.echoAsyncNullable(anotherEnumArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + echoAnotherAsyncNullableEnumChannel.setMessageHandler(nil) + } let callFlutterNoopChannel = FlutterBasicMessageChannel( name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterNoop\(channelSuffix)", @@ -2276,6 +2395,26 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoEnumChannel.setMessageHandler(nil) } + let callFlutterEchoAnotherEnumChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAnotherEnum\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + callFlutterEchoAnotherEnumChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let anotherEnumArg = args[0] as! AnotherEnum + api.callFlutterEcho(anotherEnumArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + callFlutterEchoAnotherEnumChannel.setMessageHandler(nil) + } let callFlutterEchoNullableBoolChannel = FlutterBasicMessageChannel( name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableBool\(channelSuffix)", @@ -2426,7 +2565,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoNullableEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anEnumArg: AnEnum? = nilOrValue(args[0]) - api.callFlutterNullableEcho(anEnumArg) { result in + api.callFlutterEchoNullable(anEnumArg) { result in switch result { case .success(let res): reply(wrapResult(res)) @@ -2438,6 +2577,26 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoNullableEnumChannel.setMessageHandler(nil) } + let callFlutterEchoAnotherNullableEnumChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAnotherNullableEnum\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + callFlutterEchoAnotherNullableEnumChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let anotherEnumArg: AnotherEnum? = nilOrValue(args[0]) + api.callFlutterEchoNullable(anotherEnumArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + callFlutterEchoAnotherNullableEnumChannel.setMessageHandler(nil) + } let callFlutterSmallApiEchoStringChannel = FlutterBasicMessageChannel( name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterSmallApiEchoString\(channelSuffix)", @@ -2517,6 +2676,9 @@ protocol FlutterIntegrationCoreApiProtocol { ) /// Returns the passed enum to test serialization and deserialization. func echo(_ anEnumArg: AnEnum, completion: @escaping (Result) -> Void) + /// Returns the passed enum to test serialization and deserialization. + func echo( + _ anotherEnumArg: AnotherEnum, completion: @escaping (Result) -> Void) /// Returns the passed boolean, to test serialization and deserialization. func echoNullable(_ aBoolArg: Bool?, completion: @escaping (Result) -> Void) /// Returns the passed int, to test serialization and deserialization. @@ -2541,6 +2703,10 @@ protocol FlutterIntegrationCoreApiProtocol { /// Returns the passed enum to test serialization and deserialization. func echoNullable( _ anEnumArg: AnEnum?, completion: @escaping (Result) -> Void) + /// Returns the passed enum to test serialization and deserialization. + func echoNullable( + _ anotherEnumArg: AnotherEnum?, + completion: @escaping (Result) -> Void) /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. func noopAsync(completion: @escaping (Result) -> Void) @@ -3002,6 +3168,36 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } } + /// Returns the passed enum to test serialization and deserialization. + func echo( + _ anotherEnumArg: AnotherEnum, completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAnotherEnum\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([anotherEnumArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + PigeonError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) + } else { + let result = listResponse[0] as! AnotherEnum + completion(.success(result)) + } + } + } /// Returns the passed boolean, to test serialization and deserialization. func echoNullable(_ aBoolArg: Bool?, completion: @escaping (Result) -> Void) { let channelName: String = @@ -3197,6 +3393,31 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } } + /// Returns the passed enum to test serialization and deserialization. + func echoNullable( + _ anotherEnumArg: AnotherEnum?, + completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAnotherNullableEnum\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([anotherEnumArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + let result: AnotherEnum? = nilOrValue(listResponse[0]) + completion(.success(result)) + } + } + } /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. func noopAsync(completion: @escaping (Result) -> Void) { diff --git a/packages/pigeon/platform_tests/test_plugin/ios/Classes/TestPlugin.swift b/packages/pigeon/platform_tests/test_plugin/ios/Classes/TestPlugin.swift index 36e6a445b53..be07319c7c0 100644 --- a/packages/pigeon/platform_tests/test_plugin/ios/Classes/TestPlugin.swift +++ b/packages/pigeon/platform_tests/test_plugin/ios/Classes/TestPlugin.swift @@ -99,6 +99,10 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { return anEnum } + func echo(_ anotherEnum: AnotherEnum) throws -> AnotherEnum { + return anotherEnum + } + func extractNestedNullableString(from wrapper: AllClassesWrapper) -> String? { return wrapper.allNullableTypes.aNullableString } @@ -171,6 +175,10 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { return anEnum } + func echoNullable(_ anotherEnum: AnotherEnum?) throws -> AnotherEnum? { + return anotherEnum + } + func echoOptional(_ aNullableInt: Int64?) throws -> Int64? { return aNullableInt } @@ -254,6 +262,12 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { completion(.success(anEnum)) } + func echoAsync( + _ anotherEnum: AnotherEnum, completion: @escaping (Result) -> Void + ) { + completion(.success(anotherEnum)) + } + func echoAsyncNullable(_ anInt: Int64?, completion: @escaping (Result) -> Void) { completion(.success(anInt)) } @@ -293,11 +307,18 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { completion(.success(aMap)) } - func echoAsyncNullable(_ anEnum: AnEnum?, completion: @escaping (Result) -> Void) - { + func echoAsyncNullable( + _ anEnum: AnEnum?, completion: @escaping (Result) -> Void + ) { completion(.success(anEnum)) } + func echoAsyncNullable( + _ anotherEnum: AnotherEnum?, completion: @escaping (Result) -> Void + ) { + completion(.success(anotherEnum)) + } + func callFlutterNoop(completion: @escaping (Result) -> Void) { flutterAPI.noop { response in switch response { @@ -492,7 +513,9 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { } } - func callFlutterEcho(_ anEnum: AnEnum, completion: @escaping (Result) -> Void) { + func callFlutterEcho( + _ anEnum: AnEnum, completion: @escaping (Result) -> Void + ) { flutterAPI.echo(anEnum) { response in switch response { case .success(let res): @@ -503,6 +526,19 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { } } + func callFlutterEcho( + _ anotherEnum: AnotherEnum, completion: @escaping (Result) -> Void + ) { + flutterAPI.echo(anotherEnum) { response in + switch response { + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) + } + } + } + func callFlutterEchoNullable(_ aBool: Bool?, completion: @escaping (Result) -> Void) { flutterAPI.echoNullable(aBool) { response in @@ -594,7 +630,7 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { } } - func callFlutterNullableEcho( + func callFlutterEchoNullable( _ anEnum: AnEnum?, completion: @escaping (Result) -> Void ) { flutterAPI.echoNullable(anEnum) { response in @@ -607,6 +643,19 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { } } + func callFlutterEchoNullable( + _ anotherEnum: AnotherEnum?, completion: @escaping (Result) -> Void + ) { + flutterAPI.echoNullable(anotherEnum) { response in + switch response { + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) + } + } + } + func callFlutterSmallApiEcho( _ aString: String, completion: @escaping (Result) -> Void ) { diff --git a/packages/pigeon/platform_tests/test_plugin/linux/pigeon/core_tests.gen.cc b/packages/pigeon/platform_tests/test_plugin/linux/pigeon/core_tests.gen.cc index fddf46a03a8..4b2a24280c6 100644 --- a/packages/pigeon/platform_tests/test_plugin/linux/pigeon/core_tests.gen.cc +++ b/packages/pigeon/platform_tests/test_plugin/linux/pigeon/core_tests.gen.cc @@ -23,6 +23,7 @@ struct _CoreTestsPigeonTestAllTypes { double* a_float_array; size_t a_float_array_length; CoreTestsPigeonTestAnEnum an_enum; + CoreTestsPigeonTestAnotherEnum another_enum; gchar* a_string; FlValue* an_object; FlValue* list; @@ -64,7 +65,8 @@ CoreTestsPigeonTestAllTypes* core_tests_pigeon_test_all_types_new( const int32_t* a4_byte_array, size_t a4_byte_array_length, const int64_t* a8_byte_array, size_t a8_byte_array_length, const double* a_float_array, size_t a_float_array_length, - CoreTestsPigeonTestAnEnum an_enum, const gchar* a_string, + CoreTestsPigeonTestAnEnum an_enum, + CoreTestsPigeonTestAnotherEnum another_enum, const gchar* a_string, FlValue* an_object, FlValue* list, FlValue* string_list, FlValue* int_list, FlValue* double_list, FlValue* bool_list, FlValue* map) { CoreTestsPigeonTestAllTypes* self = CORE_TESTS_PIGEON_TEST_ALL_TYPES( @@ -89,6 +91,7 @@ CoreTestsPigeonTestAllTypes* core_tests_pigeon_test_all_types_new( sizeof(double) * a_float_array_length)); self->a_float_array_length = a_float_array_length; self->an_enum = an_enum; + self->another_enum = another_enum; self->a_string = g_strdup(a_string); self->an_object = fl_value_ref(an_object); self->list = fl_value_ref(list); @@ -159,6 +162,14 @@ CoreTestsPigeonTestAnEnum core_tests_pigeon_test_all_types_get_an_enum( return self->an_enum; } +CoreTestsPigeonTestAnotherEnum +core_tests_pigeon_test_all_types_get_another_enum( + CoreTestsPigeonTestAllTypes* self) { + g_return_val_if_fail(CORE_TESTS_PIGEON_TEST_IS_ALL_TYPES(self), + static_cast(0)); + return self->another_enum; +} + const gchar* core_tests_pigeon_test_all_types_get_a_string( CoreTestsPigeonTestAllTypes* self) { g_return_val_if_fail(CORE_TESTS_PIGEON_TEST_IS_ALL_TYPES(self), nullptr); @@ -227,8 +238,11 @@ static FlValue* core_tests_pigeon_test_all_types_to_list( values, fl_value_new_float_list(self->a_float_array, self->a_float_array_length)); fl_value_append_take(values, - fl_value_new_custom(134, fl_value_new_int(self->an_enum), + fl_value_new_custom(129, fl_value_new_int(self->an_enum), (GDestroyNotify)fl_value_unref)); + fl_value_append_take( + values, fl_value_new_custom(130, fl_value_new_int(self->another_enum), + (GDestroyNotify)fl_value_unref)); fl_value_append_take(values, fl_value_new_string(self->a_string)); fl_value_append_take(values, fl_value_ref(self->an_object)); fl_value_append_take(values, fl_value_ref(self->list)); @@ -267,26 +281,31 @@ core_tests_pigeon_test_all_types_new_from_list(FlValue* values) { fl_value_get_int(reinterpret_cast( const_cast(fl_value_get_custom_value(value8))))); FlValue* value9 = fl_value_get_list_value(values, 9); - const gchar* a_string = fl_value_get_string(value9); + CoreTestsPigeonTestAnotherEnum another_enum = + static_cast( + fl_value_get_int(reinterpret_cast( + const_cast(fl_value_get_custom_value(value9))))); FlValue* value10 = fl_value_get_list_value(values, 10); - FlValue* an_object = value10; + const gchar* a_string = fl_value_get_string(value10); FlValue* value11 = fl_value_get_list_value(values, 11); - FlValue* list = value11; + FlValue* an_object = value11; FlValue* value12 = fl_value_get_list_value(values, 12); - FlValue* string_list = value12; + FlValue* list = value12; FlValue* value13 = fl_value_get_list_value(values, 13); - FlValue* int_list = value13; + FlValue* string_list = value13; FlValue* value14 = fl_value_get_list_value(values, 14); - FlValue* double_list = value14; + FlValue* int_list = value14; FlValue* value15 = fl_value_get_list_value(values, 15); - FlValue* bool_list = value15; + FlValue* double_list = value15; FlValue* value16 = fl_value_get_list_value(values, 16); - FlValue* map = value16; + FlValue* bool_list = value16; + FlValue* value17 = fl_value_get_list_value(values, 17); + FlValue* map = value17; return core_tests_pigeon_test_all_types_new( a_bool, an_int, an_int64, a_double, a_byte_array, a_byte_array_length, a4_byte_array, a4_byte_array_length, a8_byte_array, a8_byte_array_length, - a_float_array, a_float_array_length, an_enum, a_string, an_object, list, - string_list, int_list, double_list, bool_list, map); + a_float_array, a_float_array_length, an_enum, another_enum, a_string, + an_object, list, string_list, int_list, double_list, bool_list, map); } struct _CoreTestsPigeonTestAllNullableTypes { @@ -308,6 +327,7 @@ struct _CoreTestsPigeonTestAllNullableTypes { FlValue* nullable_map_with_annotations; FlValue* nullable_map_with_object; CoreTestsPigeonTestAnEnum* a_nullable_enum; + CoreTestsPigeonTestAnotherEnum* another_nullable_enum; gchar* a_nullable_string; FlValue* a_nullable_object; CoreTestsPigeonTestAllNullableTypes* all_nullable_types; @@ -334,6 +354,7 @@ static void core_tests_pigeon_test_all_nullable_types_dispose(GObject* object) { g_clear_pointer(&self->nullable_map_with_annotations, fl_value_unref); g_clear_pointer(&self->nullable_map_with_object, fl_value_unref); g_clear_pointer(&self->a_nullable_enum, g_free); + g_clear_pointer(&self->another_nullable_enum, g_free); g_clear_pointer(&self->a_nullable_string, g_free); g_clear_pointer(&self->a_nullable_object, fl_value_unref); g_clear_object(&self->all_nullable_types); @@ -367,8 +388,9 @@ core_tests_pigeon_test_all_nullable_types_new( const double* a_nullable_float_array, size_t a_nullable_float_array_length, FlValue* nullable_nested_list, FlValue* nullable_map_with_annotations, FlValue* nullable_map_with_object, - CoreTestsPigeonTestAnEnum* a_nullable_enum, const gchar* a_nullable_string, - FlValue* a_nullable_object, + CoreTestsPigeonTestAnEnum* a_nullable_enum, + CoreTestsPigeonTestAnotherEnum* another_nullable_enum, + const gchar* a_nullable_string, FlValue* a_nullable_object, CoreTestsPigeonTestAllNullableTypes* all_nullable_types, FlValue* list, FlValue* string_list, FlValue* int_list, FlValue* double_list, FlValue* bool_list, FlValue* nested_class_list, FlValue* map) { @@ -461,6 +483,13 @@ core_tests_pigeon_test_all_nullable_types_new( } else { self->a_nullable_enum = nullptr; } + if (another_nullable_enum != nullptr) { + self->another_nullable_enum = static_cast( + malloc(sizeof(CoreTestsPigeonTestAnotherEnum))); + *self->another_nullable_enum = *another_nullable_enum; + } else { + self->another_nullable_enum = nullptr; + } if (a_nullable_string != nullptr) { self->a_nullable_string = g_strdup(a_nullable_string); } else { @@ -609,6 +638,14 @@ core_tests_pigeon_test_all_nullable_types_get_a_nullable_enum( return self->a_nullable_enum; } +CoreTestsPigeonTestAnotherEnum* +core_tests_pigeon_test_all_nullable_types_get_another_nullable_enum( + CoreTestsPigeonTestAllNullableTypes* self) { + g_return_val_if_fail(CORE_TESTS_PIGEON_TEST_IS_ALL_NULLABLE_TYPES(self), + nullptr); + return self->another_nullable_enum; +} + const gchar* core_tests_pigeon_test_all_nullable_types_get_a_nullable_string( CoreTestsPigeonTestAllNullableTypes* self) { g_return_val_if_fail(CORE_TESTS_PIGEON_TEST_IS_ALL_NULLABLE_TYPES(self), @@ -730,9 +767,15 @@ static FlValue* core_tests_pigeon_test_all_nullable_types_to_list( fl_value_append_take( values, self->a_nullable_enum != nullptr - ? fl_value_new_custom(134, fl_value_new_int(*self->a_nullable_enum), + ? fl_value_new_custom(129, fl_value_new_int(*self->a_nullable_enum), (GDestroyNotify)fl_value_unref) : fl_value_new_null()); + fl_value_append_take( + values, self->another_nullable_enum != nullptr + ? fl_value_new_custom( + 130, fl_value_new_int(*self->another_nullable_enum), + (GDestroyNotify)fl_value_unref) + : fl_value_new_null()); fl_value_append_take(values, self->a_nullable_string != nullptr ? fl_value_new_string(self->a_nullable_string) @@ -743,7 +786,7 @@ static FlValue* core_tests_pigeon_test_all_nullable_types_to_list( fl_value_append_take( values, self->all_nullable_types != nullptr - ? fl_value_new_custom_object(130, G_OBJECT(self->all_nullable_types)) + ? fl_value_new_custom_object(132, G_OBJECT(self->all_nullable_types)) : fl_value_new_null()); fl_value_append_take(values, self->list != nullptr ? fl_value_ref(self->list) : fl_value_new_null()); @@ -850,55 +893,64 @@ core_tests_pigeon_test_all_nullable_types_new_from_list(FlValue* values) { a_nullable_enum = &a_nullable_enum_value; } FlValue* value12 = fl_value_get_list_value(values, 12); - const gchar* a_nullable_string = nullptr; + CoreTestsPigeonTestAnotherEnum* another_nullable_enum = nullptr; + CoreTestsPigeonTestAnotherEnum another_nullable_enum_value; if (fl_value_get_type(value12) != FL_VALUE_TYPE_NULL) { - a_nullable_string = fl_value_get_string(value12); + another_nullable_enum_value = static_cast( + fl_value_get_int(reinterpret_cast( + const_cast(fl_value_get_custom_value(value12))))); + another_nullable_enum = &another_nullable_enum_value; } FlValue* value13 = fl_value_get_list_value(values, 13); - FlValue* a_nullable_object = nullptr; + const gchar* a_nullable_string = nullptr; if (fl_value_get_type(value13) != FL_VALUE_TYPE_NULL) { - a_nullable_object = value13; + a_nullable_string = fl_value_get_string(value13); } FlValue* value14 = fl_value_get_list_value(values, 14); - CoreTestsPigeonTestAllNullableTypes* all_nullable_types = nullptr; + FlValue* a_nullable_object = nullptr; if (fl_value_get_type(value14) != FL_VALUE_TYPE_NULL) { - all_nullable_types = CORE_TESTS_PIGEON_TEST_ALL_NULLABLE_TYPES( - fl_value_get_custom_value_object(value14)); + a_nullable_object = value14; } FlValue* value15 = fl_value_get_list_value(values, 15); - FlValue* list = nullptr; + CoreTestsPigeonTestAllNullableTypes* all_nullable_types = nullptr; if (fl_value_get_type(value15) != FL_VALUE_TYPE_NULL) { - list = value15; + all_nullable_types = CORE_TESTS_PIGEON_TEST_ALL_NULLABLE_TYPES( + fl_value_get_custom_value_object(value15)); } FlValue* value16 = fl_value_get_list_value(values, 16); - FlValue* string_list = nullptr; + FlValue* list = nullptr; if (fl_value_get_type(value16) != FL_VALUE_TYPE_NULL) { - string_list = value16; + list = value16; } FlValue* value17 = fl_value_get_list_value(values, 17); - FlValue* int_list = nullptr; + FlValue* string_list = nullptr; if (fl_value_get_type(value17) != FL_VALUE_TYPE_NULL) { - int_list = value17; + string_list = value17; } FlValue* value18 = fl_value_get_list_value(values, 18); - FlValue* double_list = nullptr; + FlValue* int_list = nullptr; if (fl_value_get_type(value18) != FL_VALUE_TYPE_NULL) { - double_list = value18; + int_list = value18; } FlValue* value19 = fl_value_get_list_value(values, 19); - FlValue* bool_list = nullptr; + FlValue* double_list = nullptr; if (fl_value_get_type(value19) != FL_VALUE_TYPE_NULL) { - bool_list = value19; + double_list = value19; } FlValue* value20 = fl_value_get_list_value(values, 20); - FlValue* nested_class_list = nullptr; + FlValue* bool_list = nullptr; if (fl_value_get_type(value20) != FL_VALUE_TYPE_NULL) { - nested_class_list = value20; + bool_list = value20; } FlValue* value21 = fl_value_get_list_value(values, 21); - FlValue* map = nullptr; + FlValue* nested_class_list = nullptr; if (fl_value_get_type(value21) != FL_VALUE_TYPE_NULL) { - map = value21; + nested_class_list = value21; + } + FlValue* value22 = fl_value_get_list_value(values, 22); + FlValue* map = nullptr; + if (fl_value_get_type(value22) != FL_VALUE_TYPE_NULL) { + map = value22; } return core_tests_pigeon_test_all_nullable_types_new( a_nullable_bool, a_nullable_int, a_nullable_int64, a_nullable_double, @@ -907,9 +959,9 @@ core_tests_pigeon_test_all_nullable_types_new_from_list(FlValue* values) { a_nullable8_byte_array, a_nullable8_byte_array_length, a_nullable_float_array, a_nullable_float_array_length, nullable_nested_list, nullable_map_with_annotations, - nullable_map_with_object, a_nullable_enum, a_nullable_string, - a_nullable_object, all_nullable_types, list, string_list, int_list, - double_list, bool_list, nested_class_list, map); + nullable_map_with_object, a_nullable_enum, another_nullable_enum, + a_nullable_string, a_nullable_object, all_nullable_types, list, + string_list, int_list, double_list, bool_list, nested_class_list, map); } struct _CoreTestsPigeonTestAllNullableTypesWithoutRecursion { @@ -931,6 +983,7 @@ struct _CoreTestsPigeonTestAllNullableTypesWithoutRecursion { FlValue* nullable_map_with_annotations; FlValue* nullable_map_with_object; CoreTestsPigeonTestAnEnum* a_nullable_enum; + CoreTestsPigeonTestAnotherEnum* another_nullable_enum; gchar* a_nullable_string; FlValue* a_nullable_object; FlValue* list; @@ -957,6 +1010,7 @@ static void core_tests_pigeon_test_all_nullable_types_without_recursion_dispose( g_clear_pointer(&self->nullable_map_with_annotations, fl_value_unref); g_clear_pointer(&self->nullable_map_with_object, fl_value_unref); g_clear_pointer(&self->a_nullable_enum, g_free); + g_clear_pointer(&self->another_nullable_enum, g_free); g_clear_pointer(&self->a_nullable_string, g_free); g_clear_pointer(&self->a_nullable_object, fl_value_unref); g_clear_pointer(&self->list, fl_value_unref); @@ -990,9 +1044,11 @@ core_tests_pigeon_test_all_nullable_types_without_recursion_new( const double* a_nullable_float_array, size_t a_nullable_float_array_length, FlValue* nullable_nested_list, FlValue* nullable_map_with_annotations, FlValue* nullable_map_with_object, - CoreTestsPigeonTestAnEnum* a_nullable_enum, const gchar* a_nullable_string, - FlValue* a_nullable_object, FlValue* list, FlValue* string_list, - FlValue* int_list, FlValue* double_list, FlValue* bool_list, FlValue* map) { + CoreTestsPigeonTestAnEnum* a_nullable_enum, + CoreTestsPigeonTestAnotherEnum* another_nullable_enum, + const gchar* a_nullable_string, FlValue* a_nullable_object, FlValue* list, + FlValue* string_list, FlValue* int_list, FlValue* double_list, + FlValue* bool_list, FlValue* map) { CoreTestsPigeonTestAllNullableTypesWithoutRecursion* self = CORE_TESTS_PIGEON_TEST_ALL_NULLABLE_TYPES_WITHOUT_RECURSION(g_object_new( core_tests_pigeon_test_all_nullable_types_without_recursion_get_type(), @@ -1083,6 +1139,13 @@ core_tests_pigeon_test_all_nullable_types_without_recursion_new( } else { self->a_nullable_enum = nullptr; } + if (another_nullable_enum != nullptr) { + self->another_nullable_enum = static_cast( + malloc(sizeof(CoreTestsPigeonTestAnotherEnum))); + *self->another_nullable_enum = *another_nullable_enum; + } else { + self->another_nullable_enum = nullptr; + } if (a_nullable_string != nullptr) { self->a_nullable_string = g_strdup(a_nullable_string); } else { @@ -1238,6 +1301,15 @@ core_tests_pigeon_test_all_nullable_types_without_recursion_get_a_nullable_enum( return self->a_nullable_enum; } +CoreTestsPigeonTestAnotherEnum* +core_tests_pigeon_test_all_nullable_types_without_recursion_get_another_nullable_enum( + CoreTestsPigeonTestAllNullableTypesWithoutRecursion* self) { + g_return_val_if_fail( + CORE_TESTS_PIGEON_TEST_IS_ALL_NULLABLE_TYPES_WITHOUT_RECURSION(self), + nullptr); + return self->another_nullable_enum; +} + const gchar* core_tests_pigeon_test_all_nullable_types_without_recursion_get_a_nullable_string( CoreTestsPigeonTestAllNullableTypesWithoutRecursion* self) { @@ -1359,9 +1431,15 @@ core_tests_pigeon_test_all_nullable_types_without_recursion_to_list( fl_value_append_take( values, self->a_nullable_enum != nullptr - ? fl_value_new_custom(134, fl_value_new_int(*self->a_nullable_enum), + ? fl_value_new_custom(129, fl_value_new_int(*self->a_nullable_enum), (GDestroyNotify)fl_value_unref) : fl_value_new_null()); + fl_value_append_take( + values, self->another_nullable_enum != nullptr + ? fl_value_new_custom( + 130, fl_value_new_int(*self->another_nullable_enum), + (GDestroyNotify)fl_value_unref) + : fl_value_new_null()); fl_value_append_take(values, self->a_nullable_string != nullptr ? fl_value_new_string(self->a_nullable_string) @@ -1472,44 +1550,53 @@ core_tests_pigeon_test_all_nullable_types_without_recursion_new_from_list( a_nullable_enum = &a_nullable_enum_value; } FlValue* value12 = fl_value_get_list_value(values, 12); - const gchar* a_nullable_string = nullptr; + CoreTestsPigeonTestAnotherEnum* another_nullable_enum = nullptr; + CoreTestsPigeonTestAnotherEnum another_nullable_enum_value; if (fl_value_get_type(value12) != FL_VALUE_TYPE_NULL) { - a_nullable_string = fl_value_get_string(value12); + another_nullable_enum_value = static_cast( + fl_value_get_int(reinterpret_cast( + const_cast(fl_value_get_custom_value(value12))))); + another_nullable_enum = &another_nullable_enum_value; } FlValue* value13 = fl_value_get_list_value(values, 13); - FlValue* a_nullable_object = nullptr; + const gchar* a_nullable_string = nullptr; if (fl_value_get_type(value13) != FL_VALUE_TYPE_NULL) { - a_nullable_object = value13; + a_nullable_string = fl_value_get_string(value13); } FlValue* value14 = fl_value_get_list_value(values, 14); - FlValue* list = nullptr; + FlValue* a_nullable_object = nullptr; if (fl_value_get_type(value14) != FL_VALUE_TYPE_NULL) { - list = value14; + a_nullable_object = value14; } FlValue* value15 = fl_value_get_list_value(values, 15); - FlValue* string_list = nullptr; + FlValue* list = nullptr; if (fl_value_get_type(value15) != FL_VALUE_TYPE_NULL) { - string_list = value15; + list = value15; } FlValue* value16 = fl_value_get_list_value(values, 16); - FlValue* int_list = nullptr; + FlValue* string_list = nullptr; if (fl_value_get_type(value16) != FL_VALUE_TYPE_NULL) { - int_list = value16; + string_list = value16; } FlValue* value17 = fl_value_get_list_value(values, 17); - FlValue* double_list = nullptr; + FlValue* int_list = nullptr; if (fl_value_get_type(value17) != FL_VALUE_TYPE_NULL) { - double_list = value17; + int_list = value17; } FlValue* value18 = fl_value_get_list_value(values, 18); - FlValue* bool_list = nullptr; + FlValue* double_list = nullptr; if (fl_value_get_type(value18) != FL_VALUE_TYPE_NULL) { - bool_list = value18; + double_list = value18; } FlValue* value19 = fl_value_get_list_value(values, 19); - FlValue* map = nullptr; + FlValue* bool_list = nullptr; if (fl_value_get_type(value19) != FL_VALUE_TYPE_NULL) { - map = value19; + bool_list = value19; + } + FlValue* value20 = fl_value_get_list_value(values, 20); + FlValue* map = nullptr; + if (fl_value_get_type(value20) != FL_VALUE_TYPE_NULL) { + map = value20; } return core_tests_pigeon_test_all_nullable_types_without_recursion_new( a_nullable_bool, a_nullable_int, a_nullable_int64, a_nullable_double, @@ -1518,9 +1605,9 @@ core_tests_pigeon_test_all_nullable_types_without_recursion_new_from_list( a_nullable8_byte_array, a_nullable8_byte_array_length, a_nullable_float_array, a_nullable_float_array_length, nullable_nested_list, nullable_map_with_annotations, - nullable_map_with_object, a_nullable_enum, a_nullable_string, - a_nullable_object, list, string_list, int_list, double_list, bool_list, - map); + nullable_map_with_object, a_nullable_enum, another_nullable_enum, + a_nullable_string, a_nullable_object, list, string_list, int_list, + double_list, bool_list, map); } struct _CoreTestsPigeonTestAllClassesWrapper { @@ -1609,16 +1696,16 @@ static FlValue* core_tests_pigeon_test_all_classes_wrapper_to_list( CoreTestsPigeonTestAllClassesWrapper* self) { FlValue* values = fl_value_new_list(); fl_value_append_take(values, fl_value_new_custom_object( - 130, G_OBJECT(self->all_nullable_types))); + 132, G_OBJECT(self->all_nullable_types))); fl_value_append_take( values, self->all_nullable_types_without_recursion != nullptr ? fl_value_new_custom_object( - 131, G_OBJECT(self->all_nullable_types_without_recursion)) + 133, G_OBJECT(self->all_nullable_types_without_recursion)) : fl_value_new_null()); fl_value_append_take( values, self->all_types != nullptr - ? fl_value_new_custom_object(129, G_OBJECT(self->all_types)) + ? fl_value_new_custom_object(131, G_OBJECT(self->all_types)) : fl_value_new_null()); return values; } @@ -1722,11 +1809,29 @@ G_DEFINE_TYPE(CoreTestsPigeonTestMessageCodec, core_tests_pigeon_test_message_codec, fl_standard_message_codec_get_type()) +static gboolean +core_tests_pigeon_test_message_codec_write_core_tests_pigeon_test_an_enum( + FlStandardMessageCodec* codec, GByteArray* buffer, FlValue* value, + GError** error) { + uint8_t type = 129; + g_byte_array_append(buffer, &type, sizeof(uint8_t)); + return fl_standard_message_codec_write_value(codec, buffer, value, error); +} + +static gboolean +core_tests_pigeon_test_message_codec_write_core_tests_pigeon_test_another_enum( + FlStandardMessageCodec* codec, GByteArray* buffer, FlValue* value, + GError** error) { + uint8_t type = 130; + g_byte_array_append(buffer, &type, sizeof(uint8_t)); + return fl_standard_message_codec_write_value(codec, buffer, value, error); +} + static gboolean core_tests_pigeon_test_message_codec_write_core_tests_pigeon_test_all_types( FlStandardMessageCodec* codec, GByteArray* buffer, CoreTestsPigeonTestAllTypes* value, GError** error) { - uint8_t type = 129; + uint8_t type = 131; g_byte_array_append(buffer, &type, sizeof(uint8_t)); g_autoptr(FlValue) values = core_tests_pigeon_test_all_types_to_list(value); return fl_standard_message_codec_write_value(codec, buffer, values, error); @@ -1736,7 +1841,7 @@ static gboolean core_tests_pigeon_test_message_codec_write_core_tests_pigeon_test_all_nullable_types( FlStandardMessageCodec* codec, GByteArray* buffer, CoreTestsPigeonTestAllNullableTypes* value, GError** error) { - uint8_t type = 130; + uint8_t type = 132; g_byte_array_append(buffer, &type, sizeof(uint8_t)); g_autoptr(FlValue) values = core_tests_pigeon_test_all_nullable_types_to_list(value); @@ -1748,7 +1853,7 @@ core_tests_pigeon_test_message_codec_write_core_tests_pigeon_test_all_nullable_t FlStandardMessageCodec* codec, GByteArray* buffer, CoreTestsPigeonTestAllNullableTypesWithoutRecursion* value, GError** error) { - uint8_t type = 131; + uint8_t type = 133; g_byte_array_append(buffer, &type, sizeof(uint8_t)); g_autoptr(FlValue) values = core_tests_pigeon_test_all_nullable_types_without_recursion_to_list( @@ -1760,7 +1865,7 @@ static gboolean core_tests_pigeon_test_message_codec_write_core_tests_pigeon_test_all_classes_wrapper( FlStandardMessageCodec* codec, GByteArray* buffer, CoreTestsPigeonTestAllClassesWrapper* value, GError** error) { - uint8_t type = 132; + uint8_t type = 134; g_byte_array_append(buffer, &type, sizeof(uint8_t)); g_autoptr(FlValue) values = core_tests_pigeon_test_all_classes_wrapper_to_list(value); @@ -1771,63 +1876,60 @@ static gboolean core_tests_pigeon_test_message_codec_write_core_tests_pigeon_test_test_message( FlStandardMessageCodec* codec, GByteArray* buffer, CoreTestsPigeonTestTestMessage* value, GError** error) { - uint8_t type = 133; + uint8_t type = 135; g_byte_array_append(buffer, &type, sizeof(uint8_t)); g_autoptr(FlValue) values = core_tests_pigeon_test_test_message_to_list(value); return fl_standard_message_codec_write_value(codec, buffer, values, error); } -static gboolean -core_tests_pigeon_test_message_codec_write_core_tests_pigeon_test_an_enum( - FlStandardMessageCodec* codec, GByteArray* buffer, FlValue* value, - GError** error) { - uint8_t type = 134; - g_byte_array_append(buffer, &type, sizeof(uint8_t)); - return fl_standard_message_codec_write_value(codec, buffer, value, error); -} - static gboolean core_tests_pigeon_test_message_codec_write_value( FlStandardMessageCodec* codec, GByteArray* buffer, FlValue* value, GError** error) { if (fl_value_get_type(value) == FL_VALUE_TYPE_CUSTOM) { switch (fl_value_get_custom_type(value)) { case 129: + return core_tests_pigeon_test_message_codec_write_core_tests_pigeon_test_an_enum( + codec, buffer, + reinterpret_cast( + const_cast(fl_value_get_custom_value(value))), + error); + case 130: + return core_tests_pigeon_test_message_codec_write_core_tests_pigeon_test_another_enum( + codec, buffer, + reinterpret_cast( + const_cast(fl_value_get_custom_value(value))), + error); + case 131: return core_tests_pigeon_test_message_codec_write_core_tests_pigeon_test_all_types( codec, buffer, CORE_TESTS_PIGEON_TEST_ALL_TYPES( fl_value_get_custom_value_object(value)), error); - case 130: + case 132: return core_tests_pigeon_test_message_codec_write_core_tests_pigeon_test_all_nullable_types( codec, buffer, CORE_TESTS_PIGEON_TEST_ALL_NULLABLE_TYPES( fl_value_get_custom_value_object(value)), error); - case 131: + case 133: return core_tests_pigeon_test_message_codec_write_core_tests_pigeon_test_all_nullable_types_without_recursion( codec, buffer, CORE_TESTS_PIGEON_TEST_ALL_NULLABLE_TYPES_WITHOUT_RECURSION( fl_value_get_custom_value_object(value)), error); - case 132: + case 134: return core_tests_pigeon_test_message_codec_write_core_tests_pigeon_test_all_classes_wrapper( codec, buffer, CORE_TESTS_PIGEON_TEST_ALL_CLASSES_WRAPPER( fl_value_get_custom_value_object(value)), error); - case 133: + case 135: return core_tests_pigeon_test_message_codec_write_core_tests_pigeon_test_test_message( codec, buffer, CORE_TESTS_PIGEON_TEST_TEST_MESSAGE( fl_value_get_custom_value_object(value)), error); - case 134: - return core_tests_pigeon_test_message_codec_write_core_tests_pigeon_test_an_enum( - codec, buffer, - reinterpret_cast( - const_cast(fl_value_get_custom_value(value))), - error); } } @@ -1836,6 +1938,24 @@ static gboolean core_tests_pigeon_test_message_codec_write_value( ->write_value(codec, buffer, value, error); } +static FlValue* +core_tests_pigeon_test_message_codec_read_core_tests_pigeon_test_an_enum( + FlStandardMessageCodec* codec, GBytes* buffer, size_t* offset, + GError** error) { + return fl_value_new_custom( + 129, fl_standard_message_codec_read_value(codec, buffer, offset, error), + (GDestroyNotify)fl_value_unref); +} + +static FlValue* +core_tests_pigeon_test_message_codec_read_core_tests_pigeon_test_another_enum( + FlStandardMessageCodec* codec, GBytes* buffer, size_t* offset, + GError** error) { + return fl_value_new_custom( + 130, fl_standard_message_codec_read_value(codec, buffer, offset, error), + (GDestroyNotify)fl_value_unref); +} + static FlValue* core_tests_pigeon_test_message_codec_read_core_tests_pigeon_test_all_types( FlStandardMessageCodec* codec, GBytes* buffer, size_t* offset, @@ -1854,7 +1974,7 @@ core_tests_pigeon_test_message_codec_read_core_tests_pigeon_test_all_types( return nullptr; } - return fl_value_new_custom_object(129, G_OBJECT(value)); + return fl_value_new_custom_object(131, G_OBJECT(value)); } static FlValue* @@ -1875,7 +1995,7 @@ core_tests_pigeon_test_message_codec_read_core_tests_pigeon_test_all_nullable_ty return nullptr; } - return fl_value_new_custom_object(130, G_OBJECT(value)); + return fl_value_new_custom_object(132, G_OBJECT(value)); } static FlValue* @@ -1897,7 +2017,7 @@ core_tests_pigeon_test_message_codec_read_core_tests_pigeon_test_all_nullable_ty return nullptr; } - return fl_value_new_custom_object(131, G_OBJECT(value)); + return fl_value_new_custom_object(133, G_OBJECT(value)); } static FlValue* @@ -1918,7 +2038,7 @@ core_tests_pigeon_test_message_codec_read_core_tests_pigeon_test_all_classes_wra return nullptr; } - return fl_value_new_custom_object(132, G_OBJECT(value)); + return fl_value_new_custom_object(134, G_OBJECT(value)); } static FlValue* @@ -1939,16 +2059,7 @@ core_tests_pigeon_test_message_codec_read_core_tests_pigeon_test_test_message( return nullptr; } - return fl_value_new_custom_object(133, G_OBJECT(value)); -} - -static FlValue* -core_tests_pigeon_test_message_codec_read_core_tests_pigeon_test_an_enum( - FlStandardMessageCodec* codec, GBytes* buffer, size_t* offset, - GError** error) { - return fl_value_new_custom( - 134, fl_standard_message_codec_read_value(codec, buffer, offset, error), - (GDestroyNotify)fl_value_unref); + return fl_value_new_custom_object(135, G_OBJECT(value)); } static FlValue* core_tests_pigeon_test_message_codec_read_value_of_type( @@ -1956,22 +2067,25 @@ static FlValue* core_tests_pigeon_test_message_codec_read_value_of_type( GError** error) { switch (type) { case 129: - return core_tests_pigeon_test_message_codec_read_core_tests_pigeon_test_all_types( + return core_tests_pigeon_test_message_codec_read_core_tests_pigeon_test_an_enum( codec, buffer, offset, error); case 130: - return core_tests_pigeon_test_message_codec_read_core_tests_pigeon_test_all_nullable_types( + return core_tests_pigeon_test_message_codec_read_core_tests_pigeon_test_another_enum( codec, buffer, offset, error); case 131: - return core_tests_pigeon_test_message_codec_read_core_tests_pigeon_test_all_nullable_types_without_recursion( + return core_tests_pigeon_test_message_codec_read_core_tests_pigeon_test_all_types( codec, buffer, offset, error); case 132: - return core_tests_pigeon_test_message_codec_read_core_tests_pigeon_test_all_classes_wrapper( + return core_tests_pigeon_test_message_codec_read_core_tests_pigeon_test_all_nullable_types( codec, buffer, offset, error); case 133: - return core_tests_pigeon_test_message_codec_read_core_tests_pigeon_test_test_message( + return core_tests_pigeon_test_message_codec_read_core_tests_pigeon_test_all_nullable_types_without_recursion( codec, buffer, offset, error); case 134: - return core_tests_pigeon_test_message_codec_read_core_tests_pigeon_test_an_enum( + return core_tests_pigeon_test_message_codec_read_core_tests_pigeon_test_all_classes_wrapper( + codec, buffer, offset, error); + case 135: + return core_tests_pigeon_test_message_codec_read_core_tests_pigeon_test_test_message( codec, buffer, offset, error); default: return FL_STANDARD_MESSAGE_CODEC_CLASS( @@ -2148,7 +2262,7 @@ core_tests_pigeon_test_host_integration_core_api_echo_all_types_response_new( nullptr)); self->value = fl_value_new_list(); fl_value_append_take(self->value, - fl_value_new_custom_object(129, G_OBJECT(return_value))); + fl_value_new_custom_object(131, G_OBJECT(return_value))); return self; } @@ -2918,7 +3032,7 @@ core_tests_pigeon_test_host_integration_core_api_echo_class_wrapper_response_new nullptr)); self->value = fl_value_new_list(); fl_value_append_take(self->value, - fl_value_new_custom_object(132, G_OBJECT(return_value))); + fl_value_new_custom_object(134, G_OBJECT(return_value))); return self; } @@ -2982,7 +3096,7 @@ core_tests_pigeon_test_host_integration_core_api_echo_enum_response_new( nullptr)); self->value = fl_value_new_list(); fl_value_append_take(self->value, - fl_value_new_custom(134, fl_value_new_int(return_value), + fl_value_new_custom(129, fl_value_new_int(return_value), (GDestroyNotify)fl_value_unref)); return self; } @@ -3003,6 +3117,73 @@ core_tests_pigeon_test_host_integration_core_api_echo_enum_response_new_error( return self; } +struct _CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherEnumResponse { + GObject parent_instance; + + FlValue* value; +}; + +G_DEFINE_TYPE( + CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherEnumResponse, + core_tests_pigeon_test_host_integration_core_api_echo_another_enum_response, + G_TYPE_OBJECT) + +static void +core_tests_pigeon_test_host_integration_core_api_echo_another_enum_response_dispose( + GObject* object) { + CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherEnumResponse* self = + CORE_TESTS_PIGEON_TEST_HOST_INTEGRATION_CORE_API_ECHO_ANOTHER_ENUM_RESPONSE( + object); + g_clear_pointer(&self->value, fl_value_unref); + G_OBJECT_CLASS( + core_tests_pigeon_test_host_integration_core_api_echo_another_enum_response_parent_class) + ->dispose(object); +} + +static void +core_tests_pigeon_test_host_integration_core_api_echo_another_enum_response_init( + CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherEnumResponse* self) {} + +static void +core_tests_pigeon_test_host_integration_core_api_echo_another_enum_response_class_init( + CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherEnumResponseClass* + klass) { + G_OBJECT_CLASS(klass)->dispose = + core_tests_pigeon_test_host_integration_core_api_echo_another_enum_response_dispose; +} + +CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherEnumResponse* +core_tests_pigeon_test_host_integration_core_api_echo_another_enum_response_new( + CoreTestsPigeonTestAnotherEnum return_value) { + CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherEnumResponse* self = + CORE_TESTS_PIGEON_TEST_HOST_INTEGRATION_CORE_API_ECHO_ANOTHER_ENUM_RESPONSE( + g_object_new( + core_tests_pigeon_test_host_integration_core_api_echo_another_enum_response_get_type(), + nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, + fl_value_new_custom(130, fl_value_new_int(return_value), + (GDestroyNotify)fl_value_unref)); + return self; +} + +CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherEnumResponse* +core_tests_pigeon_test_host_integration_core_api_echo_another_enum_response_new_error( + const gchar* code, const gchar* message, FlValue* details) { + CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherEnumResponse* self = + CORE_TESTS_PIGEON_TEST_HOST_INTEGRATION_CORE_API_ECHO_ANOTHER_ENUM_RESPONSE( + g_object_new( + core_tests_pigeon_test_host_integration_core_api_echo_another_enum_response_get_type(), + nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_string(code)); + fl_value_append_take(self->value, + fl_value_new_string(message != nullptr ? message : "")); + fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) + : fl_value_new_null()); + return self; +} + struct _CoreTestsPigeonTestHostIntegrationCoreApiEchoNamedDefaultStringResponse { GObject parent_instance; @@ -3249,7 +3430,7 @@ core_tests_pigeon_test_host_integration_core_api_echo_all_nullable_types_respons self->value = fl_value_new_list(); fl_value_append_take( self->value, return_value != nullptr - ? fl_value_new_custom_object(130, G_OBJECT(return_value)) + ? fl_value_new_custom_object(132, G_OBJECT(return_value)) : fl_value_new_null()); return self; } @@ -3320,7 +3501,7 @@ core_tests_pigeon_test_host_integration_core_api_echo_all_nullable_types_without self->value = fl_value_new_list(); fl_value_append_take( self->value, return_value != nullptr - ? fl_value_new_custom_object(131, G_OBJECT(return_value)) + ? fl_value_new_custom_object(133, G_OBJECT(return_value)) : fl_value_new_null()); return self; } @@ -3459,7 +3640,7 @@ core_tests_pigeon_test_host_integration_core_api_create_nested_nullable_string_r nullptr)); self->value = fl_value_new_list(); fl_value_append_take(self->value, - fl_value_new_custom_object(132, G_OBJECT(return_value))); + fl_value_new_custom_object(134, G_OBJECT(return_value))); return self; } @@ -3527,7 +3708,7 @@ core_tests_pigeon_test_host_integration_core_api_send_multiple_nullable_types_re nullptr)); self->value = fl_value_new_list(); fl_value_append_take(self->value, - fl_value_new_custom_object(130, G_OBJECT(return_value))); + fl_value_new_custom_object(132, G_OBJECT(return_value))); return self; } @@ -3596,7 +3777,7 @@ core_tests_pigeon_test_host_integration_core_api_send_multiple_nullable_types_wi nullptr)); self->value = fl_value_new_list(); fl_value_append_take(self->value, - fl_value_new_custom_object(131, G_OBJECT(return_value))); + fl_value_new_custom_object(133, G_OBJECT(return_value))); return self; } @@ -4205,7 +4386,7 @@ core_tests_pigeon_test_host_integration_core_api_echo_nullable_enum_response_new fl_value_append_take( self->value, return_value != nullptr - ? fl_value_new_custom(134, fl_value_new_int(*return_value), + ? fl_value_new_custom(129, fl_value_new_int(*return_value), (GDestroyNotify)fl_value_unref) : fl_value_new_null()); return self; @@ -4217,7 +4398,79 @@ core_tests_pigeon_test_host_integration_core_api_echo_nullable_enum_response_new CoreTestsPigeonTestHostIntegrationCoreApiEchoNullableEnumResponse* self = CORE_TESTS_PIGEON_TEST_HOST_INTEGRATION_CORE_API_ECHO_NULLABLE_ENUM_RESPONSE( g_object_new( - core_tests_pigeon_test_host_integration_core_api_echo_nullable_enum_response_get_type(), + core_tests_pigeon_test_host_integration_core_api_echo_nullable_enum_response_get_type(), + nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_string(code)); + fl_value_append_take(self->value, + fl_value_new_string(message != nullptr ? message : "")); + fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) + : fl_value_new_null()); + return self; +} + +struct + _CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherNullableEnumResponse { + GObject parent_instance; + + FlValue* value; +}; + +G_DEFINE_TYPE( + CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherNullableEnumResponse, + core_tests_pigeon_test_host_integration_core_api_echo_another_nullable_enum_response, + G_TYPE_OBJECT) + +static void +core_tests_pigeon_test_host_integration_core_api_echo_another_nullable_enum_response_dispose( + GObject* object) { + CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherNullableEnumResponse* self = + CORE_TESTS_PIGEON_TEST_HOST_INTEGRATION_CORE_API_ECHO_ANOTHER_NULLABLE_ENUM_RESPONSE( + object); + g_clear_pointer(&self->value, fl_value_unref); + G_OBJECT_CLASS( + core_tests_pigeon_test_host_integration_core_api_echo_another_nullable_enum_response_parent_class) + ->dispose(object); +} + +static void +core_tests_pigeon_test_host_integration_core_api_echo_another_nullable_enum_response_init( + CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherNullableEnumResponse* + self) {} + +static void +core_tests_pigeon_test_host_integration_core_api_echo_another_nullable_enum_response_class_init( + CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherNullableEnumResponseClass* + klass) { + G_OBJECT_CLASS(klass)->dispose = + core_tests_pigeon_test_host_integration_core_api_echo_another_nullable_enum_response_dispose; +} + +CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherNullableEnumResponse* +core_tests_pigeon_test_host_integration_core_api_echo_another_nullable_enum_response_new( + CoreTestsPigeonTestAnotherEnum* return_value) { + CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherNullableEnumResponse* self = + CORE_TESTS_PIGEON_TEST_HOST_INTEGRATION_CORE_API_ECHO_ANOTHER_NULLABLE_ENUM_RESPONSE( + g_object_new( + core_tests_pigeon_test_host_integration_core_api_echo_another_nullable_enum_response_get_type(), + nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take( + self->value, + return_value != nullptr + ? fl_value_new_custom(130, fl_value_new_int(*return_value), + (GDestroyNotify)fl_value_unref) + : fl_value_new_null()); + return self; +} + +CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherNullableEnumResponse* +core_tests_pigeon_test_host_integration_core_api_echo_another_nullable_enum_response_new_error( + const gchar* code, const gchar* message, FlValue* details) { + CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherNullableEnumResponse* self = + CORE_TESTS_PIGEON_TEST_HOST_INTEGRATION_CORE_API_ECHO_ANOTHER_NULLABLE_ENUM_RESPONSE( + g_object_new( + core_tests_pigeon_test_host_integration_core_api_echo_another_nullable_enum_response_get_type(), nullptr)); self->value = fl_value_new_list(); fl_value_append_take(self->value, fl_value_new_string(code)); @@ -5052,7 +5305,7 @@ core_tests_pigeon_test_host_integration_core_api_echo_async_enum_response_new( nullptr)); self->value = fl_value_new_list(); fl_value_append_take(self->value, - fl_value_new_custom(134, fl_value_new_int(return_value), + fl_value_new_custom(129, fl_value_new_int(return_value), (GDestroyNotify)fl_value_unref)); return self; } @@ -5074,6 +5327,80 @@ core_tests_pigeon_test_host_integration_core_api_echo_async_enum_response_new_er return self; } +G_DECLARE_FINAL_TYPE( + CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherAsyncEnumResponse, + core_tests_pigeon_test_host_integration_core_api_echo_another_async_enum_response, + CORE_TESTS_PIGEON_TEST, + HOST_INTEGRATION_CORE_API_ECHO_ANOTHER_ASYNC_ENUM_RESPONSE, GObject) + +struct _CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherAsyncEnumResponse { + GObject parent_instance; + + FlValue* value; +}; + +G_DEFINE_TYPE( + CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherAsyncEnumResponse, + core_tests_pigeon_test_host_integration_core_api_echo_another_async_enum_response, + G_TYPE_OBJECT) + +static void +core_tests_pigeon_test_host_integration_core_api_echo_another_async_enum_response_dispose( + GObject* object) { + CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherAsyncEnumResponse* self = + CORE_TESTS_PIGEON_TEST_HOST_INTEGRATION_CORE_API_ECHO_ANOTHER_ASYNC_ENUM_RESPONSE( + object); + g_clear_pointer(&self->value, fl_value_unref); + G_OBJECT_CLASS( + core_tests_pigeon_test_host_integration_core_api_echo_another_async_enum_response_parent_class) + ->dispose(object); +} + +static void +core_tests_pigeon_test_host_integration_core_api_echo_another_async_enum_response_init( + CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherAsyncEnumResponse* + self) {} + +static void +core_tests_pigeon_test_host_integration_core_api_echo_another_async_enum_response_class_init( + CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherAsyncEnumResponseClass* + klass) { + G_OBJECT_CLASS(klass)->dispose = + core_tests_pigeon_test_host_integration_core_api_echo_another_async_enum_response_dispose; +} + +static CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherAsyncEnumResponse* +core_tests_pigeon_test_host_integration_core_api_echo_another_async_enum_response_new( + CoreTestsPigeonTestAnotherEnum return_value) { + CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherAsyncEnumResponse* self = + CORE_TESTS_PIGEON_TEST_HOST_INTEGRATION_CORE_API_ECHO_ANOTHER_ASYNC_ENUM_RESPONSE( + g_object_new( + core_tests_pigeon_test_host_integration_core_api_echo_another_async_enum_response_get_type(), + nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, + fl_value_new_custom(130, fl_value_new_int(return_value), + (GDestroyNotify)fl_value_unref)); + return self; +} + +static CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherAsyncEnumResponse* +core_tests_pigeon_test_host_integration_core_api_echo_another_async_enum_response_new_error( + const gchar* code, const gchar* message, FlValue* details) { + CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherAsyncEnumResponse* self = + CORE_TESTS_PIGEON_TEST_HOST_INTEGRATION_CORE_API_ECHO_ANOTHER_ASYNC_ENUM_RESPONSE( + g_object_new( + core_tests_pigeon_test_host_integration_core_api_echo_another_async_enum_response_get_type(), + nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_string(code)); + fl_value_append_take(self->value, + fl_value_new_string(message != nullptr ? message : "")); + fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) + : fl_value_new_null()); + return self; +} + G_DECLARE_FINAL_TYPE( CoreTestsPigeonTestHostIntegrationCoreApiThrowAsyncErrorResponse, core_tests_pigeon_test_host_integration_core_api_throw_async_error_response, @@ -5345,7 +5672,7 @@ core_tests_pigeon_test_host_integration_core_api_echo_async_all_types_response_n nullptr)); self->value = fl_value_new_list(); fl_value_append_take(self->value, - fl_value_new_custom_object(129, G_OBJECT(return_value))); + fl_value_new_custom_object(131, G_OBJECT(return_value))); return self; } @@ -5422,7 +5749,7 @@ core_tests_pigeon_test_host_integration_core_api_echo_async_nullable_all_nullabl self->value = fl_value_new_list(); fl_value_append_take( self->value, return_value != nullptr - ? fl_value_new_custom_object(130, G_OBJECT(return_value)) + ? fl_value_new_custom_object(132, G_OBJECT(return_value)) : fl_value_new_null()); return self; } @@ -5500,7 +5827,7 @@ core_tests_pigeon_test_host_integration_core_api_echo_async_nullable_all_nullabl self->value = fl_value_new_list(); fl_value_append_take( self->value, return_value != nullptr - ? fl_value_new_custom_object(131, G_OBJECT(return_value)) + ? fl_value_new_custom_object(133, G_OBJECT(return_value)) : fl_value_new_null()); return self; } @@ -6173,7 +6500,7 @@ core_tests_pigeon_test_host_integration_core_api_echo_async_nullable_enum_respon fl_value_append_take( self->value, return_value != nullptr - ? fl_value_new_custom(134, fl_value_new_int(*return_value), + ? fl_value_new_custom(129, fl_value_new_int(*return_value), (GDestroyNotify)fl_value_unref) : fl_value_new_null()); return self; @@ -6196,6 +6523,86 @@ core_tests_pigeon_test_host_integration_core_api_echo_async_nullable_enum_respon return self; } +G_DECLARE_FINAL_TYPE( + CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherAsyncNullableEnumResponse, + core_tests_pigeon_test_host_integration_core_api_echo_another_async_nullable_enum_response, + CORE_TESTS_PIGEON_TEST, + HOST_INTEGRATION_CORE_API_ECHO_ANOTHER_ASYNC_NULLABLE_ENUM_RESPONSE, + GObject) + +struct + _CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherAsyncNullableEnumResponse { + GObject parent_instance; + + FlValue* value; +}; + +G_DEFINE_TYPE( + CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherAsyncNullableEnumResponse, + core_tests_pigeon_test_host_integration_core_api_echo_another_async_nullable_enum_response, + G_TYPE_OBJECT) + +static void +core_tests_pigeon_test_host_integration_core_api_echo_another_async_nullable_enum_response_dispose( + GObject* object) { + CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherAsyncNullableEnumResponse* + self = + CORE_TESTS_PIGEON_TEST_HOST_INTEGRATION_CORE_API_ECHO_ANOTHER_ASYNC_NULLABLE_ENUM_RESPONSE( + object); + g_clear_pointer(&self->value, fl_value_unref); + G_OBJECT_CLASS( + core_tests_pigeon_test_host_integration_core_api_echo_another_async_nullable_enum_response_parent_class) + ->dispose(object); +} + +static void +core_tests_pigeon_test_host_integration_core_api_echo_another_async_nullable_enum_response_init( + CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherAsyncNullableEnumResponse* + self) {} + +static void +core_tests_pigeon_test_host_integration_core_api_echo_another_async_nullable_enum_response_class_init( + CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherAsyncNullableEnumResponseClass* + klass) { + G_OBJECT_CLASS(klass)->dispose = + core_tests_pigeon_test_host_integration_core_api_echo_another_async_nullable_enum_response_dispose; +} + +static CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherAsyncNullableEnumResponse* +core_tests_pigeon_test_host_integration_core_api_echo_another_async_nullable_enum_response_new( + CoreTestsPigeonTestAnotherEnum* return_value) { + CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherAsyncNullableEnumResponse* self = + CORE_TESTS_PIGEON_TEST_HOST_INTEGRATION_CORE_API_ECHO_ANOTHER_ASYNC_NULLABLE_ENUM_RESPONSE( + g_object_new( + core_tests_pigeon_test_host_integration_core_api_echo_another_async_nullable_enum_response_get_type(), + nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take( + self->value, + return_value != nullptr + ? fl_value_new_custom(130, fl_value_new_int(*return_value), + (GDestroyNotify)fl_value_unref) + : fl_value_new_null()); + return self; +} + +static CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherAsyncNullableEnumResponse* +core_tests_pigeon_test_host_integration_core_api_echo_another_async_nullable_enum_response_new_error( + const gchar* code, const gchar* message, FlValue* details) { + CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherAsyncNullableEnumResponse* self = + CORE_TESTS_PIGEON_TEST_HOST_INTEGRATION_CORE_API_ECHO_ANOTHER_ASYNC_NULLABLE_ENUM_RESPONSE( + g_object_new( + core_tests_pigeon_test_host_integration_core_api_echo_another_async_nullable_enum_response_get_type(), + nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_string(code)); + fl_value_append_take(self->value, + fl_value_new_string(message != nullptr ? message : "")); + fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) + : fl_value_new_null()); + return self; +} + G_DECLARE_FINAL_TYPE( CoreTestsPigeonTestHostIntegrationCoreApiCallFlutterNoopResponse, core_tests_pigeon_test_host_integration_core_api_call_flutter_noop_response, @@ -6467,7 +6874,7 @@ core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_all_types_res nullptr)); self->value = fl_value_new_list(); fl_value_append_take(self->value, - fl_value_new_custom_object(129, G_OBJECT(return_value))); + fl_value_new_custom_object(131, G_OBJECT(return_value))); return self; } @@ -6544,7 +6951,7 @@ core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_all_nullable_ self->value = fl_value_new_list(); fl_value_append_take( self->value, return_value != nullptr - ? fl_value_new_custom_object(130, G_OBJECT(return_value)) + ? fl_value_new_custom_object(132, G_OBJECT(return_value)) : fl_value_new_null()); return self; } @@ -6621,7 +7028,7 @@ core_tests_pigeon_test_host_integration_core_api_call_flutter_send_multiple_null nullptr)); self->value = fl_value_new_list(); fl_value_append_take(self->value, - fl_value_new_custom_object(130, G_OBJECT(return_value))); + fl_value_new_custom_object(132, G_OBJECT(return_value))); return self; } @@ -6698,7 +7105,7 @@ core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_all_nullable_ self->value = fl_value_new_list(); fl_value_append_take( self->value, return_value != nullptr - ? fl_value_new_custom_object(131, G_OBJECT(return_value)) + ? fl_value_new_custom_object(133, G_OBJECT(return_value)) : fl_value_new_null()); return self; } @@ -6775,7 +7182,7 @@ core_tests_pigeon_test_host_integration_core_api_call_flutter_send_multiple_null nullptr)); self->value = fl_value_new_list(); fl_value_append_take(self->value, - fl_value_new_custom_object(131, G_OBJECT(return_value))); + fl_value_new_custom_object(133, G_OBJECT(return_value))); return self; } @@ -7354,7 +7761,7 @@ core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_enum_response nullptr)); self->value = fl_value_new_list(); fl_value_append_take(self->value, - fl_value_new_custom(134, fl_value_new_int(return_value), + fl_value_new_custom(129, fl_value_new_int(return_value), (GDestroyNotify)fl_value_unref)); return self; } @@ -7376,6 +7783,81 @@ core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_enum_response return self; } +G_DECLARE_FINAL_TYPE( + CoreTestsPigeonTestHostIntegrationCoreApiCallFlutterEchoAnotherEnumResponse, + core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_another_enum_response, + CORE_TESTS_PIGEON_TEST, + HOST_INTEGRATION_CORE_API_CALL_FLUTTER_ECHO_ANOTHER_ENUM_RESPONSE, GObject) + +struct + _CoreTestsPigeonTestHostIntegrationCoreApiCallFlutterEchoAnotherEnumResponse { + GObject parent_instance; + + FlValue* value; +}; + +G_DEFINE_TYPE( + CoreTestsPigeonTestHostIntegrationCoreApiCallFlutterEchoAnotherEnumResponse, + core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_another_enum_response, + G_TYPE_OBJECT) + +static void +core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_another_enum_response_dispose( + GObject* object) { + CoreTestsPigeonTestHostIntegrationCoreApiCallFlutterEchoAnotherEnumResponse* self = + CORE_TESTS_PIGEON_TEST_HOST_INTEGRATION_CORE_API_CALL_FLUTTER_ECHO_ANOTHER_ENUM_RESPONSE( + object); + g_clear_pointer(&self->value, fl_value_unref); + G_OBJECT_CLASS( + core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_another_enum_response_parent_class) + ->dispose(object); +} + +static void +core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_another_enum_response_init( + CoreTestsPigeonTestHostIntegrationCoreApiCallFlutterEchoAnotherEnumResponse* + self) {} + +static void +core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_another_enum_response_class_init( + CoreTestsPigeonTestHostIntegrationCoreApiCallFlutterEchoAnotherEnumResponseClass* + klass) { + G_OBJECT_CLASS(klass)->dispose = + core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_another_enum_response_dispose; +} + +static CoreTestsPigeonTestHostIntegrationCoreApiCallFlutterEchoAnotherEnumResponse* +core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_another_enum_response_new( + CoreTestsPigeonTestAnotherEnum return_value) { + CoreTestsPigeonTestHostIntegrationCoreApiCallFlutterEchoAnotherEnumResponse* self = + CORE_TESTS_PIGEON_TEST_HOST_INTEGRATION_CORE_API_CALL_FLUTTER_ECHO_ANOTHER_ENUM_RESPONSE( + g_object_new( + core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_another_enum_response_get_type(), + nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, + fl_value_new_custom(130, fl_value_new_int(return_value), + (GDestroyNotify)fl_value_unref)); + return self; +} + +static CoreTestsPigeonTestHostIntegrationCoreApiCallFlutterEchoAnotherEnumResponse* +core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_another_enum_response_new_error( + const gchar* code, const gchar* message, FlValue* details) { + CoreTestsPigeonTestHostIntegrationCoreApiCallFlutterEchoAnotherEnumResponse* self = + CORE_TESTS_PIGEON_TEST_HOST_INTEGRATION_CORE_API_CALL_FLUTTER_ECHO_ANOTHER_ENUM_RESPONSE( + g_object_new( + core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_another_enum_response_get_type(), + nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_string(code)); + fl_value_append_take(self->value, + fl_value_new_string(message != nullptr ? message : "")); + fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) + : fl_value_new_null()); + return self; +} + G_DECLARE_FINAL_TYPE( CoreTestsPigeonTestHostIntegrationCoreApiCallFlutterEchoNullableBoolResponse, core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_nullable_bool_response, @@ -7966,7 +8448,7 @@ core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_nullable_enum fl_value_append_take( self->value, return_value != nullptr - ? fl_value_new_custom(134, fl_value_new_int(*return_value), + ? fl_value_new_custom(129, fl_value_new_int(*return_value), (GDestroyNotify)fl_value_unref) : fl_value_new_null()); return self; @@ -7989,6 +8471,86 @@ core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_nullable_enum return self; } +G_DECLARE_FINAL_TYPE( + CoreTestsPigeonTestHostIntegrationCoreApiCallFlutterEchoAnotherNullableEnumResponse, + core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_another_nullable_enum_response, + CORE_TESTS_PIGEON_TEST, + HOST_INTEGRATION_CORE_API_CALL_FLUTTER_ECHO_ANOTHER_NULLABLE_ENUM_RESPONSE, + GObject) + +struct + _CoreTestsPigeonTestHostIntegrationCoreApiCallFlutterEchoAnotherNullableEnumResponse { + GObject parent_instance; + + FlValue* value; +}; + +G_DEFINE_TYPE( + CoreTestsPigeonTestHostIntegrationCoreApiCallFlutterEchoAnotherNullableEnumResponse, + core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_another_nullable_enum_response, + G_TYPE_OBJECT) + +static void +core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_another_nullable_enum_response_dispose( + GObject* object) { + CoreTestsPigeonTestHostIntegrationCoreApiCallFlutterEchoAnotherNullableEnumResponse* + self = + CORE_TESTS_PIGEON_TEST_HOST_INTEGRATION_CORE_API_CALL_FLUTTER_ECHO_ANOTHER_NULLABLE_ENUM_RESPONSE( + object); + g_clear_pointer(&self->value, fl_value_unref); + G_OBJECT_CLASS( + core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_another_nullable_enum_response_parent_class) + ->dispose(object); +} + +static void +core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_another_nullable_enum_response_init( + CoreTestsPigeonTestHostIntegrationCoreApiCallFlutterEchoAnotherNullableEnumResponse* + self) {} + +static void +core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_another_nullable_enum_response_class_init( + CoreTestsPigeonTestHostIntegrationCoreApiCallFlutterEchoAnotherNullableEnumResponseClass* + klass) { + G_OBJECT_CLASS(klass)->dispose = + core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_another_nullable_enum_response_dispose; +} + +static CoreTestsPigeonTestHostIntegrationCoreApiCallFlutterEchoAnotherNullableEnumResponse* +core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_another_nullable_enum_response_new( + CoreTestsPigeonTestAnotherEnum* return_value) { + CoreTestsPigeonTestHostIntegrationCoreApiCallFlutterEchoAnotherNullableEnumResponse* + self = CORE_TESTS_PIGEON_TEST_HOST_INTEGRATION_CORE_API_CALL_FLUTTER_ECHO_ANOTHER_NULLABLE_ENUM_RESPONSE( + g_object_new( + core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_another_nullable_enum_response_get_type(), + nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take( + self->value, + return_value != nullptr + ? fl_value_new_custom(130, fl_value_new_int(*return_value), + (GDestroyNotify)fl_value_unref) + : fl_value_new_null()); + return self; +} + +static CoreTestsPigeonTestHostIntegrationCoreApiCallFlutterEchoAnotherNullableEnumResponse* +core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_another_nullable_enum_response_new_error( + const gchar* code, const gchar* message, FlValue* details) { + CoreTestsPigeonTestHostIntegrationCoreApiCallFlutterEchoAnotherNullableEnumResponse* + self = CORE_TESTS_PIGEON_TEST_HOST_INTEGRATION_CORE_API_CALL_FLUTTER_ECHO_ANOTHER_NULLABLE_ENUM_RESPONSE( + g_object_new( + core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_another_nullable_enum_response_get_type(), + nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_string(code)); + fl_value_append_take(self->value, + fl_value_new_string(message != nullptr ? message : "")); + fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) + : fl_value_new_null()); + return self; +} + G_DECLARE_FINAL_TYPE( CoreTestsPigeonTestHostIntegrationCoreApiCallFlutterSmallApiEchoStringResponse, core_tests_pigeon_test_host_integration_core_api_call_flutter_small_api_echo_string_response, @@ -8537,6 +9099,38 @@ static void core_tests_pigeon_test_host_integration_core_api_echo_enum_cb( } } +static void +core_tests_pigeon_test_host_integration_core_api_echo_another_enum_cb( + FlBasicMessageChannel* channel, FlValue* message_, + FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { + CoreTestsPigeonTestHostIntegrationCoreApi* self = + CORE_TESTS_PIGEON_TEST_HOST_INTEGRATION_CORE_API(user_data); + + if (self->vtable == nullptr || self->vtable->echo_another_enum == nullptr) { + return; + } + + FlValue* value0 = fl_value_get_list_value(message_, 0); + CoreTestsPigeonTestAnotherEnum another_enum = + static_cast( + fl_value_get_int(reinterpret_cast( + const_cast(fl_value_get_custom_value(value0))))); + g_autoptr(CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherEnumResponse) + response = self->vtable->echo_another_enum(another_enum, self->user_data); + if (response == nullptr) { + g_warning("No response returned to %s.%s", "HostIntegrationCoreApi", + "echoAnotherEnum"); + return; + } + + g_autoptr(GError) error = NULL; + if (!fl_basic_message_channel_respond(channel, response_handle, + response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "HostIntegrationCoreApi", + "echoAnotherEnum", error->message); + } +} + static void core_tests_pigeon_test_host_integration_core_api_echo_named_default_string_cb( FlBasicMessageChannel* channel, FlValue* message_, @@ -9141,7 +9735,46 @@ core_tests_pigeon_test_host_integration_core_api_echo_nullable_enum_cb( response = self->vtable->echo_nullable_enum(an_enum, self->user_data); if (response == nullptr) { g_warning("No response returned to %s.%s", "HostIntegrationCoreApi", - "echoNullableEnum"); + "echoNullableEnum"); + return; + } + + g_autoptr(GError) error = NULL; + if (!fl_basic_message_channel_respond(channel, response_handle, + response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "HostIntegrationCoreApi", + "echoNullableEnum", error->message); + } +} + +static void +core_tests_pigeon_test_host_integration_core_api_echo_another_nullable_enum_cb( + FlBasicMessageChannel* channel, FlValue* message_, + FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { + CoreTestsPigeonTestHostIntegrationCoreApi* self = + CORE_TESTS_PIGEON_TEST_HOST_INTEGRATION_CORE_API(user_data); + + if (self->vtable == nullptr || + self->vtable->echo_another_nullable_enum == nullptr) { + return; + } + + FlValue* value0 = fl_value_get_list_value(message_, 0); + CoreTestsPigeonTestAnotherEnum* another_enum = nullptr; + CoreTestsPigeonTestAnotherEnum another_enum_value; + if (fl_value_get_type(value0) != FL_VALUE_TYPE_NULL) { + another_enum_value = static_cast( + fl_value_get_int(reinterpret_cast( + const_cast(fl_value_get_custom_value(value0))))); + another_enum = &another_enum_value; + } + g_autoptr( + CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherNullableEnumResponse) + response = self->vtable->echo_another_nullable_enum(another_enum, + self->user_data); + if (response == nullptr) { + g_warning("No response returned to %s.%s", "HostIntegrationCoreApi", + "echoAnotherNullableEnum"); return; } @@ -9149,7 +9782,7 @@ core_tests_pigeon_test_host_integration_core_api_echo_nullable_enum_cb( if (!fl_basic_message_channel_respond(channel, response_handle, response->value, &error)) { g_warning("Failed to send response to %s.%s: %s", "HostIntegrationCoreApi", - "echoNullableEnum", error->message); + "echoAnotherNullableEnum", error->message); } } @@ -9409,6 +10042,29 @@ static void core_tests_pigeon_test_host_integration_core_api_echo_async_enum_cb( self->vtable->echo_async_enum(an_enum, handle, self->user_data); } +static void +core_tests_pigeon_test_host_integration_core_api_echo_another_async_enum_cb( + FlBasicMessageChannel* channel, FlValue* message_, + FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { + CoreTestsPigeonTestHostIntegrationCoreApi* self = + CORE_TESTS_PIGEON_TEST_HOST_INTEGRATION_CORE_API(user_data); + + if (self->vtable == nullptr || + self->vtable->echo_another_async_enum == nullptr) { + return; + } + + FlValue* value0 = fl_value_get_list_value(message_, 0); + CoreTestsPigeonTestAnotherEnum another_enum = + static_cast( + fl_value_get_int(reinterpret_cast( + const_cast(fl_value_get_custom_value(value0))))); + g_autoptr(CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle) handle = + core_tests_pigeon_test_host_integration_core_api_response_handle_new( + channel, response_handle); + self->vtable->echo_another_async_enum(another_enum, handle, self->user_data); +} + static void core_tests_pigeon_test_host_integration_core_api_throw_async_error_cb( FlBasicMessageChannel* channel, FlValue* message_, @@ -9734,6 +10390,34 @@ core_tests_pigeon_test_host_integration_core_api_echo_async_nullable_enum_cb( self->vtable->echo_async_nullable_enum(an_enum, handle, self->user_data); } +static void +core_tests_pigeon_test_host_integration_core_api_echo_another_async_nullable_enum_cb( + FlBasicMessageChannel* channel, FlValue* message_, + FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { + CoreTestsPigeonTestHostIntegrationCoreApi* self = + CORE_TESTS_PIGEON_TEST_HOST_INTEGRATION_CORE_API(user_data); + + if (self->vtable == nullptr || + self->vtable->echo_another_async_nullable_enum == nullptr) { + return; + } + + FlValue* value0 = fl_value_get_list_value(message_, 0); + CoreTestsPigeonTestAnotherEnum* another_enum = nullptr; + CoreTestsPigeonTestAnotherEnum another_enum_value; + if (fl_value_get_type(value0) != FL_VALUE_TYPE_NULL) { + another_enum_value = static_cast( + fl_value_get_int(reinterpret_cast( + const_cast(fl_value_get_custom_value(value0))))); + another_enum = &another_enum_value; + } + g_autoptr(CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle) handle = + core_tests_pigeon_test_host_integration_core_api_response_handle_new( + channel, response_handle); + self->vtable->echo_another_async_nullable_enum(another_enum, handle, + self->user_data); +} + static void core_tests_pigeon_test_host_integration_core_api_call_flutter_noop_cb( FlBasicMessageChannel* channel, FlValue* message_, @@ -10094,6 +10778,30 @@ core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_enum_cb( self->vtable->call_flutter_echo_enum(an_enum, handle, self->user_data); } +static void +core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_another_enum_cb( + FlBasicMessageChannel* channel, FlValue* message_, + FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { + CoreTestsPigeonTestHostIntegrationCoreApi* self = + CORE_TESTS_PIGEON_TEST_HOST_INTEGRATION_CORE_API(user_data); + + if (self->vtable == nullptr || + self->vtable->call_flutter_echo_another_enum == nullptr) { + return; + } + + FlValue* value0 = fl_value_get_list_value(message_, 0); + CoreTestsPigeonTestAnotherEnum another_enum = + static_cast( + fl_value_get_int(reinterpret_cast( + const_cast(fl_value_get_custom_value(value0))))); + g_autoptr(CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle) handle = + core_tests_pigeon_test_host_integration_core_api_response_handle_new( + channel, response_handle); + self->vtable->call_flutter_echo_another_enum(another_enum, handle, + self->user_data); +} + static void core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_nullable_bool_cb( FlBasicMessageChannel* channel, FlValue* message_, @@ -10282,6 +10990,34 @@ core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_nullable_enum self->user_data); } +static void +core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_another_nullable_enum_cb( + FlBasicMessageChannel* channel, FlValue* message_, + FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { + CoreTestsPigeonTestHostIntegrationCoreApi* self = + CORE_TESTS_PIGEON_TEST_HOST_INTEGRATION_CORE_API(user_data); + + if (self->vtable == nullptr || + self->vtable->call_flutter_echo_another_nullable_enum == nullptr) { + return; + } + + FlValue* value0 = fl_value_get_list_value(message_, 0); + CoreTestsPigeonTestAnotherEnum* another_enum = nullptr; + CoreTestsPigeonTestAnotherEnum another_enum_value; + if (fl_value_get_type(value0) != FL_VALUE_TYPE_NULL) { + another_enum_value = static_cast( + fl_value_get_int(reinterpret_cast( + const_cast(fl_value_get_custom_value(value0))))); + another_enum = &another_enum_value; + } + g_autoptr(CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle) handle = + core_tests_pigeon_test_host_integration_core_api_response_handle_new( + channel, response_handle); + self->vtable->call_flutter_echo_another_nullable_enum(another_enum, handle, + self->user_data); +} + static void core_tests_pigeon_test_host_integration_core_api_call_flutter_small_api_echo_string_cb( FlBasicMessageChannel* channel, FlValue* message_, @@ -10479,6 +11215,17 @@ void core_tests_pigeon_test_host_integration_core_api_set_method_handlers( echo_enum_channel, core_tests_pigeon_test_host_integration_core_api_echo_enum_cb, g_object_ref(api_data), g_object_unref); + g_autofree gchar* echo_another_enum_channel_name = g_strdup_printf( + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." + "echoAnotherEnum%s", + dot_suffix); + g_autoptr(FlBasicMessageChannel) echo_another_enum_channel = + fl_basic_message_channel_new(messenger, echo_another_enum_channel_name, + FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler( + echo_another_enum_channel, + core_tests_pigeon_test_host_integration_core_api_echo_another_enum_cb, + g_object_ref(api_data), g_object_unref); g_autofree gchar* echo_named_default_string_channel_name = g_strdup_printf( "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." "echoNamedDefaultString%s", @@ -10695,6 +11442,18 @@ void core_tests_pigeon_test_host_integration_core_api_set_method_handlers( echo_nullable_enum_channel, core_tests_pigeon_test_host_integration_core_api_echo_nullable_enum_cb, g_object_ref(api_data), g_object_unref); + g_autofree gchar* echo_another_nullable_enum_channel_name = g_strdup_printf( + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." + "echoAnotherNullableEnum%s", + dot_suffix); + g_autoptr(FlBasicMessageChannel) echo_another_nullable_enum_channel = + fl_basic_message_channel_new(messenger, + echo_another_nullable_enum_channel_name, + FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler( + echo_another_nullable_enum_channel, + core_tests_pigeon_test_host_integration_core_api_echo_another_nullable_enum_cb, + g_object_ref(api_data), g_object_unref); g_autofree gchar* echo_optional_nullable_int_channel_name = g_strdup_printf( "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." "echoOptionalNullableInt%s", @@ -10830,6 +11589,18 @@ void core_tests_pigeon_test_host_integration_core_api_set_method_handlers( echo_async_enum_channel, core_tests_pigeon_test_host_integration_core_api_echo_async_enum_cb, g_object_ref(api_data), g_object_unref); + g_autofree gchar* echo_another_async_enum_channel_name = g_strdup_printf( + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." + "echoAnotherAsyncEnum%s", + dot_suffix); + g_autoptr(FlBasicMessageChannel) echo_another_async_enum_channel = + fl_basic_message_channel_new(messenger, + echo_another_async_enum_channel_name, + FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler( + echo_another_async_enum_channel, + core_tests_pigeon_test_host_integration_core_api_echo_another_async_enum_cb, + g_object_ref(api_data), g_object_unref); g_autofree gchar* throw_async_error_channel_name = g_strdup_printf( "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." "throwAsyncError%s", @@ -11016,6 +11787,19 @@ void core_tests_pigeon_test_host_integration_core_api_set_method_handlers( echo_async_nullable_enum_channel, core_tests_pigeon_test_host_integration_core_api_echo_async_nullable_enum_cb, g_object_ref(api_data), g_object_unref); + g_autofree gchar* echo_another_async_nullable_enum_channel_name = + g_strdup_printf( + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." + "echoAnotherAsyncNullableEnum%s", + dot_suffix); + g_autoptr(FlBasicMessageChannel) echo_another_async_nullable_enum_channel = + fl_basic_message_channel_new( + messenger, echo_another_async_nullable_enum_channel_name, + FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler( + echo_another_async_nullable_enum_channel, + core_tests_pigeon_test_host_integration_core_api_echo_another_async_nullable_enum_cb, + g_object_ref(api_data), g_object_unref); g_autofree gchar* call_flutter_noop_channel_name = g_strdup_printf( "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." "callFlutterNoop%s", @@ -11222,6 +12006,19 @@ void core_tests_pigeon_test_host_integration_core_api_set_method_handlers( call_flutter_echo_enum_channel, core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_enum_cb, g_object_ref(api_data), g_object_unref); + g_autofree gchar* call_flutter_echo_another_enum_channel_name = + g_strdup_printf( + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." + "callFlutterEchoAnotherEnum%s", + dot_suffix); + g_autoptr(FlBasicMessageChannel) call_flutter_echo_another_enum_channel = + fl_basic_message_channel_new(messenger, + call_flutter_echo_another_enum_channel_name, + FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler( + call_flutter_echo_another_enum_channel, + core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_another_enum_cb, + g_object_ref(api_data), g_object_unref); g_autofree gchar* call_flutter_echo_nullable_bool_channel_name = g_strdup_printf( "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." @@ -11327,6 +12124,20 @@ void core_tests_pigeon_test_host_integration_core_api_set_method_handlers( call_flutter_echo_nullable_enum_channel, core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_nullable_enum_cb, g_object_ref(api_data), g_object_unref); + g_autofree gchar* call_flutter_echo_another_nullable_enum_channel_name = + g_strdup_printf( + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." + "callFlutterEchoAnotherNullableEnum%s", + dot_suffix); + g_autoptr(FlBasicMessageChannel) + call_flutter_echo_another_nullable_enum_channel = + fl_basic_message_channel_new( + messenger, call_flutter_echo_another_nullable_enum_channel_name, + FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler( + call_flutter_echo_another_nullable_enum_channel, + core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_another_nullable_enum_cb, + g_object_ref(api_data), g_object_unref); g_autofree gchar* call_flutter_small_api_echo_string_channel_name = g_strdup_printf( "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." @@ -11484,6 +12295,15 @@ void core_tests_pigeon_test_host_integration_core_api_clear_method_handlers( FL_MESSAGE_CODEC(codec)); fl_basic_message_channel_set_message_handler(echo_enum_channel, nullptr, nullptr, nullptr); + g_autofree gchar* echo_another_enum_channel_name = g_strdup_printf( + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." + "echoAnotherEnum%s", + dot_suffix); + g_autoptr(FlBasicMessageChannel) echo_another_enum_channel = + fl_basic_message_channel_new(messenger, echo_another_enum_channel_name, + FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(echo_another_enum_channel, + nullptr, nullptr, nullptr); g_autofree gchar* echo_named_default_string_channel_name = g_strdup_printf( "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." "echoNamedDefaultString%s", @@ -11666,6 +12486,16 @@ void core_tests_pigeon_test_host_integration_core_api_clear_method_handlers( FL_MESSAGE_CODEC(codec)); fl_basic_message_channel_set_message_handler(echo_nullable_enum_channel, nullptr, nullptr, nullptr); + g_autofree gchar* echo_another_nullable_enum_channel_name = g_strdup_printf( + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." + "echoAnotherNullableEnum%s", + dot_suffix); + g_autoptr(FlBasicMessageChannel) echo_another_nullable_enum_channel = + fl_basic_message_channel_new(messenger, + echo_another_nullable_enum_channel_name, + FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler( + echo_another_nullable_enum_channel, nullptr, nullptr, nullptr); g_autofree gchar* echo_optional_nullable_int_channel_name = g_strdup_printf( "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." "echoOptionalNullableInt%s", @@ -11777,6 +12607,16 @@ void core_tests_pigeon_test_host_integration_core_api_clear_method_handlers( FL_MESSAGE_CODEC(codec)); fl_basic_message_channel_set_message_handler(echo_async_enum_channel, nullptr, nullptr, nullptr); + g_autofree gchar* echo_another_async_enum_channel_name = g_strdup_printf( + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." + "echoAnotherAsyncEnum%s", + dot_suffix); + g_autoptr(FlBasicMessageChannel) echo_another_async_enum_channel = + fl_basic_message_channel_new(messenger, + echo_another_async_enum_channel_name, + FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(echo_another_async_enum_channel, + nullptr, nullptr, nullptr); g_autofree gchar* throw_async_error_channel_name = g_strdup_printf( "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." "throwAsyncError%s", @@ -11935,6 +12775,17 @@ void core_tests_pigeon_test_host_integration_core_api_clear_method_handlers( FL_MESSAGE_CODEC(codec)); fl_basic_message_channel_set_message_handler(echo_async_nullable_enum_channel, nullptr, nullptr, nullptr); + g_autofree gchar* echo_another_async_nullable_enum_channel_name = + g_strdup_printf( + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." + "echoAnotherAsyncNullableEnum%s", + dot_suffix); + g_autoptr(FlBasicMessageChannel) echo_another_async_nullable_enum_channel = + fl_basic_message_channel_new( + messenger, echo_another_async_nullable_enum_channel_name, + FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler( + echo_another_async_nullable_enum_channel, nullptr, nullptr, nullptr); g_autofree gchar* call_flutter_noop_channel_name = g_strdup_printf( "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." "callFlutterNoop%s", @@ -12112,6 +12963,17 @@ void core_tests_pigeon_test_host_integration_core_api_clear_method_handlers( FL_MESSAGE_CODEC(codec)); fl_basic_message_channel_set_message_handler(call_flutter_echo_enum_channel, nullptr, nullptr, nullptr); + g_autofree gchar* call_flutter_echo_another_enum_channel_name = + g_strdup_printf( + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." + "callFlutterEchoAnotherEnum%s", + dot_suffix); + g_autoptr(FlBasicMessageChannel) call_flutter_echo_another_enum_channel = + fl_basic_message_channel_new(messenger, + call_flutter_echo_another_enum_channel_name, + FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler( + call_flutter_echo_another_enum_channel, nullptr, nullptr, nullptr); g_autofree gchar* call_flutter_echo_nullable_bool_channel_name = g_strdup_printf( "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." @@ -12201,6 +13063,19 @@ void core_tests_pigeon_test_host_integration_core_api_clear_method_handlers( FL_MESSAGE_CODEC(codec)); fl_basic_message_channel_set_message_handler( call_flutter_echo_nullable_enum_channel, nullptr, nullptr, nullptr); + g_autofree gchar* call_flutter_echo_another_nullable_enum_channel_name = + g_strdup_printf( + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." + "callFlutterEchoAnotherNullableEnum%s", + dot_suffix); + g_autoptr(FlBasicMessageChannel) + call_flutter_echo_another_nullable_enum_channel = + fl_basic_message_channel_new( + messenger, call_flutter_echo_another_nullable_enum_channel_name, + FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler( + call_flutter_echo_another_nullable_enum_channel, nullptr, nullptr, + nullptr); g_autofree gchar* call_flutter_small_api_echo_string_channel_name = g_strdup_printf( "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." @@ -12532,6 +13407,40 @@ void core_tests_pigeon_test_host_integration_core_api_respond_error_echo_async_e } } +void core_tests_pigeon_test_host_integration_core_api_respond_echo_another_async_enum( + CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, + CoreTestsPigeonTestAnotherEnum return_value) { + g_autoptr( + CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherAsyncEnumResponse) + response = + core_tests_pigeon_test_host_integration_core_api_echo_another_async_enum_response_new( + return_value); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, + response_handle->response_handle, + response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "HostIntegrationCoreApi", + "echoAnotherAsyncEnum", error->message); + } +} + +void core_tests_pigeon_test_host_integration_core_api_respond_error_echo_another_async_enum( + CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, + const gchar* code, const gchar* message, FlValue* details) { + g_autoptr( + CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherAsyncEnumResponse) + response = + core_tests_pigeon_test_host_integration_core_api_echo_another_async_enum_response_new_error( + code, message, details); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, + response_handle->response_handle, + response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "HostIntegrationCoreApi", + "echoAnotherAsyncEnum", error->message); + } +} + void core_tests_pigeon_test_host_integration_core_api_respond_throw_async_error( CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, FlValue* return_value) { @@ -13038,6 +13947,40 @@ void core_tests_pigeon_test_host_integration_core_api_respond_error_echo_async_n } } +void core_tests_pigeon_test_host_integration_core_api_respond_echo_another_async_nullable_enum( + CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, + CoreTestsPigeonTestAnotherEnum* return_value) { + g_autoptr( + CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherAsyncNullableEnumResponse) + response = + core_tests_pigeon_test_host_integration_core_api_echo_another_async_nullable_enum_response_new( + return_value); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, + response_handle->response_handle, + response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "HostIntegrationCoreApi", + "echoAnotherAsyncNullableEnum", error->message); + } +} + +void core_tests_pigeon_test_host_integration_core_api_respond_error_echo_another_async_nullable_enum( + CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, + const gchar* code, const gchar* message, FlValue* details) { + g_autoptr( + CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherAsyncNullableEnumResponse) + response = + core_tests_pigeon_test_host_integration_core_api_echo_another_async_nullable_enum_response_new_error( + code, message, details); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, + response_handle->response_handle, + response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "HostIntegrationCoreApi", + "echoAnotherAsyncNullableEnum", error->message); + } +} + void core_tests_pigeon_test_host_integration_core_api_respond_call_flutter_noop( CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle) { g_autoptr( @@ -13576,6 +14519,40 @@ void core_tests_pigeon_test_host_integration_core_api_respond_error_call_flutter } } +void core_tests_pigeon_test_host_integration_core_api_respond_call_flutter_echo_another_enum( + CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, + CoreTestsPigeonTestAnotherEnum return_value) { + g_autoptr( + CoreTestsPigeonTestHostIntegrationCoreApiCallFlutterEchoAnotherEnumResponse) + response = + core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_another_enum_response_new( + return_value); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, + response_handle->response_handle, + response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "HostIntegrationCoreApi", + "callFlutterEchoAnotherEnum", error->message); + } +} + +void core_tests_pigeon_test_host_integration_core_api_respond_error_call_flutter_echo_another_enum( + CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, + const gchar* code, const gchar* message, FlValue* details) { + g_autoptr( + CoreTestsPigeonTestHostIntegrationCoreApiCallFlutterEchoAnotherEnumResponse) + response = + core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_another_enum_response_new_error( + code, message, details); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, + response_handle->response_handle, + response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "HostIntegrationCoreApi", + "callFlutterEchoAnotherEnum", error->message); + } +} + void core_tests_pigeon_test_host_integration_core_api_respond_call_flutter_echo_nullable_bool( CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, gboolean* return_value) { @@ -13820,31 +14797,65 @@ void core_tests_pigeon_test_host_integration_core_api_respond_call_flutter_echo_ g_autoptr( CoreTestsPigeonTestHostIntegrationCoreApiCallFlutterEchoNullableEnumResponse) response = - core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_nullable_enum_response_new( + core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_nullable_enum_response_new( + return_value); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, + response_handle->response_handle, + response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "HostIntegrationCoreApi", + "callFlutterEchoNullableEnum", error->message); + } +} + +void core_tests_pigeon_test_host_integration_core_api_respond_error_call_flutter_echo_nullable_enum( + CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, + const gchar* code, const gchar* message, FlValue* details) { + g_autoptr( + CoreTestsPigeonTestHostIntegrationCoreApiCallFlutterEchoNullableEnumResponse) + response = + core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_nullable_enum_response_new_error( + code, message, details); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, + response_handle->response_handle, + response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "HostIntegrationCoreApi", + "callFlutterEchoNullableEnum", error->message); + } +} + +void core_tests_pigeon_test_host_integration_core_api_respond_call_flutter_echo_another_nullable_enum( + CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, + CoreTestsPigeonTestAnotherEnum* return_value) { + g_autoptr( + CoreTestsPigeonTestHostIntegrationCoreApiCallFlutterEchoAnotherNullableEnumResponse) + response = + core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_another_nullable_enum_response_new( return_value); g_autoptr(GError) error = nullptr; if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { g_warning("Failed to send response to %s.%s: %s", "HostIntegrationCoreApi", - "callFlutterEchoNullableEnum", error->message); + "callFlutterEchoAnotherNullableEnum", error->message); } } -void core_tests_pigeon_test_host_integration_core_api_respond_error_call_flutter_echo_nullable_enum( +void core_tests_pigeon_test_host_integration_core_api_respond_error_call_flutter_echo_another_nullable_enum( CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { g_autoptr( - CoreTestsPigeonTestHostIntegrationCoreApiCallFlutterEchoNullableEnumResponse) + CoreTestsPigeonTestHostIntegrationCoreApiCallFlutterEchoAnotherNullableEnumResponse) response = - core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_nullable_enum_response_new_error( + core_tests_pigeon_test_host_integration_core_api_call_flutter_echo_another_nullable_enum_response_new_error( code, message, details); g_autoptr(GError) error = nullptr; if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { g_warning("Failed to send response to %s.%s: %s", "HostIntegrationCoreApi", - "callFlutterEchoNullableEnum", error->message); + "callFlutterEchoAnotherNullableEnum", error->message); } } @@ -14503,7 +15514,7 @@ void core_tests_pigeon_test_flutter_integration_core_api_echo_all_types( GAsyncReadyCallback callback, gpointer user_data) { g_autoptr(FlValue) args = fl_value_new_list(); fl_value_append_take(args, - fl_value_new_custom_object(129, G_OBJECT(everything))); + fl_value_new_custom_object(131, G_OBJECT(everything))); g_autofree gchar* channel_name = g_strdup_printf( "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi." "echoAllTypes%s", @@ -14678,7 +15689,7 @@ void core_tests_pigeon_test_flutter_integration_core_api_echo_all_nullable_types g_autoptr(FlValue) args = fl_value_new_list(); fl_value_append_take( args, everything != nullptr - ? fl_value_new_custom_object(130, G_OBJECT(everything)) + ? fl_value_new_custom_object(132, G_OBJECT(everything)) : fl_value_new_null()); g_autofree gchar* channel_name = g_strdup_printf( "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi." @@ -15036,7 +16047,7 @@ void core_tests_pigeon_test_flutter_integration_core_api_echo_all_nullable_types g_autoptr(FlValue) args = fl_value_new_list(); fl_value_append_take( args, everything != nullptr - ? fl_value_new_custom_object(131, G_OBJECT(everything)) + ? fl_value_new_custom_object(133, G_OBJECT(everything)) : fl_value_new_null()); g_autofree gchar* channel_name = g_strdup_printf( "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi." @@ -16502,7 +17513,7 @@ void core_tests_pigeon_test_flutter_integration_core_api_echo_enum( GAsyncReadyCallback callback, gpointer user_data) { g_autoptr(FlValue) args = fl_value_new_list(); fl_value_append_take(args, - fl_value_new_custom(134, fl_value_new_int(an_enum), + fl_value_new_custom(129, fl_value_new_int(an_enum), (GDestroyNotify)fl_value_unref)); g_autofree gchar* channel_name = g_strdup_printf( "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi." @@ -16536,6 +17547,173 @@ core_tests_pigeon_test_flutter_integration_core_api_echo_enum_finish( response); } +struct _CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherEnumResponse { + GObject parent_instance; + + FlValue* error; + FlValue* return_value; +}; + +G_DEFINE_TYPE( + CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherEnumResponse, + core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_response, + G_TYPE_OBJECT) + +static void +core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_response_dispose( + GObject* object) { + CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherEnumResponse* self = + CORE_TESTS_PIGEON_TEST_FLUTTER_INTEGRATION_CORE_API_ECHO_ANOTHER_ENUM_RESPONSE( + object); + g_clear_pointer(&self->error, fl_value_unref); + g_clear_pointer(&self->return_value, fl_value_unref); + G_OBJECT_CLASS( + core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_response_parent_class) + ->dispose(object); +} + +static void +core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_response_init( + CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherEnumResponse* self) { +} + +static void +core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_response_class_init( + CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherEnumResponseClass* + klass) { + G_OBJECT_CLASS(klass)->dispose = + core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_response_dispose; +} + +static CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherEnumResponse* +core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_response_new( + FlValue* response) { + CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherEnumResponse* self = + CORE_TESTS_PIGEON_TEST_FLUTTER_INTEGRATION_CORE_API_ECHO_ANOTHER_ENUM_RESPONSE( + g_object_new( + core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_response_get_type(), + nullptr)); + if (fl_value_get_length(response) > 1) { + self->error = fl_value_ref(response); + } else { + FlValue* value = fl_value_get_list_value(response, 0); + self->return_value = fl_value_ref(value); + } + return self; +} + +gboolean +core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_response_is_error( + CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherEnumResponse* self) { + g_return_val_if_fail( + CORE_TESTS_PIGEON_TEST_IS_FLUTTER_INTEGRATION_CORE_API_ECHO_ANOTHER_ENUM_RESPONSE( + self), + FALSE); + return self->error != nullptr; +} + +const gchar* +core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_response_get_error_code( + CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherEnumResponse* self) { + g_return_val_if_fail( + CORE_TESTS_PIGEON_TEST_IS_FLUTTER_INTEGRATION_CORE_API_ECHO_ANOTHER_ENUM_RESPONSE( + self), + nullptr); + g_assert( + core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_response_is_error( + self)); + return fl_value_get_string(fl_value_get_list_value(self->error, 0)); +} + +const gchar* +core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_response_get_error_message( + CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherEnumResponse* self) { + g_return_val_if_fail( + CORE_TESTS_PIGEON_TEST_IS_FLUTTER_INTEGRATION_CORE_API_ECHO_ANOTHER_ENUM_RESPONSE( + self), + nullptr); + g_assert( + core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_response_is_error( + self)); + return fl_value_get_string(fl_value_get_list_value(self->error, 1)); +} + +FlValue* +core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_response_get_error_details( + CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherEnumResponse* self) { + g_return_val_if_fail( + CORE_TESTS_PIGEON_TEST_IS_FLUTTER_INTEGRATION_CORE_API_ECHO_ANOTHER_ENUM_RESPONSE( + self), + nullptr); + g_assert( + core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_response_is_error( + self)); + return fl_value_get_list_value(self->error, 2); +} + +CoreTestsPigeonTestAnotherEnum +core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_response_get_return_value( + CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherEnumResponse* self) { + g_return_val_if_fail( + CORE_TESTS_PIGEON_TEST_IS_FLUTTER_INTEGRATION_CORE_API_ECHO_ANOTHER_ENUM_RESPONSE( + self), + static_cast(0)); + g_assert( + !core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_response_is_error( + self)); + return static_cast( + fl_value_get_int(reinterpret_cast(const_cast( + fl_value_get_custom_value(self->return_value))))); +} + +static void +core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_cb( + GObject* object, GAsyncResult* result, gpointer user_data) { + GTask* task = G_TASK(user_data); + g_task_return_pointer(task, result, g_object_unref); +} + +void core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum( + CoreTestsPigeonTestFlutterIntegrationCoreApi* self, + CoreTestsPigeonTestAnotherEnum another_enum, GCancellable* cancellable, + GAsyncReadyCallback callback, gpointer user_data) { + g_autoptr(FlValue) args = fl_value_new_list(); + fl_value_append_take(args, + fl_value_new_custom(130, fl_value_new_int(another_enum), + (GDestroyNotify)fl_value_unref)); + g_autofree gchar* channel_name = g_strdup_printf( + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi." + "echoAnotherEnum%s", + self->suffix); + g_autoptr(CoreTestsPigeonTestMessageCodec) codec = + core_tests_pigeon_test_message_codec_new(); + FlBasicMessageChannel* channel = fl_basic_message_channel_new( + self->messenger, channel_name, FL_MESSAGE_CODEC(codec)); + GTask* task = g_task_new(self, cancellable, callback, user_data); + g_task_set_task_data(task, channel, g_object_unref); + fl_basic_message_channel_send( + channel, args, cancellable, + core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_cb, + task); +} + +CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherEnumResponse* +core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_finish( + CoreTestsPigeonTestFlutterIntegrationCoreApi* self, GAsyncResult* result, + GError** error) { + g_autoptr(GTask) task = G_TASK(result); + GAsyncResult* r = G_ASYNC_RESULT(g_task_propagate_pointer(task, nullptr)); + FlBasicMessageChannel* channel = + FL_BASIC_MESSAGE_CHANNEL(g_task_get_task_data(task)); + g_autoptr(FlValue) response = + fl_basic_message_channel_send_finish(channel, r, error); + if (response == nullptr) { + return nullptr; + } + return core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_response_new( + response); +} + struct _CoreTestsPigeonTestFlutterIntegrationCoreApiEchoNullableBoolResponse { GObject parent_instance; @@ -17885,7 +19063,7 @@ void core_tests_pigeon_test_flutter_integration_core_api_echo_nullable_enum( g_autoptr(FlValue) args = fl_value_new_list(); fl_value_append_take( args, an_enum != nullptr - ? fl_value_new_custom(134, fl_value_new_int(*an_enum), + ? fl_value_new_custom(129, fl_value_new_int(*an_enum), (GDestroyNotify)fl_value_unref) : fl_value_new_null()); g_autofree gchar* channel_name = g_strdup_printf( @@ -17921,6 +19099,186 @@ core_tests_pigeon_test_flutter_integration_core_api_echo_nullable_enum_finish( response); } +struct + _CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherNullableEnumResponse { + GObject parent_instance; + + FlValue* error; + FlValue* return_value; + CoreTestsPigeonTestAnotherEnum return_value_; +}; + +G_DEFINE_TYPE( + CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherNullableEnumResponse, + core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_response, + G_TYPE_OBJECT) + +static void +core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_response_dispose( + GObject* object) { + CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherNullableEnumResponse* self = + CORE_TESTS_PIGEON_TEST_FLUTTER_INTEGRATION_CORE_API_ECHO_ANOTHER_NULLABLE_ENUM_RESPONSE( + object); + g_clear_pointer(&self->error, fl_value_unref); + g_clear_pointer(&self->return_value, fl_value_unref); + G_OBJECT_CLASS( + core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_response_parent_class) + ->dispose(object); +} + +static void +core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_response_init( + CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherNullableEnumResponse* + self) {} + +static void +core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_response_class_init( + CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherNullableEnumResponseClass* + klass) { + G_OBJECT_CLASS(klass)->dispose = + core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_response_dispose; +} + +static CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherNullableEnumResponse* +core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_response_new( + FlValue* response) { + CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherNullableEnumResponse* self = + CORE_TESTS_PIGEON_TEST_FLUTTER_INTEGRATION_CORE_API_ECHO_ANOTHER_NULLABLE_ENUM_RESPONSE( + g_object_new( + core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_response_get_type(), + nullptr)); + if (fl_value_get_length(response) > 1) { + self->error = fl_value_ref(response); + } else { + FlValue* value = fl_value_get_list_value(response, 0); + self->return_value = fl_value_ref(value); + } + return self; +} + +gboolean +core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_response_is_error( + CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherNullableEnumResponse* + self) { + g_return_val_if_fail( + CORE_TESTS_PIGEON_TEST_IS_FLUTTER_INTEGRATION_CORE_API_ECHO_ANOTHER_NULLABLE_ENUM_RESPONSE( + self), + FALSE); + return self->error != nullptr; +} + +const gchar* +core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_response_get_error_code( + CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherNullableEnumResponse* + self) { + g_return_val_if_fail( + CORE_TESTS_PIGEON_TEST_IS_FLUTTER_INTEGRATION_CORE_API_ECHO_ANOTHER_NULLABLE_ENUM_RESPONSE( + self), + nullptr); + g_assert( + core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_response_is_error( + self)); + return fl_value_get_string(fl_value_get_list_value(self->error, 0)); +} + +const gchar* +core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_response_get_error_message( + CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherNullableEnumResponse* + self) { + g_return_val_if_fail( + CORE_TESTS_PIGEON_TEST_IS_FLUTTER_INTEGRATION_CORE_API_ECHO_ANOTHER_NULLABLE_ENUM_RESPONSE( + self), + nullptr); + g_assert( + core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_response_is_error( + self)); + return fl_value_get_string(fl_value_get_list_value(self->error, 1)); +} + +FlValue* +core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_response_get_error_details( + CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherNullableEnumResponse* + self) { + g_return_val_if_fail( + CORE_TESTS_PIGEON_TEST_IS_FLUTTER_INTEGRATION_CORE_API_ECHO_ANOTHER_NULLABLE_ENUM_RESPONSE( + self), + nullptr); + g_assert( + core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_response_is_error( + self)); + return fl_value_get_list_value(self->error, 2); +} + +CoreTestsPigeonTestAnotherEnum* +core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_response_get_return_value( + CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherNullableEnumResponse* + self) { + g_return_val_if_fail( + CORE_TESTS_PIGEON_TEST_IS_FLUTTER_INTEGRATION_CORE_API_ECHO_ANOTHER_NULLABLE_ENUM_RESPONSE( + self), + nullptr); + g_assert( + !core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_response_is_error( + self)); + if (fl_value_get_type(self->return_value) == FL_VALUE_TYPE_NULL) { + return nullptr; + } + self->return_value_ = static_cast( + fl_value_get_int(reinterpret_cast(const_cast( + fl_value_get_custom_value(self->return_value))))); + return &self->return_value_; +} + +static void +core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_cb( + GObject* object, GAsyncResult* result, gpointer user_data) { + GTask* task = G_TASK(user_data); + g_task_return_pointer(task, result, g_object_unref); +} + +void core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum( + CoreTestsPigeonTestFlutterIntegrationCoreApi* self, + CoreTestsPigeonTestAnotherEnum* another_enum, GCancellable* cancellable, + GAsyncReadyCallback callback, gpointer user_data) { + g_autoptr(FlValue) args = fl_value_new_list(); + fl_value_append_take( + args, another_enum != nullptr + ? fl_value_new_custom(130, fl_value_new_int(*another_enum), + (GDestroyNotify)fl_value_unref) + : fl_value_new_null()); + g_autofree gchar* channel_name = g_strdup_printf( + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi." + "echoAnotherNullableEnum%s", + self->suffix); + g_autoptr(CoreTestsPigeonTestMessageCodec) codec = + core_tests_pigeon_test_message_codec_new(); + FlBasicMessageChannel* channel = fl_basic_message_channel_new( + self->messenger, channel_name, FL_MESSAGE_CODEC(codec)); + GTask* task = g_task_new(self, cancellable, callback, user_data); + g_task_set_task_data(task, channel, g_object_unref); + fl_basic_message_channel_send( + channel, args, cancellable, + core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_cb, + task); +} + +CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherNullableEnumResponse* +core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_finish( + CoreTestsPigeonTestFlutterIntegrationCoreApi* self, GAsyncResult* result, + GError** error) { + g_autoptr(GTask) task = G_TASK(result); + GAsyncResult* r = G_ASYNC_RESULT(g_task_propagate_pointer(task, nullptr)); + FlBasicMessageChannel* channel = + FL_BASIC_MESSAGE_CHANNEL(g_task_get_task_data(task)); + g_autoptr(FlValue) response = + fl_basic_message_channel_send_finish(channel, r, error); + if (response == nullptr) { + return nullptr; + } + return core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_response_new( + response); +} + struct _CoreTestsPigeonTestFlutterIntegrationCoreApiNoopAsyncResponse { GObject parent_instance; @@ -18918,7 +20276,7 @@ void core_tests_pigeon_test_flutter_small_api_echo_wrapped_list( CoreTestsPigeonTestTestMessage* msg, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data) { g_autoptr(FlValue) args = fl_value_new_list(); - fl_value_append_take(args, fl_value_new_custom_object(133, G_OBJECT(msg))); + fl_value_append_take(args, fl_value_new_custom_object(135, G_OBJECT(msg))); g_autofree gchar* channel_name = g_strdup_printf( "dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi." "echoWrappedList%s", diff --git a/packages/pigeon/platform_tests/test_plugin/linux/pigeon/core_tests.gen.h b/packages/pigeon/platform_tests/test_plugin/linux/pigeon/core_tests.gen.h index 086101d4b62..e6e2219c1a6 100644 --- a/packages/pigeon/platform_tests/test_plugin/linux/pigeon/core_tests.gen.h +++ b/packages/pigeon/platform_tests/test_plugin/linux/pigeon/core_tests.gen.h @@ -29,6 +29,15 @@ typedef enum { PIGEON_INTEGRATION_TESTS_AN_ENUM_FOUR_HUNDRED_TWENTY_TWO = 4 } CoreTestsPigeonTestAnEnum; +/** + * CoreTestsPigeonTestAnotherEnum: + * PIGEON_INTEGRATION_TESTS_ANOTHER_ENUM_JUST_IN_CASE: + * + */ +typedef enum { + PIGEON_INTEGRATION_TESTS_ANOTHER_ENUM_JUST_IN_CASE = 0 +} CoreTestsPigeonTestAnotherEnum; + /** * CoreTestsPigeonTestAllTypes: * @@ -54,6 +63,7 @@ G_DECLARE_FINAL_TYPE(CoreTestsPigeonTestAllTypes, * a_float_array: field in this object. * a_float_array_length: length of @a_float_array. * an_enum: field in this object. + * another_enum: field in this object. * a_string: field in this object. * an_object: field in this object. * list: field in this object. @@ -73,7 +83,8 @@ CoreTestsPigeonTestAllTypes* core_tests_pigeon_test_all_types_new( const int32_t* a4_byte_array, size_t a4_byte_array_length, const int64_t* a8_byte_array, size_t a8_byte_array_length, const double* a_float_array, size_t a_float_array_length, - CoreTestsPigeonTestAnEnum an_enum, const gchar* a_string, + CoreTestsPigeonTestAnEnum an_enum, + CoreTestsPigeonTestAnotherEnum another_enum, const gchar* a_string, FlValue* an_object, FlValue* list, FlValue* string_list, FlValue* int_list, FlValue* double_list, FlValue* bool_list, FlValue* map); @@ -180,6 +191,18 @@ const double* core_tests_pigeon_test_all_types_get_a_float_array( CoreTestsPigeonTestAnEnum core_tests_pigeon_test_all_types_get_an_enum( CoreTestsPigeonTestAllTypes* object); +/** + * core_tests_pigeon_test_all_types_get_another_enum + * @object: a #CoreTestsPigeonTestAllTypes. + * + * Gets the value of the anotherEnum field of @object. + * + * Returns: the field value. + */ +CoreTestsPigeonTestAnotherEnum +core_tests_pigeon_test_all_types_get_another_enum( + CoreTestsPigeonTestAllTypes* object); + /** * core_tests_pigeon_test_all_types_get_a_string * @object: a #CoreTestsPigeonTestAllTypes. @@ -296,6 +319,7 @@ G_DECLARE_FINAL_TYPE(CoreTestsPigeonTestAllNullableTypes, * nullable_map_with_annotations: field in this object. * nullable_map_with_object: field in this object. * a_nullable_enum: field in this object. + * another_nullable_enum: field in this object. * a_nullable_string: field in this object. * a_nullable_object: field in this object. * all_nullable_types: field in this object. @@ -321,8 +345,9 @@ core_tests_pigeon_test_all_nullable_types_new( const double* a_nullable_float_array, size_t a_nullable_float_array_length, FlValue* nullable_nested_list, FlValue* nullable_map_with_annotations, FlValue* nullable_map_with_object, - CoreTestsPigeonTestAnEnum* a_nullable_enum, const gchar* a_nullable_string, - FlValue* a_nullable_object, + CoreTestsPigeonTestAnEnum* a_nullable_enum, + CoreTestsPigeonTestAnotherEnum* another_nullable_enum, + const gchar* a_nullable_string, FlValue* a_nullable_object, CoreTestsPigeonTestAllNullableTypes* all_nullable_types, FlValue* list, FlValue* string_list, FlValue* int_list, FlValue* double_list, FlValue* bool_list, FlValue* nested_class_list, FlValue* map); @@ -469,6 +494,18 @@ CoreTestsPigeonTestAnEnum* core_tests_pigeon_test_all_nullable_types_get_a_nullable_enum( CoreTestsPigeonTestAllNullableTypes* object); +/** + * core_tests_pigeon_test_all_nullable_types_get_another_nullable_enum + * @object: a #CoreTestsPigeonTestAllNullableTypes. + * + * Gets the value of the anotherNullableEnum field of @object. + * + * Returns: the field value. + */ +CoreTestsPigeonTestAnotherEnum* +core_tests_pigeon_test_all_nullable_types_get_another_nullable_enum( + CoreTestsPigeonTestAllNullableTypes* object); + /** * core_tests_pigeon_test_all_nullable_types_get_a_nullable_string * @object: a #CoreTestsPigeonTestAllNullableTypes. @@ -611,6 +648,7 @@ G_DECLARE_FINAL_TYPE( * nullable_map_with_annotations: field in this object. * nullable_map_with_object: field in this object. * a_nullable_enum: field in this object. + * another_nullable_enum: field in this object. * a_nullable_string: field in this object. * a_nullable_object: field in this object. * list: field in this object. @@ -634,9 +672,11 @@ core_tests_pigeon_test_all_nullable_types_without_recursion_new( const double* a_nullable_float_array, size_t a_nullable_float_array_length, FlValue* nullable_nested_list, FlValue* nullable_map_with_annotations, FlValue* nullable_map_with_object, - CoreTestsPigeonTestAnEnum* a_nullable_enum, const gchar* a_nullable_string, - FlValue* a_nullable_object, FlValue* list, FlValue* string_list, - FlValue* int_list, FlValue* double_list, FlValue* bool_list, FlValue* map); + CoreTestsPigeonTestAnEnum* a_nullable_enum, + CoreTestsPigeonTestAnotherEnum* another_nullable_enum, + const gchar* a_nullable_string, FlValue* a_nullable_object, FlValue* list, + FlValue* string_list, FlValue* int_list, FlValue* double_list, + FlValue* bool_list, FlValue* map); /** * core_tests_pigeon_test_all_nullable_types_without_recursion_get_a_nullable_bool @@ -790,6 +830,18 @@ CoreTestsPigeonTestAnEnum* core_tests_pigeon_test_all_nullable_types_without_recursion_get_a_nullable_enum( CoreTestsPigeonTestAllNullableTypesWithoutRecursion* object); +/** + * core_tests_pigeon_test_all_nullable_types_without_recursion_get_another_nullable_enum + * @object: a #CoreTestsPigeonTestAllNullableTypesWithoutRecursion. + * + * Gets the value of the anotherNullableEnum field of @object. + * + * Returns: the field value. + */ +CoreTestsPigeonTestAnotherEnum* +core_tests_pigeon_test_all_nullable_types_without_recursion_get_another_nullable_enum( + CoreTestsPigeonTestAllNullableTypesWithoutRecursion* object); + /** * core_tests_pigeon_test_all_nullable_types_without_recursion_get_a_nullable_string * @object: a #CoreTestsPigeonTestAllNullableTypesWithoutRecursion. @@ -1458,6 +1510,39 @@ CoreTestsPigeonTestHostIntegrationCoreApiEchoEnumResponse* core_tests_pigeon_test_host_integration_core_api_echo_enum_response_new_error( const gchar* code, const gchar* message, FlValue* details); +G_DECLARE_FINAL_TYPE( + CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherEnumResponse, + core_tests_pigeon_test_host_integration_core_api_echo_another_enum_response, + CORE_TESTS_PIGEON_TEST, + HOST_INTEGRATION_CORE_API_ECHO_ANOTHER_ENUM_RESPONSE, GObject) + +/** + * core_tests_pigeon_test_host_integration_core_api_echo_another_enum_response_new: + * + * Creates a new response to HostIntegrationCoreApi.echoAnotherEnum. + * + * Returns: a new + * #CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherEnumResponse + */ +CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherEnumResponse* +core_tests_pigeon_test_host_integration_core_api_echo_another_enum_response_new( + CoreTestsPigeonTestAnotherEnum return_value); + +/** + * core_tests_pigeon_test_host_integration_core_api_echo_another_enum_response_new_error: + * @code: error code. + * @message: error message. + * @details: (allow-none): error details or %NULL. + * + * Creates a new error response to HostIntegrationCoreApi.echoAnotherEnum. + * + * Returns: a new + * #CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherEnumResponse + */ +CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherEnumResponse* +core_tests_pigeon_test_host_integration_core_api_echo_another_enum_response_new_error( + const gchar* code, const gchar* message, FlValue* details); + G_DECLARE_FINAL_TYPE( CoreTestsPigeonTestHostIntegrationCoreApiEchoNamedDefaultStringResponse, core_tests_pigeon_test_host_integration_core_api_echo_named_default_string_response, @@ -2063,6 +2148,40 @@ CoreTestsPigeonTestHostIntegrationCoreApiEchoNullableEnumResponse* core_tests_pigeon_test_host_integration_core_api_echo_nullable_enum_response_new_error( const gchar* code, const gchar* message, FlValue* details); +G_DECLARE_FINAL_TYPE( + CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherNullableEnumResponse, + core_tests_pigeon_test_host_integration_core_api_echo_another_nullable_enum_response, + CORE_TESTS_PIGEON_TEST, + HOST_INTEGRATION_CORE_API_ECHO_ANOTHER_NULLABLE_ENUM_RESPONSE, GObject) + +/** + * core_tests_pigeon_test_host_integration_core_api_echo_another_nullable_enum_response_new: + * + * Creates a new response to HostIntegrationCoreApi.echoAnotherNullableEnum. + * + * Returns: a new + * #CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherNullableEnumResponse + */ +CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherNullableEnumResponse* +core_tests_pigeon_test_host_integration_core_api_echo_another_nullable_enum_response_new( + CoreTestsPigeonTestAnotherEnum* return_value); + +/** + * core_tests_pigeon_test_host_integration_core_api_echo_another_nullable_enum_response_new_error: + * @code: error code. + * @message: error message. + * @details: (allow-none): error details or %NULL. + * + * Creates a new error response to + * HostIntegrationCoreApi.echoAnotherNullableEnum. + * + * Returns: a new + * #CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherNullableEnumResponse + */ +CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherNullableEnumResponse* +core_tests_pigeon_test_host_integration_core_api_echo_another_nullable_enum_response_new_error( + const gchar* code, const gchar* message, FlValue* details); + G_DECLARE_FINAL_TYPE( CoreTestsPigeonTestHostIntegrationCoreApiEchoOptionalNullableIntResponse, core_tests_pigeon_test_host_integration_core_api_echo_optional_nullable_int_response, @@ -2171,6 +2290,9 @@ typedef struct { gpointer user_data); CoreTestsPigeonTestHostIntegrationCoreApiEchoEnumResponse* (*echo_enum)( CoreTestsPigeonTestAnEnum an_enum, gpointer user_data); + CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherEnumResponse* ( + *echo_another_enum)(CoreTestsPigeonTestAnotherEnum another_enum, + gpointer user_data); CoreTestsPigeonTestHostIntegrationCoreApiEchoNamedDefaultStringResponse* ( *echo_named_default_string)(const gchar* a_string, gpointer user_data); CoreTestsPigeonTestHostIntegrationCoreApiEchoOptionalDefaultDoubleResponse* ( @@ -2221,6 +2343,9 @@ typedef struct { CoreTestsPigeonTestHostIntegrationCoreApiEchoNullableEnumResponse* ( *echo_nullable_enum)(CoreTestsPigeonTestAnEnum* an_enum, gpointer user_data); + CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherNullableEnumResponse* ( + *echo_another_nullable_enum)(CoreTestsPigeonTestAnotherEnum* another_enum, + gpointer user_data); CoreTestsPigeonTestHostIntegrationCoreApiEchoOptionalNullableIntResponse* ( *echo_optional_nullable_int)(int64_t* a_nullable_int, gpointer user_data); CoreTestsPigeonTestHostIntegrationCoreApiEchoNamedNullableStringResponse* ( @@ -2265,6 +2390,10 @@ typedef struct { CoreTestsPigeonTestAnEnum an_enum, CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, gpointer user_data); + void (*echo_another_async_enum)( + CoreTestsPigeonTestAnotherEnum another_enum, + CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, + gpointer user_data); void (*throw_async_error)( CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, gpointer user_data); @@ -2322,6 +2451,10 @@ typedef struct { CoreTestsPigeonTestAnEnum* an_enum, CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, gpointer user_data); + void (*echo_another_async_nullable_enum)( + CoreTestsPigeonTestAnotherEnum* another_enum, + CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, + gpointer user_data); void (*call_flutter_noop)( CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, gpointer user_data); @@ -2385,6 +2518,10 @@ typedef struct { CoreTestsPigeonTestAnEnum an_enum, CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, gpointer user_data); + void (*call_flutter_echo_another_enum)( + CoreTestsPigeonTestAnotherEnum another_enum, + CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, + gpointer user_data); void (*call_flutter_echo_nullable_bool)( gboolean* a_bool, CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, @@ -2417,6 +2554,10 @@ typedef struct { CoreTestsPigeonTestAnEnum* an_enum, CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, gpointer user_data); + void (*call_flutter_echo_another_nullable_enum)( + CoreTestsPigeonTestAnotherEnum* another_enum, + CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, + gpointer user_data); void (*call_flutter_small_api_echo_string)( const gchar* a_string, CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, @@ -2691,6 +2832,30 @@ void core_tests_pigeon_test_host_integration_core_api_respond_error_echo_async_e CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); +/** + * core_tests_pigeon_test_host_integration_core_api_respond_echo_another_async_enum: + * @response_handle: a #CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle. + * @return_value: location to write the value returned by this method. + * + * Responds to HostIntegrationCoreApi.echoAnotherAsyncEnum. + */ +void core_tests_pigeon_test_host_integration_core_api_respond_echo_another_async_enum( + CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, + CoreTestsPigeonTestAnotherEnum return_value); + +/** + * core_tests_pigeon_test_host_integration_core_api_respond_error_echo_another_async_enum: + * @response_handle: a #CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle. + * @code: error code. + * @message: error message. + * @details: (allow-none): error details or %NULL. + * + * Responds with an error to HostIntegrationCoreApi.echoAnotherAsyncEnum. + */ +void core_tests_pigeon_test_host_integration_core_api_respond_error_echo_another_async_enum( + CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, + const gchar* code, const gchar* message, FlValue* details); + /** * core_tests_pigeon_test_host_integration_core_api_respond_throw_async_error: * @response_handle: a #CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle. @@ -3054,6 +3219,31 @@ void core_tests_pigeon_test_host_integration_core_api_respond_error_echo_async_n CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); +/** + * core_tests_pigeon_test_host_integration_core_api_respond_echo_another_async_nullable_enum: + * @response_handle: a #CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle. + * @return_value: location to write the value returned by this method. + * + * Responds to HostIntegrationCoreApi.echoAnotherAsyncNullableEnum. + */ +void core_tests_pigeon_test_host_integration_core_api_respond_echo_another_async_nullable_enum( + CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, + CoreTestsPigeonTestAnotherEnum* return_value); + +/** + * core_tests_pigeon_test_host_integration_core_api_respond_error_echo_another_async_nullable_enum: + * @response_handle: a #CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle. + * @code: error code. + * @message: error message. + * @details: (allow-none): error details or %NULL. + * + * Responds with an error to + * HostIntegrationCoreApi.echoAnotherAsyncNullableEnum. + */ +void core_tests_pigeon_test_host_integration_core_api_respond_error_echo_another_async_nullable_enum( + CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, + const gchar* code, const gchar* message, FlValue* details); + /** * core_tests_pigeon_test_host_integration_core_api_respond_call_flutter_noop: * @response_handle: a #CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle. @@ -3443,6 +3633,30 @@ void core_tests_pigeon_test_host_integration_core_api_respond_error_call_flutter CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); +/** + * core_tests_pigeon_test_host_integration_core_api_respond_call_flutter_echo_another_enum: + * @response_handle: a #CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle. + * @return_value: location to write the value returned by this method. + * + * Responds to HostIntegrationCoreApi.callFlutterEchoAnotherEnum. + */ +void core_tests_pigeon_test_host_integration_core_api_respond_call_flutter_echo_another_enum( + CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, + CoreTestsPigeonTestAnotherEnum return_value); + +/** + * core_tests_pigeon_test_host_integration_core_api_respond_error_call_flutter_echo_another_enum: + * @response_handle: a #CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle. + * @code: error code. + * @message: error message. + * @details: (allow-none): error details or %NULL. + * + * Responds with an error to HostIntegrationCoreApi.callFlutterEchoAnotherEnum. + */ +void core_tests_pigeon_test_host_integration_core_api_respond_error_call_flutter_echo_another_enum( + CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, + const gchar* code, const gchar* message, FlValue* details); + /** * core_tests_pigeon_test_host_integration_core_api_respond_call_flutter_echo_nullable_bool: * @response_handle: a #CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle. @@ -3640,6 +3854,31 @@ void core_tests_pigeon_test_host_integration_core_api_respond_error_call_flutter CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); +/** + * core_tests_pigeon_test_host_integration_core_api_respond_call_flutter_echo_another_nullable_enum: + * @response_handle: a #CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle. + * @return_value: location to write the value returned by this method. + * + * Responds to HostIntegrationCoreApi.callFlutterEchoAnotherNullableEnum. + */ +void core_tests_pigeon_test_host_integration_core_api_respond_call_flutter_echo_another_nullable_enum( + CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, + CoreTestsPigeonTestAnotherEnum* return_value); + +/** + * core_tests_pigeon_test_host_integration_core_api_respond_error_call_flutter_echo_another_nullable_enum: + * @response_handle: a #CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle. + * @code: error code. + * @message: error message. + * @details: (allow-none): error details or %NULL. + * + * Responds with an error to + * HostIntegrationCoreApi.callFlutterEchoAnotherNullableEnum. + */ +void core_tests_pigeon_test_host_integration_core_api_respond_error_call_flutter_echo_another_nullable_enum( + CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, + const gchar* code, const gchar* message, FlValue* details); + /** * core_tests_pigeon_test_host_integration_core_api_respond_call_flutter_small_api_echo_string: * @response_handle: a #CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle. @@ -4769,6 +5008,83 @@ CoreTestsPigeonTestAnEnum core_tests_pigeon_test_flutter_integration_core_api_echo_enum_response_get_return_value( CoreTestsPigeonTestFlutterIntegrationCoreApiEchoEnumResponse* response); +G_DECLARE_FINAL_TYPE( + CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherEnumResponse, + core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_response, + CORE_TESTS_PIGEON_TEST, + FLUTTER_INTEGRATION_CORE_API_ECHO_ANOTHER_ENUM_RESPONSE, GObject) + +/** + * core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_response_is_error: + * @response: a + * #CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherEnumResponse. + * + * Checks if a response to FlutterIntegrationCoreApi.echoAnotherEnum is an + * error. + * + * Returns: a %TRUE if this response is an error. + */ +gboolean +core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_response_is_error( + CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherEnumResponse* + response); + +/** + * core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_response_get_error_code: + * @response: a + * #CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherEnumResponse. + * + * Get the error code for this response. + * + * Returns: an error code or %NULL if not an error. + */ +const gchar* +core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_response_get_error_code( + CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherEnumResponse* + response); + +/** + * core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_response_get_error_message: + * @response: a + * #CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherEnumResponse. + * + * Get the error message for this response. + * + * Returns: an error message. + */ +const gchar* +core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_response_get_error_message( + CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherEnumResponse* + response); + +/** + * core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_response_get_error_details: + * @response: a + * #CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherEnumResponse. + * + * Get the error details for this response. + * + * Returns: (allow-none): an error details or %NULL. + */ +FlValue* +core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_response_get_error_details( + CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherEnumResponse* + response); + +/** + * core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_response_get_return_value: + * @response: a + * #CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherEnumResponse. + * + * Get the return value for this response. + * + * Returns: a return value. + */ +CoreTestsPigeonTestAnotherEnum +core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_response_get_return_value( + CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherEnumResponse* + response); + G_DECLARE_FINAL_TYPE( CoreTestsPigeonTestFlutterIntegrationCoreApiEchoNullableBoolResponse, core_tests_pigeon_test_flutter_integration_core_api_echo_nullable_bool_response, @@ -5388,6 +5704,83 @@ core_tests_pigeon_test_flutter_integration_core_api_echo_nullable_enum_response_ CoreTestsPigeonTestFlutterIntegrationCoreApiEchoNullableEnumResponse* response); +G_DECLARE_FINAL_TYPE( + CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherNullableEnumResponse, + core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_response, + CORE_TESTS_PIGEON_TEST, + FLUTTER_INTEGRATION_CORE_API_ECHO_ANOTHER_NULLABLE_ENUM_RESPONSE, GObject) + +/** + * core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_response_is_error: + * @response: a + * #CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherNullableEnumResponse. + * + * Checks if a response to FlutterIntegrationCoreApi.echoAnotherNullableEnum is + * an error. + * + * Returns: a %TRUE if this response is an error. + */ +gboolean +core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_response_is_error( + CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherNullableEnumResponse* + response); + +/** + * core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_response_get_error_code: + * @response: a + * #CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherNullableEnumResponse. + * + * Get the error code for this response. + * + * Returns: an error code or %NULL if not an error. + */ +const gchar* +core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_response_get_error_code( + CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherNullableEnumResponse* + response); + +/** + * core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_response_get_error_message: + * @response: a + * #CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherNullableEnumResponse. + * + * Get the error message for this response. + * + * Returns: an error message. + */ +const gchar* +core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_response_get_error_message( + CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherNullableEnumResponse* + response); + +/** + * core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_response_get_error_details: + * @response: a + * #CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherNullableEnumResponse. + * + * Get the error details for this response. + * + * Returns: (allow-none): an error details or %NULL. + */ +FlValue* +core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_response_get_error_details( + CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherNullableEnumResponse* + response); + +/** + * core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_response_get_return_value: + * @response: a + * #CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherNullableEnumResponse. + * + * Get the return value for this response. + * + * Returns: (allow-none): a return value or %NULL. + */ +CoreTestsPigeonTestAnotherEnum* +core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_response_get_return_value( + CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherNullableEnumResponse* + response); + G_DECLARE_FINAL_TYPE( CoreTestsPigeonTestFlutterIntegrationCoreApiNoopAsyncResponse, core_tests_pigeon_test_flutter_integration_core_api_noop_async_response, @@ -6107,6 +6500,41 @@ core_tests_pigeon_test_flutter_integration_core_api_echo_enum_finish( CoreTestsPigeonTestFlutterIntegrationCoreApi* api, GAsyncResult* result, GError** error); +/** + * core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum: + * @api: a #CoreTestsPigeonTestFlutterIntegrationCoreApi. + * @another_enum: parameter for this method. + * @cancellable: (allow-none): a #GCancellable or %NULL. + * @callback: (scope async): (allow-none): a #GAsyncReadyCallback to call when + * the call is complete or %NULL to ignore the response. + * @user_data: (closure): user data to pass to @callback. + * + * Returns the passed enum to test serialization and deserialization. + */ +void core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum( + CoreTestsPigeonTestFlutterIntegrationCoreApi* api, + CoreTestsPigeonTestAnotherEnum another_enum, GCancellable* cancellable, + GAsyncReadyCallback callback, gpointer user_data); + +/** + * core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_finish: + * @api: a #CoreTestsPigeonTestFlutterIntegrationCoreApi. + * @result: a #GAsyncResult. + * @error: (allow-none): #GError location to store the error occurring, or %NULL + * to ignore. + * + * Completes a + * core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum() call. + * + * Returns: a + * #CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherEnumResponse or %NULL + * on error. + */ +CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherEnumResponse* +core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_finish( + CoreTestsPigeonTestFlutterIntegrationCoreApi* api, GAsyncResult* result, + GError** error); + /** * core_tests_pigeon_test_flutter_integration_core_api_echo_nullable_bool: * @api: a #CoreTestsPigeonTestFlutterIntegrationCoreApi. @@ -6394,6 +6822,42 @@ core_tests_pigeon_test_flutter_integration_core_api_echo_nullable_enum_finish( CoreTestsPigeonTestFlutterIntegrationCoreApi* api, GAsyncResult* result, GError** error); +/** + * core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum: + * @api: a #CoreTestsPigeonTestFlutterIntegrationCoreApi. + * @another_enum: (allow-none): parameter for this method. + * @cancellable: (allow-none): a #GCancellable or %NULL. + * @callback: (scope async): (allow-none): a #GAsyncReadyCallback to call when + * the call is complete or %NULL to ignore the response. + * @user_data: (closure): user data to pass to @callback. + * + * Returns the passed enum to test serialization and deserialization. + */ +void core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum( + CoreTestsPigeonTestFlutterIntegrationCoreApi* api, + CoreTestsPigeonTestAnotherEnum* another_enum, GCancellable* cancellable, + GAsyncReadyCallback callback, gpointer user_data); + +/** + * core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_finish: + * @api: a #CoreTestsPigeonTestFlutterIntegrationCoreApi. + * @result: a #GAsyncResult. + * @error: (allow-none): #GError location to store the error occurring, or %NULL + * to ignore. + * + * Completes a + * core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum() + * call. + * + * Returns: a + * #CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherNullableEnumResponse + * or %NULL on error. + */ +CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherNullableEnumResponse* +core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_finish( + CoreTestsPigeonTestFlutterIntegrationCoreApi* api, GAsyncResult* result, + GError** error); + /** * core_tests_pigeon_test_flutter_integration_core_api_noop_async: * @api: a #CoreTestsPigeonTestFlutterIntegrationCoreApi. diff --git a/packages/pigeon/platform_tests/test_plugin/linux/test_plugin.cc b/packages/pigeon/platform_tests/test_plugin/linux/test_plugin.cc index 98d0dce9593..3c4689442dc 100644 --- a/packages/pigeon/platform_tests/test_plugin/linux/test_plugin.cc +++ b/packages/pigeon/platform_tests/test_plugin/linux/test_plugin.cc @@ -145,6 +145,14 @@ static CoreTestsPigeonTestHostIntegrationCoreApiEchoEnumResponse* echo_enum( an_enum); } +static CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherEnumResponse* +echo_another_enum( + + CoreTestsPigeonTestAnotherEnum another_enum, gpointer user_data) { + return core_tests_pigeon_test_host_integration_core_api_echo_another_enum_response_new( + another_enum); +} + static CoreTestsPigeonTestHostIntegrationCoreApiEchoNamedDefaultStringResponse* echo_named_default_string(const gchar* a_string, gpointer user_data) { return core_tests_pigeon_test_host_integration_core_api_echo_named_default_string_response_new( @@ -195,9 +203,9 @@ create_nested_nullable_string(const gchar* nullable_string, g_autoptr(CoreTestsPigeonTestAllNullableTypes) types = core_tests_pigeon_test_all_nullable_types_new( nullptr, nullptr, nullptr, nullptr, nullptr, 0, nullptr, 0, nullptr, - 0, nullptr, 0, nullptr, nullptr, nullptr, nullptr, nullable_string, - nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, - nullptr, nullptr); + 0, nullptr, 0, nullptr, nullptr, nullptr, nullptr, nullptr, + nullable_string, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, + nullptr, nullptr, nullptr); g_autoptr(CoreTestsPigeonTestAllClassesWrapper) wrapper = core_tests_pigeon_test_all_classes_wrapper_new(types, nullptr, nullptr); return core_tests_pigeon_test_host_integration_core_api_create_nested_nullable_string_response_new( @@ -212,8 +220,8 @@ send_multiple_nullable_types(gboolean* a_nullable_bool, int64_t* a_nullable_int, core_tests_pigeon_test_all_nullable_types_new( a_nullable_bool, a_nullable_int, nullptr, nullptr, nullptr, 0, nullptr, 0, nullptr, 0, nullptr, 0, nullptr, nullptr, nullptr, - nullptr, a_nullable_string, nullptr, nullptr, nullptr, nullptr, - nullptr, nullptr, nullptr, nullptr, nullptr); + nullptr, nullptr, a_nullable_string, nullptr, nullptr, nullptr, + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr); return core_tests_pigeon_test_host_integration_core_api_send_multiple_nullable_types_response_new( types); } @@ -227,8 +235,8 @@ send_multiple_nullable_types_without_recursion(gboolean* a_nullable_bool, core_tests_pigeon_test_all_nullable_types_without_recursion_new( a_nullable_bool, a_nullable_int, nullptr, nullptr, nullptr, 0, nullptr, 0, nullptr, 0, nullptr, 0, nullptr, nullptr, nullptr, - nullptr, a_nullable_string, nullptr, nullptr, nullptr, nullptr, - nullptr, nullptr, nullptr); + nullptr, nullptr, a_nullable_string, nullptr, nullptr, nullptr, + nullptr, nullptr, nullptr, nullptr); return core_tests_pigeon_test_host_integration_core_api_send_multiple_nullable_types_without_recursion_response_new( types); } @@ -289,6 +297,13 @@ echo_nullable_enum(CoreTestsPigeonTestAnEnum* an_enum, gpointer user_data) { an_enum); } +static CoreTestsPigeonTestHostIntegrationCoreApiEchoAnotherNullableEnumResponse* +echo_another_nullable_enum(CoreTestsPigeonTestAnotherEnum* another_enum, + gpointer user_data) { + return core_tests_pigeon_test_host_integration_core_api_echo_another_nullable_enum_response_new( + another_enum); +} + static CoreTestsPigeonTestHostIntegrationCoreApiEchoOptionalNullableIntResponse* echo_optional_nullable_int(int64_t* a_nullable_int, gpointer user_data) { return core_tests_pigeon_test_host_integration_core_api_echo_optional_nullable_int_response_new( @@ -382,6 +397,15 @@ static void echo_async_enum( response_handle, an_enum); } +static void echo_another_async_enum( + + CoreTestsPigeonTestAnotherEnum another_enum, + CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, + gpointer user_data) { + core_tests_pigeon_test_host_integration_core_api_respond_echo_another_async_enum( + response_handle, another_enum); +} + static void throw_async_error( CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, @@ -509,6 +533,15 @@ static void echo_async_nullable_enum( response_handle, an_enum); } +static void echo_another_async_nullable_enum( + + CoreTestsPigeonTestAnotherEnum* another_enum, + CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, + gpointer user_data) { + core_tests_pigeon_test_host_integration_core_api_respond_echo_another_async_nullable_enum( + response_handle, another_enum); +} + static void noop_cb(GObject* object, GAsyncResult* result, gpointer user_data) { g_autoptr(CallbackData) data = static_cast(user_data); @@ -1242,6 +1275,52 @@ static void call_flutter_echo_enum( callback_data_new(self, response_handle)); } +static void echo_another_enum_cb(GObject* object, GAsyncResult* result, + gpointer user_data) { + g_autoptr(CallbackData) data = static_cast(user_data); + + g_autoptr(GError) error = nullptr; + g_autoptr(CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherEnumResponse) + response = + core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_finish( + CORE_TESTS_PIGEON_TEST_FLUTTER_INTEGRATION_CORE_API(object), + result, &error); + if (response == nullptr) { + core_tests_pigeon_test_host_integration_core_api_respond_error_call_flutter_echo_another_enum( + data->response_handle, "Internal Error", error->message, nullptr); + return; + } + if (core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_response_is_error( + response)) { + core_tests_pigeon_test_host_integration_core_api_respond_error_call_flutter_echo_bool( + data->response_handle, + core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_response_get_error_code( + response), + core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_response_get_error_message( + response), + core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_response_get_error_details( + response)); + return; + } + + core_tests_pigeon_test_host_integration_core_api_respond_call_flutter_echo_another_enum( + data->response_handle, + core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum_response_get_return_value( + response)); +} + +static void call_flutter_echo_another_enum( + + CoreTestsPigeonTestAnotherEnum another_enum, + CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, + gpointer user_data) { + TestPlugin* self = TEST_PLUGIN(user_data); + + core_tests_pigeon_test_flutter_integration_core_api_echo_another_enum( + self->flutter_core_api, another_enum, self->cancellable, + echo_another_enum_cb, callback_data_new(self, response_handle)); +} + static void echo_nullable_bool_cb(GObject* object, GAsyncResult* result, gpointer user_data) { g_autoptr(CallbackData) data = static_cast(user_data); @@ -1611,6 +1690,53 @@ static void call_flutter_echo_nullable_enum( callback_data_new(self, response_handle)); } +static void echo_another_nullable_enum_cb(GObject* object, GAsyncResult* result, + gpointer user_data) { + g_autoptr(CallbackData) data = static_cast(user_data); + + g_autoptr(GError) error = nullptr; + g_autoptr( + CoreTestsPigeonTestFlutterIntegrationCoreApiEchoAnotherNullableEnumResponse) + response = + core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_finish( + CORE_TESTS_PIGEON_TEST_FLUTTER_INTEGRATION_CORE_API(object), + result, &error); + if (response == nullptr) { + core_tests_pigeon_test_host_integration_core_api_respond_error_call_flutter_echo_another_nullable_enum( + data->response_handle, "Internal Error", error->message, nullptr); + return; + } + if (core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_response_is_error( + response)) { + core_tests_pigeon_test_host_integration_core_api_respond_error_call_flutter_echo_bool( + data->response_handle, + core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_response_get_error_code( + response), + core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_response_get_error_message( + response), + core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_response_get_error_details( + response)); + return; + } + + core_tests_pigeon_test_host_integration_core_api_respond_call_flutter_echo_another_nullable_enum( + data->response_handle, + core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum_response_get_return_value( + response)); +} + +static void call_flutter_echo_another_nullable_enum( + + CoreTestsPigeonTestAnotherEnum* another_enum, + CoreTestsPigeonTestHostIntegrationCoreApiResponseHandle* response_handle, + gpointer user_data) { + TestPlugin* self = TEST_PLUGIN(user_data); + + core_tests_pigeon_test_flutter_integration_core_api_echo_another_nullable_enum( + self->flutter_core_api, another_enum, self->cancellable, + echo_another_nullable_enum_cb, callback_data_new(self, response_handle)); +} + static void small_api_two_echo_string_cb(GObject* object, GAsyncResult* result, gpointer user_data) { g_autoptr(CallbackData) data = static_cast(user_data); @@ -1704,6 +1830,7 @@ static CoreTestsPigeonTestHostIntegrationCoreApiVTable host_core_api_vtable = { .echo_map = echo_map, .echo_class_wrapper = echo_class_wrapper, .echo_enum = echo_enum, + .echo_another_enum = echo_another_enum, .echo_named_default_string = echo_named_default_string, .echo_optional_default_double = echo_optional_default_double, .echo_required_int = echo_required_int, @@ -1724,6 +1851,7 @@ static CoreTestsPigeonTestHostIntegrationCoreApiVTable host_core_api_vtable = { .echo_nullable_list = echo_nullable_list, .echo_nullable_map = echo_nullable_map, .echo_nullable_enum = echo_nullable_enum, + .echo_another_nullable_enum = echo_another_nullable_enum, .echo_optional_nullable_int = echo_optional_nullable_int, .echo_named_nullable_string = echo_named_nullable_string, .noop_async = noop_async, @@ -1736,6 +1864,7 @@ static CoreTestsPigeonTestHostIntegrationCoreApiVTable host_core_api_vtable = { .echo_async_list = echo_async_list, .echo_async_map = echo_async_map, .echo_async_enum = echo_async_enum, + .echo_another_async_enum = echo_another_async_enum, .throw_async_error = throw_async_error, .throw_async_error_from_void = throw_async_error_from_void, .throw_async_flutter_error = throw_async_flutter_error, @@ -1753,6 +1882,7 @@ static CoreTestsPigeonTestHostIntegrationCoreApiVTable host_core_api_vtable = { .echo_async_nullable_list = echo_async_nullable_list, .echo_async_nullable_map = echo_async_nullable_map, .echo_async_nullable_enum = echo_async_nullable_enum, + .echo_another_async_nullable_enum = echo_another_async_nullable_enum, .call_flutter_noop = call_flutter_noop, .call_flutter_throw_error = call_flutter_throw_error, .call_flutter_throw_error_from_void = call_flutter_throw_error_from_void, @@ -1773,6 +1903,7 @@ static CoreTestsPigeonTestHostIntegrationCoreApiVTable host_core_api_vtable = { .call_flutter_echo_list = call_flutter_echo_list, .call_flutter_echo_map = call_flutter_echo_map, .call_flutter_echo_enum = call_flutter_echo_enum, + .call_flutter_echo_another_enum = call_flutter_echo_another_enum, .call_flutter_echo_nullable_bool = call_flutter_echo_nullable_bool, .call_flutter_echo_nullable_int = call_flutter_echo_nullable_int, .call_flutter_echo_nullable_double = call_flutter_echo_nullable_double, @@ -1782,6 +1913,8 @@ static CoreTestsPigeonTestHostIntegrationCoreApiVTable host_core_api_vtable = { .call_flutter_echo_nullable_list = call_flutter_echo_nullable_list, .call_flutter_echo_nullable_map = call_flutter_echo_nullable_map, .call_flutter_echo_nullable_enum = call_flutter_echo_nullable_enum, + .call_flutter_echo_another_nullable_enum = + call_flutter_echo_another_nullable_enum, .call_flutter_small_api_echo_string = call_flutter_small_api_echo_string}; static void echo(const gchar* a_string, diff --git a/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift b/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift index 2b95f040b48..00fd797edce 100644 --- a/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift +++ b/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift @@ -82,6 +82,10 @@ enum AnEnum: Int { case fourHundredTwentyTwo = 4 } +enum AnotherEnum: Int { + case justInCase = 0 +} + /// A class containing all supported types. /// /// Generated class from Pigeon that represents data sent in messages. @@ -95,6 +99,7 @@ struct AllTypes { var a8ByteArray: FlutterStandardTypedData var aFloatArray: FlutterStandardTypedData var anEnum: AnEnum + var anotherEnum: AnotherEnum var aString: String var anObject: Any var list: [Any?] @@ -105,26 +110,27 @@ struct AllTypes { var map: [AnyHashable: Any?] // swift-format-ignore: AlwaysUseLowerCamelCase - static func fromList(_ __pigeon_list: [Any?]) -> AllTypes? { - let aBool = __pigeon_list[0] as! Bool + static func fromList(_ pigeonVar_list: [Any?]) -> AllTypes? { + let aBool = pigeonVar_list[0] as! Bool let anInt = - __pigeon_list[1] is Int64 ? __pigeon_list[1] as! Int64 : Int64(__pigeon_list[1] as! Int32) + pigeonVar_list[1] is Int64 ? pigeonVar_list[1] as! Int64 : Int64(pigeonVar_list[1] as! Int32) let anInt64 = - __pigeon_list[2] is Int64 ? __pigeon_list[2] as! Int64 : Int64(__pigeon_list[2] as! Int32) - let aDouble = __pigeon_list[3] as! Double - let aByteArray = __pigeon_list[4] as! FlutterStandardTypedData - let a4ByteArray = __pigeon_list[5] as! FlutterStandardTypedData - let a8ByteArray = __pigeon_list[6] as! FlutterStandardTypedData - let aFloatArray = __pigeon_list[7] as! FlutterStandardTypedData - let anEnum = __pigeon_list[8] as! AnEnum - let aString = __pigeon_list[9] as! String - let anObject = __pigeon_list[10]! - let list = __pigeon_list[11] as! [Any?] - let stringList = __pigeon_list[12] as! [String?] - let intList = __pigeon_list[13] as! [Int64?] - let doubleList = __pigeon_list[14] as! [Double?] - let boolList = __pigeon_list[15] as! [Bool?] - let map = __pigeon_list[16] as! [AnyHashable: Any?] + pigeonVar_list[2] is Int64 ? pigeonVar_list[2] as! Int64 : Int64(pigeonVar_list[2] as! Int32) + let aDouble = pigeonVar_list[3] as! Double + let aByteArray = pigeonVar_list[4] as! FlutterStandardTypedData + let a4ByteArray = pigeonVar_list[5] as! FlutterStandardTypedData + let a8ByteArray = pigeonVar_list[6] as! FlutterStandardTypedData + let aFloatArray = pigeonVar_list[7] as! FlutterStandardTypedData + let anEnum = pigeonVar_list[8] as! AnEnum + let anotherEnum = pigeonVar_list[9] as! AnotherEnum + let aString = pigeonVar_list[10] as! String + let anObject = pigeonVar_list[11]! + let list = pigeonVar_list[12] as! [Any?] + let stringList = pigeonVar_list[13] as! [String?] + let intList = pigeonVar_list[14] as! [Int64?] + let doubleList = pigeonVar_list[15] as! [Double?] + let boolList = pigeonVar_list[16] as! [Bool?] + let map = pigeonVar_list[17] as! [AnyHashable: Any?] return AllTypes( aBool: aBool, @@ -136,6 +142,7 @@ struct AllTypes { a8ByteArray: a8ByteArray, aFloatArray: aFloatArray, anEnum: anEnum, + anotherEnum: anotherEnum, aString: aString, anObject: anObject, list: list, @@ -157,6 +164,7 @@ struct AllTypes { a8ByteArray, aFloatArray, anEnum, + anotherEnum, aString, anObject, list, @@ -186,6 +194,7 @@ class AllNullableTypes { nullableMapWithAnnotations: [String?: String?]? = nil, nullableMapWithObject: [String?: Any?]? = nil, aNullableEnum: AnEnum? = nil, + anotherNullableEnum: AnotherEnum? = nil, aNullableString: String? = nil, aNullableObject: Any? = nil, allNullableTypes: AllNullableTypes? = nil, @@ -209,6 +218,7 @@ class AllNullableTypes { self.nullableMapWithAnnotations = nullableMapWithAnnotations self.nullableMapWithObject = nullableMapWithObject self.aNullableEnum = aNullableEnum + self.anotherNullableEnum = anotherNullableEnum self.aNullableString = aNullableString self.aNullableObject = aNullableObject self.allNullableTypes = allNullableTypes @@ -232,6 +242,7 @@ class AllNullableTypes { var nullableMapWithAnnotations: [String?: String?]? var nullableMapWithObject: [String?: Any?]? var aNullableEnum: AnEnum? + var anotherNullableEnum: AnotherEnum? var aNullableString: String? var aNullableObject: Any? var allNullableTypes: AllNullableTypes? @@ -244,37 +255,38 @@ class AllNullableTypes { var map: [AnyHashable: Any?]? // swift-format-ignore: AlwaysUseLowerCamelCase - static func fromList(_ __pigeon_list: [Any?]) -> AllNullableTypes? { - let aNullableBool: Bool? = nilOrValue(__pigeon_list[0]) + static func fromList(_ pigeonVar_list: [Any?]) -> AllNullableTypes? { + let aNullableBool: Bool? = nilOrValue(pigeonVar_list[0]) let aNullableInt: Int64? = - isNullish(__pigeon_list[1]) + isNullish(pigeonVar_list[1]) ? nil - : (__pigeon_list[1] is Int64? - ? __pigeon_list[1] as! Int64? : Int64(__pigeon_list[1] as! Int32)) + : (pigeonVar_list[1] is Int64? + ? pigeonVar_list[1] as! Int64? : Int64(pigeonVar_list[1] as! Int32)) let aNullableInt64: Int64? = - isNullish(__pigeon_list[2]) + isNullish(pigeonVar_list[2]) ? nil - : (__pigeon_list[2] is Int64? - ? __pigeon_list[2] as! Int64? : Int64(__pigeon_list[2] as! Int32)) - let aNullableDouble: Double? = nilOrValue(__pigeon_list[3]) - let aNullableByteArray: FlutterStandardTypedData? = nilOrValue(__pigeon_list[4]) - let aNullable4ByteArray: FlutterStandardTypedData? = nilOrValue(__pigeon_list[5]) - let aNullable8ByteArray: FlutterStandardTypedData? = nilOrValue(__pigeon_list[6]) - let aNullableFloatArray: FlutterStandardTypedData? = nilOrValue(__pigeon_list[7]) - let nullableNestedList: [[Bool?]?]? = nilOrValue(__pigeon_list[8]) - let nullableMapWithAnnotations: [String?: String?]? = nilOrValue(__pigeon_list[9]) - let nullableMapWithObject: [String?: Any?]? = nilOrValue(__pigeon_list[10]) - let aNullableEnum: AnEnum? = nilOrValue(__pigeon_list[11]) - let aNullableString: String? = nilOrValue(__pigeon_list[12]) - let aNullableObject: Any? = __pigeon_list[13] - let allNullableTypes: AllNullableTypes? = nilOrValue(__pigeon_list[14]) - let list: [Any?]? = nilOrValue(__pigeon_list[15]) - let stringList: [String?]? = nilOrValue(__pigeon_list[16]) - let intList: [Int64?]? = nilOrValue(__pigeon_list[17]) - let doubleList: [Double?]? = nilOrValue(__pigeon_list[18]) - let boolList: [Bool?]? = nilOrValue(__pigeon_list[19]) - let nestedClassList: [AllNullableTypes?]? = nilOrValue(__pigeon_list[20]) - let map: [AnyHashable: Any?]? = nilOrValue(__pigeon_list[21]) + : (pigeonVar_list[2] is Int64? + ? pigeonVar_list[2] as! Int64? : Int64(pigeonVar_list[2] as! Int32)) + let aNullableDouble: Double? = nilOrValue(pigeonVar_list[3]) + let aNullableByteArray: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[4]) + let aNullable4ByteArray: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[5]) + let aNullable8ByteArray: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[6]) + let aNullableFloatArray: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[7]) + let nullableNestedList: [[Bool?]?]? = nilOrValue(pigeonVar_list[8]) + let nullableMapWithAnnotations: [String?: String?]? = nilOrValue(pigeonVar_list[9]) + let nullableMapWithObject: [String?: Any?]? = nilOrValue(pigeonVar_list[10]) + let aNullableEnum: AnEnum? = nilOrValue(pigeonVar_list[11]) + let anotherNullableEnum: AnotherEnum? = nilOrValue(pigeonVar_list[12]) + let aNullableString: String? = nilOrValue(pigeonVar_list[13]) + let aNullableObject: Any? = pigeonVar_list[14] + let allNullableTypes: AllNullableTypes? = nilOrValue(pigeonVar_list[15]) + let list: [Any?]? = nilOrValue(pigeonVar_list[16]) + let stringList: [String?]? = nilOrValue(pigeonVar_list[17]) + let intList: [Int64?]? = nilOrValue(pigeonVar_list[18]) + let doubleList: [Double?]? = nilOrValue(pigeonVar_list[19]) + let boolList: [Bool?]? = nilOrValue(pigeonVar_list[20]) + let nestedClassList: [AllNullableTypes?]? = nilOrValue(pigeonVar_list[21]) + let map: [AnyHashable: Any?]? = nilOrValue(pigeonVar_list[22]) return AllNullableTypes( aNullableBool: aNullableBool, @@ -289,6 +301,7 @@ class AllNullableTypes { nullableMapWithAnnotations: nullableMapWithAnnotations, nullableMapWithObject: nullableMapWithObject, aNullableEnum: aNullableEnum, + anotherNullableEnum: anotherNullableEnum, aNullableString: aNullableString, aNullableObject: aNullableObject, allNullableTypes: allNullableTypes, @@ -315,6 +328,7 @@ class AllNullableTypes { nullableMapWithAnnotations, nullableMapWithObject, aNullableEnum, + anotherNullableEnum, aNullableString, aNullableObject, allNullableTypes, @@ -347,6 +361,7 @@ struct AllNullableTypesWithoutRecursion { var nullableMapWithAnnotations: [String?: String?]? = nil var nullableMapWithObject: [String?: Any?]? = nil var aNullableEnum: AnEnum? = nil + var anotherNullableEnum: AnotherEnum? = nil var aNullableString: String? = nil var aNullableObject: Any? = nil var list: [Any?]? = nil @@ -357,35 +372,36 @@ struct AllNullableTypesWithoutRecursion { var map: [AnyHashable: Any?]? = nil // swift-format-ignore: AlwaysUseLowerCamelCase - static func fromList(_ __pigeon_list: [Any?]) -> AllNullableTypesWithoutRecursion? { - let aNullableBool: Bool? = nilOrValue(__pigeon_list[0]) + static func fromList(_ pigeonVar_list: [Any?]) -> AllNullableTypesWithoutRecursion? { + let aNullableBool: Bool? = nilOrValue(pigeonVar_list[0]) let aNullableInt: Int64? = - isNullish(__pigeon_list[1]) + isNullish(pigeonVar_list[1]) ? nil - : (__pigeon_list[1] is Int64? - ? __pigeon_list[1] as! Int64? : Int64(__pigeon_list[1] as! Int32)) + : (pigeonVar_list[1] is Int64? + ? pigeonVar_list[1] as! Int64? : Int64(pigeonVar_list[1] as! Int32)) let aNullableInt64: Int64? = - isNullish(__pigeon_list[2]) + isNullish(pigeonVar_list[2]) ? nil - : (__pigeon_list[2] is Int64? - ? __pigeon_list[2] as! Int64? : Int64(__pigeon_list[2] as! Int32)) - let aNullableDouble: Double? = nilOrValue(__pigeon_list[3]) - let aNullableByteArray: FlutterStandardTypedData? = nilOrValue(__pigeon_list[4]) - let aNullable4ByteArray: FlutterStandardTypedData? = nilOrValue(__pigeon_list[5]) - let aNullable8ByteArray: FlutterStandardTypedData? = nilOrValue(__pigeon_list[6]) - let aNullableFloatArray: FlutterStandardTypedData? = nilOrValue(__pigeon_list[7]) - let nullableNestedList: [[Bool?]?]? = nilOrValue(__pigeon_list[8]) - let nullableMapWithAnnotations: [String?: String?]? = nilOrValue(__pigeon_list[9]) - let nullableMapWithObject: [String?: Any?]? = nilOrValue(__pigeon_list[10]) - let aNullableEnum: AnEnum? = nilOrValue(__pigeon_list[11]) - let aNullableString: String? = nilOrValue(__pigeon_list[12]) - let aNullableObject: Any? = __pigeon_list[13] - let list: [Any?]? = nilOrValue(__pigeon_list[14]) - let stringList: [String?]? = nilOrValue(__pigeon_list[15]) - let intList: [Int64?]? = nilOrValue(__pigeon_list[16]) - let doubleList: [Double?]? = nilOrValue(__pigeon_list[17]) - let boolList: [Bool?]? = nilOrValue(__pigeon_list[18]) - let map: [AnyHashable: Any?]? = nilOrValue(__pigeon_list[19]) + : (pigeonVar_list[2] is Int64? + ? pigeonVar_list[2] as! Int64? : Int64(pigeonVar_list[2] as! Int32)) + let aNullableDouble: Double? = nilOrValue(pigeonVar_list[3]) + let aNullableByteArray: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[4]) + let aNullable4ByteArray: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[5]) + let aNullable8ByteArray: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[6]) + let aNullableFloatArray: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[7]) + let nullableNestedList: [[Bool?]?]? = nilOrValue(pigeonVar_list[8]) + let nullableMapWithAnnotations: [String?: String?]? = nilOrValue(pigeonVar_list[9]) + let nullableMapWithObject: [String?: Any?]? = nilOrValue(pigeonVar_list[10]) + let aNullableEnum: AnEnum? = nilOrValue(pigeonVar_list[11]) + let anotherNullableEnum: AnotherEnum? = nilOrValue(pigeonVar_list[12]) + let aNullableString: String? = nilOrValue(pigeonVar_list[13]) + let aNullableObject: Any? = pigeonVar_list[14] + let list: [Any?]? = nilOrValue(pigeonVar_list[15]) + let stringList: [String?]? = nilOrValue(pigeonVar_list[16]) + let intList: [Int64?]? = nilOrValue(pigeonVar_list[17]) + let doubleList: [Double?]? = nilOrValue(pigeonVar_list[18]) + let boolList: [Bool?]? = nilOrValue(pigeonVar_list[19]) + let map: [AnyHashable: Any?]? = nilOrValue(pigeonVar_list[20]) return AllNullableTypesWithoutRecursion( aNullableBool: aNullableBool, @@ -400,6 +416,7 @@ struct AllNullableTypesWithoutRecursion { nullableMapWithAnnotations: nullableMapWithAnnotations, nullableMapWithObject: nullableMapWithObject, aNullableEnum: aNullableEnum, + anotherNullableEnum: anotherNullableEnum, aNullableString: aNullableString, aNullableObject: aNullableObject, list: list, @@ -424,6 +441,7 @@ struct AllNullableTypesWithoutRecursion { nullableMapWithAnnotations, nullableMapWithObject, aNullableEnum, + anotherNullableEnum, aNullableString, aNullableObject, list, @@ -449,11 +467,11 @@ struct AllClassesWrapper { var allTypes: AllTypes? = nil // swift-format-ignore: AlwaysUseLowerCamelCase - static func fromList(_ __pigeon_list: [Any?]) -> AllClassesWrapper? { - let allNullableTypes = __pigeon_list[0] as! AllNullableTypes + static func fromList(_ pigeonVar_list: [Any?]) -> AllClassesWrapper? { + let allNullableTypes = pigeonVar_list[0] as! AllNullableTypes let allNullableTypesWithoutRecursion: AllNullableTypesWithoutRecursion? = nilOrValue( - __pigeon_list[1]) - let allTypes: AllTypes? = nilOrValue(__pigeon_list[2]) + pigeonVar_list[1]) + let allTypes: AllTypes? = nilOrValue(pigeonVar_list[2]) return AllClassesWrapper( allNullableTypes: allNullableTypes, @@ -477,8 +495,8 @@ struct TestMessage { var testList: [Any?]? = nil // swift-format-ignore: AlwaysUseLowerCamelCase - static func fromList(_ __pigeon_list: [Any?]) -> TestMessage? { - let testList: [Any?]? = nilOrValue(__pigeon_list[0]) + static func fromList(_ pigeonVar_list: [Any?]) -> TestMessage? { + let testList: [Any?]? = nilOrValue(pigeonVar_list[0]) return TestMessage( testList: testList @@ -490,26 +508,32 @@ struct TestMessage { ] } } + private class CoreTestsPigeonCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { case 129: - return AllTypes.fromList(self.readValue() as! [Any?]) + let enumResultAsInt: Int? = nilOrValue(self.readValue() as? Int) + if let enumResultAsInt = enumResultAsInt { + return AnEnum(rawValue: enumResultAsInt) + } + return nil case 130: - return AllNullableTypes.fromList(self.readValue() as! [Any?]) + let enumResultAsInt: Int? = nilOrValue(self.readValue() as? Int) + if let enumResultAsInt = enumResultAsInt { + return AnotherEnum(rawValue: enumResultAsInt) + } + return nil case 131: - return AllNullableTypesWithoutRecursion.fromList(self.readValue() as! [Any?]) + return AllTypes.fromList(self.readValue() as! [Any?]) case 132: - return AllClassesWrapper.fromList(self.readValue() as! [Any?]) + return AllNullableTypes.fromList(self.readValue() as! [Any?]) case 133: - return TestMessage.fromList(self.readValue() as! [Any?]) + return AllNullableTypesWithoutRecursion.fromList(self.readValue() as! [Any?]) case 134: - var enumResult: AnEnum? = nil - let enumResultAsInt: Int? = nilOrValue(self.readValue() as? Int) - if let enumResultAsInt = enumResultAsInt { - enumResult = AnEnum(rawValue: enumResultAsInt) - } - return enumResult + return AllClassesWrapper.fromList(self.readValue() as! [Any?]) + case 135: + return TestMessage.fromList(self.readValue() as! [Any?]) default: return super.readValue(ofType: type) } @@ -518,24 +542,27 @@ private class CoreTestsPigeonCodecReader: FlutterStandardReader { private class CoreTestsPigeonCodecWriter: FlutterStandardWriter { override func writeValue(_ value: Any) { - if let value = value as? AllTypes { + if let value = value as? AnEnum { super.writeByte(129) + super.writeValue(value.rawValue) + } else if let value = value as? AnotherEnum { + super.writeByte(130) + super.writeValue(value.rawValue) + } else if let value = value as? AllTypes { + super.writeByte(131) super.writeValue(value.toList()) } else if let value = value as? AllNullableTypes { - super.writeByte(130) + super.writeByte(132) super.writeValue(value.toList()) } else if let value = value as? AllNullableTypesWithoutRecursion { - super.writeByte(131) + super.writeByte(133) super.writeValue(value.toList()) } else if let value = value as? AllClassesWrapper { - super.writeByte(132) + super.writeByte(134) super.writeValue(value.toList()) } else if let value = value as? TestMessage { - super.writeByte(133) + super.writeByte(135) super.writeValue(value.toList()) - } else if let value = value as? AnEnum { - super.writeByte(134) - super.writeValue(value.rawValue) } else { super.writeValue(value) } @@ -592,6 +619,8 @@ protocol HostIntegrationCoreApi { func echo(_ wrapper: AllClassesWrapper) throws -> AllClassesWrapper /// Returns the passed enum to test serialization and deserialization. func echo(_ anEnum: AnEnum) throws -> AnEnum + /// Returns the passed enum to test serialization and deserialization. + func echo(_ anotherEnum: AnotherEnum) throws -> AnotherEnum /// Returns the default string. func echoNamedDefault(_ aString: String) throws -> String /// Returns passed in double. @@ -634,6 +663,7 @@ protocol HostIntegrationCoreApi { /// Returns the passed map, to test serialization and deserialization. func echoNullable(_ aNullableMap: [String?: Any?]?) throws -> [String?: Any?]? func echoNullable(_ anEnum: AnEnum?) throws -> AnEnum? + func echoNullable(_ anotherEnum: AnotherEnum?) throws -> AnotherEnum? /// Returns passed in int. func echoOptional(_ aNullableInt: Int64?) throws -> Int64? /// Returns the passed in string. @@ -662,6 +692,9 @@ protocol HostIntegrationCoreApi { _ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) /// Returns the passed enum, to test asynchronous serialization and deserialization. func echoAsync(_ anEnum: AnEnum, completion: @escaping (Result) -> Void) + /// Returns the passed enum, to test asynchronous serialization and deserialization. + func echoAsync( + _ anotherEnum: AnotherEnum, completion: @escaping (Result) -> Void) /// Responds with an error from an async function returning a value. func throwAsyncError(completion: @escaping (Result) -> Void) /// Responds with an error from an async void function. @@ -699,6 +732,9 @@ protocol HostIntegrationCoreApi { _ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) /// Returns the passed enum, to test asynchronous serialization and deserialization. func echoAsyncNullable(_ anEnum: AnEnum?, completion: @escaping (Result) -> Void) + /// Returns the passed enum, to test asynchronous serialization and deserialization. + func echoAsyncNullable( + _ anotherEnum: AnotherEnum?, completion: @escaping (Result) -> Void) func callFlutterNoop(completion: @escaping (Result) -> Void) func callFlutterThrowError(completion: @escaping (Result) -> Void) func callFlutterThrowErrorFromVoid(completion: @escaping (Result) -> Void) @@ -727,6 +763,8 @@ protocol HostIntegrationCoreApi { func callFlutterEcho( _ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) func callFlutterEcho(_ anEnum: AnEnum, completion: @escaping (Result) -> Void) + func callFlutterEcho( + _ anotherEnum: AnotherEnum, completion: @escaping (Result) -> Void) func callFlutterEchoNullable(_ aBool: Bool?, completion: @escaping (Result) -> Void) func callFlutterEchoNullable( _ anInt: Int64?, completion: @escaping (Result) -> Void) @@ -741,8 +779,10 @@ protocol HostIntegrationCoreApi { _ list: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void) func callFlutterEchoNullable( _ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) - func callFlutterNullableEcho( + func callFlutterEchoNullable( _ anEnum: AnEnum?, completion: @escaping (Result) -> Void) + func callFlutterEchoNullable( + _ anotherEnum: AnotherEnum?, completion: @escaping (Result) -> Void) func callFlutterSmallApiEcho( _ aString: String, completion: @escaping (Result) -> Void) } @@ -1034,6 +1074,25 @@ class HostIntegrationCoreApiSetup { } else { echoEnumChannel.setMessageHandler(nil) } + /// Returns the passed enum to test serialization and deserialization. + let echoAnotherEnumChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAnotherEnum\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + echoAnotherEnumChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let anotherEnumArg = args[0] as! AnotherEnum + do { + let result = try api.echo(anotherEnumArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } + } + } else { + echoAnotherEnumChannel.setMessageHandler(nil) + } /// Returns the default string. let echoNamedDefaultStringChannel = FlutterBasicMessageChannel( name: @@ -1389,6 +1448,24 @@ class HostIntegrationCoreApiSetup { } else { echoNullableEnumChannel.setMessageHandler(nil) } + let echoAnotherNullableEnumChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAnotherNullableEnum\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + echoAnotherNullableEnumChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let anotherEnumArg: AnotherEnum? = nilOrValue(args[0]) + do { + let result = try api.echoNullable(anotherEnumArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } + } + } else { + echoAnotherNullableEnumChannel.setMessageHandler(nil) + } /// Returns passed in int. let echoOptionalNullableIntChannel = FlutterBasicMessageChannel( name: @@ -1638,6 +1715,27 @@ class HostIntegrationCoreApiSetup { } else { echoAsyncEnumChannel.setMessageHandler(nil) } + /// Returns the passed enum, to test asynchronous serialization and deserialization. + let echoAnotherAsyncEnumChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAnotherAsyncEnum\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + echoAnotherAsyncEnumChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let anotherEnumArg = args[0] as! AnotherEnum + api.echoAsync(anotherEnumArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + echoAnotherAsyncEnumChannel.setMessageHandler(nil) + } /// Responds with an error from an async function returning a value. let throwAsyncErrorChannel = FlutterBasicMessageChannel( name: @@ -1949,6 +2047,27 @@ class HostIntegrationCoreApiSetup { } else { echoAsyncNullableEnumChannel.setMessageHandler(nil) } + /// Returns the passed enum, to test asynchronous serialization and deserialization. + let echoAnotherAsyncNullableEnumChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAnotherAsyncNullableEnum\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + echoAnotherAsyncNullableEnumChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let anotherEnumArg: AnotherEnum? = nilOrValue(args[0]) + api.echoAsyncNullable(anotherEnumArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + echoAnotherAsyncNullableEnumChannel.setMessageHandler(nil) + } let callFlutterNoopChannel = FlutterBasicMessageChannel( name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterNoop\(channelSuffix)", @@ -2276,6 +2395,26 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoEnumChannel.setMessageHandler(nil) } + let callFlutterEchoAnotherEnumChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAnotherEnum\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + callFlutterEchoAnotherEnumChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let anotherEnumArg = args[0] as! AnotherEnum + api.callFlutterEcho(anotherEnumArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + callFlutterEchoAnotherEnumChannel.setMessageHandler(nil) + } let callFlutterEchoNullableBoolChannel = FlutterBasicMessageChannel( name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableBool\(channelSuffix)", @@ -2426,7 +2565,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoNullableEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anEnumArg: AnEnum? = nilOrValue(args[0]) - api.callFlutterNullableEcho(anEnumArg) { result in + api.callFlutterEchoNullable(anEnumArg) { result in switch result { case .success(let res): reply(wrapResult(res)) @@ -2438,6 +2577,26 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoNullableEnumChannel.setMessageHandler(nil) } + let callFlutterEchoAnotherNullableEnumChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAnotherNullableEnum\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + callFlutterEchoAnotherNullableEnumChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let anotherEnumArg: AnotherEnum? = nilOrValue(args[0]) + api.callFlutterEchoNullable(anotherEnumArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + callFlutterEchoAnotherNullableEnumChannel.setMessageHandler(nil) + } let callFlutterSmallApiEchoStringChannel = FlutterBasicMessageChannel( name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterSmallApiEchoString\(channelSuffix)", @@ -2517,6 +2676,9 @@ protocol FlutterIntegrationCoreApiProtocol { ) /// Returns the passed enum to test serialization and deserialization. func echo(_ anEnumArg: AnEnum, completion: @escaping (Result) -> Void) + /// Returns the passed enum to test serialization and deserialization. + func echo( + _ anotherEnumArg: AnotherEnum, completion: @escaping (Result) -> Void) /// Returns the passed boolean, to test serialization and deserialization. func echoNullable(_ aBoolArg: Bool?, completion: @escaping (Result) -> Void) /// Returns the passed int, to test serialization and deserialization. @@ -2541,6 +2703,10 @@ protocol FlutterIntegrationCoreApiProtocol { /// Returns the passed enum to test serialization and deserialization. func echoNullable( _ anEnumArg: AnEnum?, completion: @escaping (Result) -> Void) + /// Returns the passed enum to test serialization and deserialization. + func echoNullable( + _ anotherEnumArg: AnotherEnum?, + completion: @escaping (Result) -> Void) /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. func noopAsync(completion: @escaping (Result) -> Void) @@ -3002,6 +3168,36 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } } + /// Returns the passed enum to test serialization and deserialization. + func echo( + _ anotherEnumArg: AnotherEnum, completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAnotherEnum\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([anotherEnumArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + PigeonError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) + } else { + let result = listResponse[0] as! AnotherEnum + completion(.success(result)) + } + } + } /// Returns the passed boolean, to test serialization and deserialization. func echoNullable(_ aBoolArg: Bool?, completion: @escaping (Result) -> Void) { let channelName: String = @@ -3197,6 +3393,31 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } } + /// Returns the passed enum to test serialization and deserialization. + func echoNullable( + _ anotherEnumArg: AnotherEnum?, + completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAnotherNullableEnum\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([anotherEnumArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + let result: AnotherEnum? = nilOrValue(listResponse[0]) + completion(.success(result)) + } + } + } /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. func noopAsync(completion: @escaping (Result) -> Void) { diff --git a/packages/pigeon/platform_tests/test_plugin/macos/Classes/TestPlugin.swift b/packages/pigeon/platform_tests/test_plugin/macos/Classes/TestPlugin.swift index 5a649736641..af7a7f89557 100644 --- a/packages/pigeon/platform_tests/test_plugin/macos/Classes/TestPlugin.swift +++ b/packages/pigeon/platform_tests/test_plugin/macos/Classes/TestPlugin.swift @@ -98,6 +98,10 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { return anEnum } + func echo(_ anotherEnum: AnotherEnum) throws -> AnotherEnum { + return anotherEnum + } + func extractNestedNullableString(from wrapper: AllClassesWrapper) -> String? { return wrapper.allNullableTypes.aNullableString } @@ -170,6 +174,10 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { return anEnum } + func echoNullable(_ anotherEnum: AnotherEnum?) throws -> AnotherEnum? { + return anotherEnum + } + func echoOptional(_ aNullableInt: Int64?) throws -> Int64? { return aNullableInt } @@ -253,6 +261,12 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { completion(.success(anEnum)) } + func echoAsync( + _ anotherEnum: AnotherEnum, completion: @escaping (Result) -> Void + ) { + completion(.success(anotherEnum)) + } + func echoAsyncNullable(_ anInt: Int64?, completion: @escaping (Result) -> Void) { completion(.success(anInt)) } @@ -297,6 +311,12 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { completion(.success(anEnum)) } + func echoAsyncNullable( + _ anotherEnum: AnotherEnum?, completion: @escaping (Result) -> Void + ) { + completion(.success(anotherEnum)) + } + func callFlutterNoop(completion: @escaping (Result) -> Void) { flutterAPI.noop { response in switch response { @@ -502,6 +522,19 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { } } + func callFlutterEcho( + _ anotherEnum: AnotherEnum, completion: @escaping (Result) -> Void + ) { + flutterAPI.echo(anotherEnum) { response in + switch response { + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) + } + } + } + func callFlutterEchoNullable(_ aBool: Bool?, completion: @escaping (Result) -> Void) { flutterAPI.echoNullable(aBool) { response in @@ -593,7 +626,7 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { } } - func callFlutterNullableEcho( + func callFlutterEchoNullable( _ anEnum: AnEnum?, completion: @escaping (Result) -> Void ) { flutterAPI.echoNullable(anEnum) { response in @@ -606,6 +639,19 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { } } + func callFlutterEchoNullable( + _ anotherEnum: AnotherEnum?, completion: @escaping (Result) -> Void + ) { + flutterAPI.echoNullable(anotherEnum) { response in + switch response { + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) + } + } + } + func callFlutterSmallApiEcho( _ aString: String, completion: @escaping (Result) -> Void ) { diff --git a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp index c97dc064a96..c2ae05c413c 100644 --- a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp +++ b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp @@ -39,9 +39,9 @@ AllTypes::AllTypes(bool a_bool, int64_t an_int, int64_t an_int64, const std::vector& a4_byte_array, const std::vector& a8_byte_array, const std::vector& a_float_array, - const AnEnum& an_enum, const std::string& a_string, - const EncodableValue& an_object, const EncodableList& list, - const EncodableList& string_list, + const AnEnum& an_enum, const AnotherEnum& another_enum, + const std::string& a_string, const EncodableValue& an_object, + const EncodableList& list, const EncodableList& string_list, const EncodableList& int_list, const EncodableList& double_list, const EncodableList& bool_list, const EncodableMap& map) @@ -54,6 +54,7 @@ AllTypes::AllTypes(bool a_bool, int64_t an_int, int64_t an_int64, a8_byte_array_(a8_byte_array), a_float_array_(a_float_array), an_enum_(an_enum), + another_enum_(another_enum), a_string_(a_string), an_object_(an_object), list_(list), @@ -115,6 +116,12 @@ const AnEnum& AllTypes::an_enum() const { return an_enum_; } void AllTypes::set_an_enum(const AnEnum& value_arg) { an_enum_ = value_arg; } +const AnotherEnum& AllTypes::another_enum() const { return another_enum_; } + +void AllTypes::set_another_enum(const AnotherEnum& value_arg) { + another_enum_ = value_arg; +} + const std::string& AllTypes::a_string() const { return a_string_; } void AllTypes::set_a_string(std::string_view value_arg) { @@ -161,7 +168,7 @@ void AllTypes::set_map(const EncodableMap& value_arg) { map_ = value_arg; } EncodableList AllTypes::ToEncodableList() const { EncodableList list; - list.reserve(17); + list.reserve(18); list.push_back(EncodableValue(a_bool_)); list.push_back(EncodableValue(an_int_)); list.push_back(EncodableValue(an_int64_)); @@ -171,6 +178,7 @@ EncodableList AllTypes::ToEncodableList() const { list.push_back(EncodableValue(a8_byte_array_)); list.push_back(EncodableValue(a_float_array_)); list.push_back(CustomEncodableValue(an_enum_)); + list.push_back(CustomEncodableValue(another_enum_)); list.push_back(EncodableValue(a_string_)); list.push_back(an_object_); list.push_back(EncodableValue(list_)); @@ -190,10 +198,12 @@ AllTypes AllTypes::FromEncodableList(const EncodableList& list) { std::get>(list[6]), std::get>(list[7]), std::any_cast(std::get(list[8])), - std::get(list[9]), list[10], - std::get(list[11]), std::get(list[12]), - std::get(list[13]), std::get(list[14]), - std::get(list[15]), std::get(list[16])); + std::any_cast( + std::get(list[9])), + std::get(list[10]), list[11], + std::get(list[12]), std::get(list[13]), + std::get(list[14]), std::get(list[15]), + std::get(list[16]), std::get(list[17])); return decoded; } @@ -211,6 +221,7 @@ AllNullableTypes::AllNullableTypes( const EncodableList* nullable_nested_list, const EncodableMap* nullable_map_with_annotations, const EncodableMap* nullable_map_with_object, const AnEnum* a_nullable_enum, + const AnotherEnum* another_nullable_enum, const std::string* a_nullable_string, const EncodableValue* a_nullable_object, const AllNullableTypes* all_nullable_types, const EncodableList* list, @@ -256,6 +267,9 @@ AllNullableTypes::AllNullableTypes( : std::nullopt), a_nullable_enum_(a_nullable_enum ? std::optional(*a_nullable_enum) : std::nullopt), + another_nullable_enum_(another_nullable_enum ? std::optional( + *another_nullable_enum) + : std::nullopt), a_nullable_string_(a_nullable_string ? std::optional(*a_nullable_string) : std::nullopt), @@ -325,6 +339,10 @@ AllNullableTypes::AllNullableTypes(const AllNullableTypes& other) a_nullable_enum_(other.a_nullable_enum_ ? std::optional(*other.a_nullable_enum_) : std::nullopt), + another_nullable_enum_( + other.another_nullable_enum_ + ? std::optional(*other.another_nullable_enum_) + : std::nullopt), a_nullable_string_( other.a_nullable_string_ ? std::optional(*other.a_nullable_string_) @@ -370,6 +388,7 @@ AllNullableTypes& AllNullableTypes::operator=(const AllNullableTypes& other) { nullable_map_with_annotations_ = other.nullable_map_with_annotations_; nullable_map_with_object_ = other.nullable_map_with_object_; a_nullable_enum_ = other.a_nullable_enum_; + another_nullable_enum_ = other.another_nullable_enum_; a_nullable_string_ = other.a_nullable_string_; a_nullable_object_ = other.a_nullable_object_; all_nullable_types_ = @@ -559,6 +578,19 @@ void AllNullableTypes::set_a_nullable_enum(const AnEnum& value_arg) { a_nullable_enum_ = value_arg; } +const AnotherEnum* AllNullableTypes::another_nullable_enum() const { + return another_nullable_enum_ ? &(*another_nullable_enum_) : nullptr; +} + +void AllNullableTypes::set_another_nullable_enum(const AnotherEnum* value_arg) { + another_nullable_enum_ = + value_arg ? std::optional(*value_arg) : std::nullopt; +} + +void AllNullableTypes::set_another_nullable_enum(const AnotherEnum& value_arg) { + another_nullable_enum_ = value_arg; +} + const std::string* AllNullableTypes::a_nullable_string() const { return a_nullable_string_ ? &(*a_nullable_string_) : nullptr; } @@ -692,7 +724,7 @@ void AllNullableTypes::set_map(const EncodableMap& value_arg) { EncodableList AllNullableTypes::ToEncodableList() const { EncodableList list; - list.reserve(22); + list.reserve(23); list.push_back(a_nullable_bool_ ? EncodableValue(*a_nullable_bool_) : EncodableValue()); list.push_back(a_nullable_int_ ? EncodableValue(*a_nullable_int_) @@ -723,6 +755,9 @@ EncodableList AllNullableTypes::ToEncodableList() const { : EncodableValue()); list.push_back(a_nullable_enum_ ? CustomEncodableValue(*a_nullable_enum_) : EncodableValue()); + list.push_back(another_nullable_enum_ + ? CustomEncodableValue(*another_nullable_enum_) + : EncodableValue()); list.push_back(a_nullable_string_ ? EncodableValue(*a_nullable_string_) : EncodableValue()); list.push_back(a_nullable_object_ ? *a_nullable_object_ : EncodableValue()); @@ -802,46 +837,51 @@ AllNullableTypes AllNullableTypes::FromEncodableList( decoded.set_a_nullable_enum(std::any_cast( std::get(encodable_a_nullable_enum))); } - auto& encodable_a_nullable_string = list[12]; + auto& encodable_another_nullable_enum = list[12]; + if (!encodable_another_nullable_enum.IsNull()) { + decoded.set_another_nullable_enum(std::any_cast( + std::get(encodable_another_nullable_enum))); + } + auto& encodable_a_nullable_string = list[13]; if (!encodable_a_nullable_string.IsNull()) { decoded.set_a_nullable_string( std::get(encodable_a_nullable_string)); } - auto& encodable_a_nullable_object = list[13]; + auto& encodable_a_nullable_object = list[14]; if (!encodable_a_nullable_object.IsNull()) { decoded.set_a_nullable_object(encodable_a_nullable_object); } - auto& encodable_all_nullable_types = list[14]; + auto& encodable_all_nullable_types = list[15]; if (!encodable_all_nullable_types.IsNull()) { decoded.set_all_nullable_types(std::any_cast( std::get(encodable_all_nullable_types))); } - auto& encodable_list = list[15]; + auto& encodable_list = list[16]; if (!encodable_list.IsNull()) { decoded.set_list(std::get(encodable_list)); } - auto& encodable_string_list = list[16]; + auto& encodable_string_list = list[17]; if (!encodable_string_list.IsNull()) { decoded.set_string_list(std::get(encodable_string_list)); } - auto& encodable_int_list = list[17]; + auto& encodable_int_list = list[18]; if (!encodable_int_list.IsNull()) { decoded.set_int_list(std::get(encodable_int_list)); } - auto& encodable_double_list = list[18]; + auto& encodable_double_list = list[19]; if (!encodable_double_list.IsNull()) { decoded.set_double_list(std::get(encodable_double_list)); } - auto& encodable_bool_list = list[19]; + auto& encodable_bool_list = list[20]; if (!encodable_bool_list.IsNull()) { decoded.set_bool_list(std::get(encodable_bool_list)); } - auto& encodable_nested_class_list = list[20]; + auto& encodable_nested_class_list = list[21]; if (!encodable_nested_class_list.IsNull()) { decoded.set_nested_class_list( std::get(encodable_nested_class_list)); } - auto& encodable_map = list[21]; + auto& encodable_map = list[22]; if (!encodable_map.IsNull()) { decoded.set_map(std::get(encodable_map)); } @@ -862,6 +902,7 @@ AllNullableTypesWithoutRecursion::AllNullableTypesWithoutRecursion( const EncodableList* nullable_nested_list, const EncodableMap* nullable_map_with_annotations, const EncodableMap* nullable_map_with_object, const AnEnum* a_nullable_enum, + const AnotherEnum* another_nullable_enum, const std::string* a_nullable_string, const EncodableValue* a_nullable_object, const EncodableList* list, const EncodableList* string_list, const EncodableList* int_list, @@ -906,6 +947,9 @@ AllNullableTypesWithoutRecursion::AllNullableTypesWithoutRecursion( : std::nullopt), a_nullable_enum_(a_nullable_enum ? std::optional(*a_nullable_enum) : std::nullopt), + another_nullable_enum_(another_nullable_enum ? std::optional( + *another_nullable_enum) + : std::nullopt), a_nullable_string_(a_nullable_string ? std::optional(*a_nullable_string) : std::nullopt), @@ -1109,6 +1153,22 @@ void AllNullableTypesWithoutRecursion::set_a_nullable_enum( a_nullable_enum_ = value_arg; } +const AnotherEnum* AllNullableTypesWithoutRecursion::another_nullable_enum() + const { + return another_nullable_enum_ ? &(*another_nullable_enum_) : nullptr; +} + +void AllNullableTypesWithoutRecursion::set_another_nullable_enum( + const AnotherEnum* value_arg) { + another_nullable_enum_ = + value_arg ? std::optional(*value_arg) : std::nullopt; +} + +void AllNullableTypesWithoutRecursion::set_another_nullable_enum( + const AnotherEnum& value_arg) { + another_nullable_enum_ = value_arg; +} + const std::string* AllNullableTypesWithoutRecursion::a_nullable_string() const { return a_nullable_string_ ? &(*a_nullable_string_) : nullptr; } @@ -1228,7 +1288,7 @@ void AllNullableTypesWithoutRecursion::set_map(const EncodableMap& value_arg) { EncodableList AllNullableTypesWithoutRecursion::ToEncodableList() const { EncodableList list; - list.reserve(20); + list.reserve(21); list.push_back(a_nullable_bool_ ? EncodableValue(*a_nullable_bool_) : EncodableValue()); list.push_back(a_nullable_int_ ? EncodableValue(*a_nullable_int_) @@ -1259,6 +1319,9 @@ EncodableList AllNullableTypesWithoutRecursion::ToEncodableList() const { : EncodableValue()); list.push_back(a_nullable_enum_ ? CustomEncodableValue(*a_nullable_enum_) : EncodableValue()); + list.push_back(another_nullable_enum_ + ? CustomEncodableValue(*another_nullable_enum_) + : EncodableValue()); list.push_back(a_nullable_string_ ? EncodableValue(*a_nullable_string_) : EncodableValue()); list.push_back(a_nullable_object_ ? *a_nullable_object_ : EncodableValue()); @@ -1333,36 +1396,41 @@ AllNullableTypesWithoutRecursion::FromEncodableList(const EncodableList& list) { decoded.set_a_nullable_enum(std::any_cast( std::get(encodable_a_nullable_enum))); } - auto& encodable_a_nullable_string = list[12]; + auto& encodable_another_nullable_enum = list[12]; + if (!encodable_another_nullable_enum.IsNull()) { + decoded.set_another_nullable_enum(std::any_cast( + std::get(encodable_another_nullable_enum))); + } + auto& encodable_a_nullable_string = list[13]; if (!encodable_a_nullable_string.IsNull()) { decoded.set_a_nullable_string( std::get(encodable_a_nullable_string)); } - auto& encodable_a_nullable_object = list[13]; + auto& encodable_a_nullable_object = list[14]; if (!encodable_a_nullable_object.IsNull()) { decoded.set_a_nullable_object(encodable_a_nullable_object); } - auto& encodable_list = list[14]; + auto& encodable_list = list[15]; if (!encodable_list.IsNull()) { decoded.set_list(std::get(encodable_list)); } - auto& encodable_string_list = list[15]; + auto& encodable_string_list = list[16]; if (!encodable_string_list.IsNull()) { decoded.set_string_list(std::get(encodable_string_list)); } - auto& encodable_int_list = list[16]; + auto& encodable_int_list = list[17]; if (!encodable_int_list.IsNull()) { decoded.set_int_list(std::get(encodable_int_list)); } - auto& encodable_double_list = list[17]; + auto& encodable_double_list = list[18]; if (!encodable_double_list.IsNull()) { decoded.set_double_list(std::get(encodable_double_list)); } - auto& encodable_bool_list = list[18]; + auto& encodable_bool_list = list[19]; if (!encodable_bool_list.IsNull()) { decoded.set_bool_list(std::get(encodable_bool_list)); } - auto& encodable_map = list[19]; + auto& encodable_map = list[20]; if (!encodable_map.IsNull()) { decoded.set_map(std::get(encodable_map)); } @@ -1523,53 +1591,81 @@ TestMessage TestMessage::FromEncodableList(const EncodableList& list) { return decoded; } -PigeonCodecSerializer::PigeonCodecSerializer() {} +PigeonInternalCodecSerializer::PigeonInternalCodecSerializer() {} -EncodableValue PigeonCodecSerializer::ReadValueOfType( +EncodableValue PigeonInternalCodecSerializer::ReadValueOfType( uint8_t type, flutter::ByteStreamReader* stream) const { switch (type) { - case 129: + case 129: { + const auto& encodable_enum_arg = ReadValue(stream); + const int64_t enum_arg_value = + encodable_enum_arg.IsNull() ? 0 : encodable_enum_arg.LongValue(); + return encodable_enum_arg.IsNull() + ? EncodableValue() + : CustomEncodableValue(static_cast(enum_arg_value)); + } + case 130: { + const auto& encodable_enum_arg = ReadValue(stream); + const int64_t enum_arg_value = + encodable_enum_arg.IsNull() ? 0 : encodable_enum_arg.LongValue(); + return encodable_enum_arg.IsNull() + ? EncodableValue() + : CustomEncodableValue( + static_cast(enum_arg_value)); + } + case 131: { return CustomEncodableValue(AllTypes::FromEncodableList( std::get(ReadValue(stream)))); - case 130: + } + case 132: { return CustomEncodableValue(AllNullableTypes::FromEncodableList( std::get(ReadValue(stream)))); - case 131: + } + case 133: { return CustomEncodableValue( AllNullableTypesWithoutRecursion::FromEncodableList( std::get(ReadValue(stream)))); - case 132: + } + case 134: { return CustomEncodableValue(AllClassesWrapper::FromEncodableList( std::get(ReadValue(stream)))); - case 133: + } + case 135: { return CustomEncodableValue(TestMessage::FromEncodableList( std::get(ReadValue(stream)))); - case 134: { - const auto& encodable_enum_arg = ReadValue(stream); - const int64_t enum_arg_value = - encodable_enum_arg.IsNull() ? 0 : encodable_enum_arg.LongValue(); - return encodable_enum_arg.IsNull() - ? EncodableValue() - : CustomEncodableValue(static_cast(enum_arg_value)); } default: return flutter::StandardCodecSerializer::ReadValueOfType(type, stream); } } -void PigeonCodecSerializer::WriteValue( +void PigeonInternalCodecSerializer::WriteValue( const EncodableValue& value, flutter::ByteStreamWriter* stream) const { if (const CustomEncodableValue* custom_value = std::get_if(&value)) { - if (custom_value->type() == typeid(AllTypes)) { + if (custom_value->type() == typeid(AnEnum)) { stream->WriteByte(129); + WriteValue(EncodableValue( + static_cast(std::any_cast(*custom_value))), + stream); + return; + } + if (custom_value->type() == typeid(AnotherEnum)) { + stream->WriteByte(130); + WriteValue(EncodableValue(static_cast( + std::any_cast(*custom_value))), + stream); + return; + } + if (custom_value->type() == typeid(AllTypes)) { + stream->WriteByte(131); WriteValue(EncodableValue( std::any_cast(*custom_value).ToEncodableList()), stream); return; } if (custom_value->type() == typeid(AllNullableTypes)) { - stream->WriteByte(130); + stream->WriteByte(132); WriteValue( EncodableValue( std::any_cast(*custom_value).ToEncodableList()), @@ -1577,7 +1673,7 @@ void PigeonCodecSerializer::WriteValue( return; } if (custom_value->type() == typeid(AllNullableTypesWithoutRecursion)) { - stream->WriteByte(131); + stream->WriteByte(133); WriteValue(EncodableValue(std::any_cast( *custom_value) .ToEncodableList()), @@ -1585,27 +1681,20 @@ void PigeonCodecSerializer::WriteValue( return; } if (custom_value->type() == typeid(AllClassesWrapper)) { - stream->WriteByte(132); + stream->WriteByte(134); WriteValue(EncodableValue(std::any_cast(*custom_value) .ToEncodableList()), stream); return; } if (custom_value->type() == typeid(TestMessage)) { - stream->WriteByte(133); + stream->WriteByte(135); WriteValue( EncodableValue( std::any_cast(*custom_value).ToEncodableList()), stream); return; } - if (custom_value->type() == typeid(AnEnum)) { - stream->WriteByte(134); - WriteValue(EncodableValue( - static_cast(std::any_cast(*custom_value))), - stream); - return; - } } flutter::StandardCodecSerializer::WriteValue(value, stream); } @@ -1613,7 +1702,7 @@ void PigeonCodecSerializer::WriteValue( /// The codec used by HostIntegrationCoreApi. const flutter::StandardMessageCodec& HostIntegrationCoreApi::GetCodec() { return flutter::StandardMessageCodec::GetInstance( - &PigeonCodecSerializer::GetInstance()); + &PigeonInternalCodecSerializer::GetInstance()); } // Sets up an instance of `HostIntegrationCoreApi` to handle messages through @@ -2138,6 +2227,43 @@ void HostIntegrationCoreApi::SetUp(flutter::BinaryMessenger* binary_messenger, channel.SetMessageHandler(nullptr); } } + { + BasicMessageChannel<> channel(binary_messenger, + "dev.flutter.pigeon.pigeon_integration_tests." + "HostIntegrationCoreApi.echoAnotherEnum" + + prepended_suffix, + &GetCodec()); + if (api != nullptr) { + channel.SetMessageHandler( + [api](const EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_another_enum_arg = args.at(0); + if (encodable_another_enum_arg.IsNull()) { + reply(WrapError("another_enum_arg unexpectedly null.")); + return; + } + const auto& another_enum_arg = std::any_cast( + std::get(encodable_another_enum_arg)); + ErrorOr output = + api->EchoAnotherEnum(another_enum_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + EncodableList wrapped; + wrapped.push_back( + CustomEncodableValue(std::move(output).TakeValue())); + reply(EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); + } else { + channel.SetMessageHandler(nullptr); + } + } { BasicMessageChannel<> channel( binary_messenger, @@ -2860,6 +2986,51 @@ void HostIntegrationCoreApi::SetUp(flutter::BinaryMessenger* binary_messenger, channel.SetMessageHandler(nullptr); } } + { + BasicMessageChannel<> channel( + binary_messenger, + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." + "echoAnotherNullableEnum" + + prepended_suffix, + &GetCodec()); + if (api != nullptr) { + channel.SetMessageHandler( + [api](const EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_another_enum_arg = args.at(0); + AnotherEnum another_enum_arg_value; + const AnotherEnum* another_enum_arg = nullptr; + if (!encodable_another_enum_arg.IsNull()) { + another_enum_arg_value = std::any_cast( + std::get(encodable_another_enum_arg)); + another_enum_arg = &another_enum_arg_value; + } + ErrorOr> output = + api->EchoAnotherNullableEnum( + another_enum_arg ? &(*another_enum_arg) : nullptr); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + EncodableList wrapped; + auto output_optional = std::move(output).TakeValue(); + if (output_optional) { + wrapped.push_back( + CustomEncodableValue(std::move(output_optional).value())); + } else { + wrapped.push_back(EncodableValue()); + } + reply(EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); + } else { + channel.SetMessageHandler(nullptr); + } + } { BasicMessageChannel<> channel( binary_messenger, @@ -3310,6 +3481,45 @@ void HostIntegrationCoreApi::SetUp(flutter::BinaryMessenger* binary_messenger, channel.SetMessageHandler(nullptr); } } + { + BasicMessageChannel<> channel( + binary_messenger, + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." + "echoAnotherAsyncEnum" + + prepended_suffix, + &GetCodec()); + if (api != nullptr) { + channel.SetMessageHandler( + [api](const EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_another_enum_arg = args.at(0); + if (encodable_another_enum_arg.IsNull()) { + reply(WrapError("another_enum_arg unexpectedly null.")); + return; + } + const auto& another_enum_arg = std::any_cast( + std::get(encodable_another_enum_arg)); + api->EchoAnotherAsyncEnum( + another_enum_arg, [reply](ErrorOr&& output) { + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + EncodableList wrapped; + wrapped.push_back( + CustomEncodableValue(std::move(output).TakeValue())); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); + } else { + channel.SetMessageHandler(nullptr); + } + } { BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.pigeon_integration_tests." @@ -3917,6 +4127,52 @@ void HostIntegrationCoreApi::SetUp(flutter::BinaryMessenger* binary_messenger, channel.SetMessageHandler(nullptr); } } + { + BasicMessageChannel<> channel( + binary_messenger, + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." + "echoAnotherAsyncNullableEnum" + + prepended_suffix, + &GetCodec()); + if (api != nullptr) { + channel.SetMessageHandler( + [api](const EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_another_enum_arg = args.at(0); + AnotherEnum another_enum_arg_value; + const AnotherEnum* another_enum_arg = nullptr; + if (!encodable_another_enum_arg.IsNull()) { + another_enum_arg_value = std::any_cast( + std::get(encodable_another_enum_arg)); + another_enum_arg = &another_enum_arg_value; + } + api->EchoAnotherAsyncNullableEnum( + another_enum_arg ? &(*another_enum_arg) : nullptr, + [reply](ErrorOr>&& output) { + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + EncodableList wrapped; + auto output_optional = std::move(output).TakeValue(); + if (output_optional) { + wrapped.push_back(CustomEncodableValue( + std::move(output_optional).value())); + } else { + wrapped.push_back(EncodableValue()); + } + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); + } else { + channel.SetMessageHandler(nullptr); + } + } { BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.pigeon_integration_tests." @@ -4546,6 +4802,45 @@ void HostIntegrationCoreApi::SetUp(flutter::BinaryMessenger* binary_messenger, channel.SetMessageHandler(nullptr); } } + { + BasicMessageChannel<> channel( + binary_messenger, + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." + "callFlutterEchoAnotherEnum" + + prepended_suffix, + &GetCodec()); + if (api != nullptr) { + channel.SetMessageHandler( + [api](const EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_another_enum_arg = args.at(0); + if (encodable_another_enum_arg.IsNull()) { + reply(WrapError("another_enum_arg unexpectedly null.")); + return; + } + const auto& another_enum_arg = std::any_cast( + std::get(encodable_another_enum_arg)); + api->CallFlutterEchoAnotherEnum( + another_enum_arg, [reply](ErrorOr&& output) { + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + EncodableList wrapped; + wrapped.push_back( + CustomEncodableValue(std::move(output).TakeValue())); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); + } else { + channel.SetMessageHandler(nullptr); + } + } { BasicMessageChannel<> channel( binary_messenger, @@ -4882,6 +5177,52 @@ void HostIntegrationCoreApi::SetUp(flutter::BinaryMessenger* binary_messenger, channel.SetMessageHandler(nullptr); } } + { + BasicMessageChannel<> channel( + binary_messenger, + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." + "callFlutterEchoAnotherNullableEnum" + + prepended_suffix, + &GetCodec()); + if (api != nullptr) { + channel.SetMessageHandler( + [api](const EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_another_enum_arg = args.at(0); + AnotherEnum another_enum_arg_value; + const AnotherEnum* another_enum_arg = nullptr; + if (!encodable_another_enum_arg.IsNull()) { + another_enum_arg_value = std::any_cast( + std::get(encodable_another_enum_arg)); + another_enum_arg = &another_enum_arg_value; + } + api->CallFlutterEchoAnotherNullableEnum( + another_enum_arg ? &(*another_enum_arg) : nullptr, + [reply](ErrorOr>&& output) { + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + EncodableList wrapped; + auto output_optional = std::move(output).TakeValue(); + if (output_optional) { + wrapped.push_back(CustomEncodableValue( + std::move(output_optional).value())); + } else { + wrapped.push_back(EncodableValue()); + } + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); + } else { + channel.SetMessageHandler(nullptr); + } + } { BasicMessageChannel<> channel( binary_messenger, @@ -4952,7 +5293,7 @@ FlutterIntegrationCoreApi::FlutterIntegrationCoreApi( const flutter::StandardMessageCodec& FlutterIntegrationCoreApi::GetCodec() { return flutter::StandardMessageCodec::GetInstance( - &PigeonCodecSerializer::GetInstance()); + &PigeonInternalCodecSerializer::GetInstance()); } void FlutterIntegrationCoreApi::Noop( @@ -5563,6 +5904,44 @@ void FlutterIntegrationCoreApi::EchoEnum( }); } +void FlutterIntegrationCoreApi::EchoAnotherEnum( + const AnotherEnum& another_enum_arg, + std::function&& on_success, + std::function&& on_error) { + const std::string channel_name = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi." + "echoAnotherEnum" + + message_channel_suffix_; + BasicMessageChannel<> channel(binary_messenger_, channel_name, &GetCodec()); + EncodableValue encoded_api_arguments = EncodableValue(EncodableList{ + CustomEncodableValue(another_enum_arg), + }); + channel.Send( + encoded_api_arguments, [channel_name, on_success = std::move(on_success), + on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto* list_return_value = + std::get_if(&encodable_return_value); + if (list_return_value) { + if (list_return_value->size() > 1) { + on_error( + FlutterError(std::get(list_return_value->at(0)), + std::get(list_return_value->at(1)), + list_return_value->at(2))); + } else { + const auto& return_value = std::any_cast( + std::get(list_return_value->at(0))); + on_success(return_value); + } + } else { + on_error(CreateConnectionError(channel_name)); + } + }); +} + void FlutterIntegrationCoreApi::EchoNullableBool( const bool* a_bool_arg, std::function&& on_success, std::function&& on_error) { @@ -5871,6 +6250,50 @@ void FlutterIntegrationCoreApi::EchoNullableEnum( }); } +void FlutterIntegrationCoreApi::EchoAnotherNullableEnum( + const AnotherEnum* another_enum_arg, + std::function&& on_success, + std::function&& on_error) { + const std::string channel_name = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi." + "echoAnotherNullableEnum" + + message_channel_suffix_; + BasicMessageChannel<> channel(binary_messenger_, channel_name, &GetCodec()); + EncodableValue encoded_api_arguments = EncodableValue(EncodableList{ + another_enum_arg ? CustomEncodableValue(*another_enum_arg) + : EncodableValue(), + }); + channel.Send( + encoded_api_arguments, [channel_name, on_success = std::move(on_success), + on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto* list_return_value = + std::get_if(&encodable_return_value); + if (list_return_value) { + if (list_return_value->size() > 1) { + on_error( + FlutterError(std::get(list_return_value->at(0)), + std::get(list_return_value->at(1)), + list_return_value->at(2))); + } else { + AnotherEnum return_value_value; + const AnotherEnum* return_value = nullptr; + if (!list_return_value->at(0).IsNull()) { + return_value_value = std::any_cast( + std::get(list_return_value->at(0))); + return_value = &return_value_value; + } + on_success(return_value); + } + } else { + on_error(CreateConnectionError(channel_name)); + } + }); +} + void FlutterIntegrationCoreApi::NoopAsync( std::function&& on_success, std::function&& on_error) { @@ -5945,7 +6368,7 @@ void FlutterIntegrationCoreApi::EchoAsyncString( /// The codec used by HostTrivialApi. const flutter::StandardMessageCodec& HostTrivialApi::GetCodec() { return flutter::StandardMessageCodec::GetInstance( - &PigeonCodecSerializer::GetInstance()); + &PigeonInternalCodecSerializer::GetInstance()); } // Sets up an instance of `HostTrivialApi` to handle messages through the @@ -6006,7 +6429,7 @@ EncodableValue HostTrivialApi::WrapError(const FlutterError& error) { /// The codec used by HostSmallApi. const flutter::StandardMessageCodec& HostSmallApi::GetCodec() { return flutter::StandardMessageCodec::GetInstance( - &PigeonCodecSerializer::GetInstance()); + &PigeonInternalCodecSerializer::GetInstance()); } // Sets up an instance of `HostSmallApi` to handle messages through the @@ -6116,7 +6539,7 @@ FlutterSmallApi::FlutterSmallApi(flutter::BinaryMessenger* binary_messenger, const flutter::StandardMessageCodec& FlutterSmallApi::GetCodec() { return flutter::StandardMessageCodec::GetInstance( - &PigeonCodecSerializer::GetInstance()); + &PigeonInternalCodecSerializer::GetInstance()); } void FlutterSmallApi::EchoWrappedList( diff --git a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h index 1d0b6428959..53419f806f7 100644 --- a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h +++ b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h @@ -73,6 +73,8 @@ enum class AnEnum { kFourHundredTwentyTwo = 4 }; +enum class AnotherEnum { kJustInCase = 0 }; + // A class containing all supported types. // // Generated class from Pigeon that represents data sent in messages. @@ -84,7 +86,8 @@ class AllTypes { const std::vector& a4_byte_array, const std::vector& a8_byte_array, const std::vector& a_float_array, - const AnEnum& an_enum, const std::string& a_string, + const AnEnum& an_enum, const AnotherEnum& another_enum, + const std::string& a_string, const flutter::EncodableValue& an_object, const flutter::EncodableList& list, const flutter::EncodableList& string_list, @@ -120,6 +123,9 @@ class AllTypes { const AnEnum& an_enum() const; void set_an_enum(const AnEnum& value_arg); + const AnotherEnum& another_enum() const; + void set_another_enum(const AnotherEnum& value_arg); + const std::string& a_string() const; void set_a_string(std::string_view value_arg); @@ -153,7 +159,7 @@ class AllTypes { friend class HostTrivialApi; friend class HostSmallApi; friend class FlutterSmallApi; - friend class PigeonCodecSerializer; + friend class PigeonInternalCodecSerializer; friend class CoreTestsTest; bool a_bool_; int64_t an_int_; @@ -164,6 +170,7 @@ class AllTypes { std::vector a8_byte_array_; std::vector a_float_array_; AnEnum an_enum_; + AnotherEnum another_enum_; std::string a_string_; flutter::EncodableValue an_object_; flutter::EncodableList list_; @@ -193,7 +200,8 @@ class AllNullableTypes { const flutter::EncodableList* nullable_nested_list, const flutter::EncodableMap* nullable_map_with_annotations, const flutter::EncodableMap* nullable_map_with_object, - const AnEnum* a_nullable_enum, const std::string* a_nullable_string, + const AnEnum* a_nullable_enum, const AnotherEnum* another_nullable_enum, + const std::string* a_nullable_string, const flutter::EncodableValue* a_nullable_object, const AllNullableTypes* all_nullable_types, const flutter::EncodableList* list, @@ -259,6 +267,10 @@ class AllNullableTypes { void set_a_nullable_enum(const AnEnum* value_arg); void set_a_nullable_enum(const AnEnum& value_arg); + const AnotherEnum* another_nullable_enum() const; + void set_another_nullable_enum(const AnotherEnum* value_arg); + void set_another_nullable_enum(const AnotherEnum& value_arg); + const std::string* a_nullable_string() const; void set_a_nullable_string(const std::string_view* value_arg); void set_a_nullable_string(std::string_view value_arg); @@ -308,7 +320,7 @@ class AllNullableTypes { friend class HostTrivialApi; friend class HostSmallApi; friend class FlutterSmallApi; - friend class PigeonCodecSerializer; + friend class PigeonInternalCodecSerializer; friend class CoreTestsTest; std::optional a_nullable_bool_; std::optional a_nullable_int_; @@ -322,6 +334,7 @@ class AllNullableTypes { std::optional nullable_map_with_annotations_; std::optional nullable_map_with_object_; std::optional a_nullable_enum_; + std::optional another_nullable_enum_; std::optional a_nullable_string_; std::optional a_nullable_object_; std::unique_ptr all_nullable_types_; @@ -355,7 +368,8 @@ class AllNullableTypesWithoutRecursion { const flutter::EncodableList* nullable_nested_list, const flutter::EncodableMap* nullable_map_with_annotations, const flutter::EncodableMap* nullable_map_with_object, - const AnEnum* a_nullable_enum, const std::string* a_nullable_string, + const AnEnum* a_nullable_enum, const AnotherEnum* another_nullable_enum, + const std::string* a_nullable_string, const flutter::EncodableValue* a_nullable_object, const flutter::EncodableList* list, const flutter::EncodableList* string_list, @@ -414,6 +428,10 @@ class AllNullableTypesWithoutRecursion { void set_a_nullable_enum(const AnEnum* value_arg); void set_a_nullable_enum(const AnEnum& value_arg); + const AnotherEnum* another_nullable_enum() const; + void set_another_nullable_enum(const AnotherEnum* value_arg); + void set_another_nullable_enum(const AnotherEnum& value_arg); + const std::string* a_nullable_string() const; void set_a_nullable_string(const std::string_view* value_arg); void set_a_nullable_string(std::string_view value_arg); @@ -456,7 +474,7 @@ class AllNullableTypesWithoutRecursion { friend class HostTrivialApi; friend class HostSmallApi; friend class FlutterSmallApi; - friend class PigeonCodecSerializer; + friend class PigeonInternalCodecSerializer; friend class CoreTestsTest; std::optional a_nullable_bool_; std::optional a_nullable_int_; @@ -470,6 +488,7 @@ class AllNullableTypesWithoutRecursion { std::optional nullable_map_with_annotations_; std::optional nullable_map_with_object_; std::optional a_nullable_enum_; + std::optional another_nullable_enum_; std::optional a_nullable_string_; std::optional a_nullable_object_; std::optional list_; @@ -526,7 +545,7 @@ class AllClassesWrapper { friend class HostTrivialApi; friend class HostSmallApi; friend class FlutterSmallApi; - friend class PigeonCodecSerializer; + friend class PigeonInternalCodecSerializer; friend class CoreTestsTest; std::unique_ptr all_nullable_types_; std::unique_ptr @@ -557,16 +576,16 @@ class TestMessage { friend class HostTrivialApi; friend class HostSmallApi; friend class FlutterSmallApi; - friend class PigeonCodecSerializer; + friend class PigeonInternalCodecSerializer; friend class CoreTestsTest; std::optional test_list_; }; -class PigeonCodecSerializer : public flutter::StandardCodecSerializer { +class PigeonInternalCodecSerializer : public flutter::StandardCodecSerializer { public: - PigeonCodecSerializer(); - inline static PigeonCodecSerializer& GetInstance() { - static PigeonCodecSerializer sInstance; + PigeonInternalCodecSerializer(); + inline static PigeonInternalCodecSerializer& GetInstance() { + static PigeonInternalCodecSerializer sInstance; return sInstance; } @@ -626,6 +645,9 @@ class HostIntegrationCoreApi { const AllClassesWrapper& wrapper) = 0; // Returns the passed enum to test serialization and deserialization. virtual ErrorOr EchoEnum(const AnEnum& an_enum) = 0; + // Returns the passed enum to test serialization and deserialization. + virtual ErrorOr EchoAnotherEnum( + const AnotherEnum& another_enum) = 0; // Returns the default string. virtual ErrorOr EchoNamedDefaultString( const std::string& a_string) = 0; @@ -683,6 +705,8 @@ class HostIntegrationCoreApi { const flutter::EncodableMap* a_nullable_map) = 0; virtual ErrorOr> EchoNullableEnum( const AnEnum* an_enum) = 0; + virtual ErrorOr> EchoAnotherNullableEnum( + const AnotherEnum* another_enum) = 0; // Returns passed in int. virtual ErrorOr> EchoOptionalNullableInt( const int64_t* a_nullable_int) = 0; @@ -729,6 +753,11 @@ class HostIntegrationCoreApi { virtual void EchoAsyncEnum( const AnEnum& an_enum, std::function reply)> result) = 0; + // Returns the passed enum, to test asynchronous serialization and + // deserialization. + virtual void EchoAnotherAsyncEnum( + const AnotherEnum& another_enum, + std::function reply)> result) = 0; // Responds with an error from an async function returning a value. virtual void ThrowAsyncError( std::function> reply)> @@ -799,6 +828,12 @@ class HostIntegrationCoreApi { virtual void EchoAsyncNullableEnum( const AnEnum* an_enum, std::function> reply)> result) = 0; + // Returns the passed enum, to test asynchronous serialization and + // deserialization. + virtual void EchoAnotherAsyncNullableEnum( + const AnotherEnum* another_enum, + std::function> reply)> + result) = 0; virtual void CallFlutterNoop( std::function reply)> result) = 0; virtual void CallFlutterThrowError( @@ -848,6 +883,9 @@ class HostIntegrationCoreApi { virtual void CallFlutterEchoEnum( const AnEnum& an_enum, std::function reply)> result) = 0; + virtual void CallFlutterEchoAnotherEnum( + const AnotherEnum& another_enum, + std::function reply)> result) = 0; virtual void CallFlutterEchoNullableBool( const bool* a_bool, std::function> reply)> result) = 0; @@ -876,6 +914,10 @@ class HostIntegrationCoreApi { virtual void CallFlutterEchoNullableEnum( const AnEnum* an_enum, std::function> reply)> result) = 0; + virtual void CallFlutterEchoAnotherNullableEnum( + const AnotherEnum* another_enum, + std::function> reply)> + result) = 0; virtual void CallFlutterSmallApiEchoString( const std::string& a_string, std::function reply)> result) = 0; @@ -977,6 +1019,10 @@ class FlutterIntegrationCoreApi { void EchoEnum(const AnEnum& an_enum, std::function&& on_success, std::function&& on_error); + // Returns the passed enum to test serialization and deserialization. + void EchoAnotherEnum(const AnotherEnum& another_enum, + std::function&& on_success, + std::function&& on_error); // Returns the passed boolean, to test serialization and deserialization. void EchoNullableBool(const bool* a_bool, std::function&& on_success, @@ -1012,6 +1058,11 @@ class FlutterIntegrationCoreApi { void EchoNullableEnum(const AnEnum* an_enum, std::function&& on_success, std::function&& on_error); + // Returns the passed enum to test serialization and deserialization. + void EchoAnotherNullableEnum( + const AnotherEnum* another_enum, + std::function&& on_success, + std::function&& on_error); // A no-op function taking no arguments and returning no value, to sanity // test basic asynchronous calling. void NoopAsync(std::function&& on_success, diff --git a/packages/pigeon/platform_tests/test_plugin/windows/test/pigeon_test.cpp b/packages/pigeon/platform_tests/test_plugin/windows/test/pigeon_test.cpp index 427a62f06c6..53e7f8ddadb 100644 --- a/packages/pigeon/platform_tests/test_plugin/windows/test/pigeon_test.cpp +++ b/packages/pigeon/platform_tests/test_plugin/windows/test/pigeon_test.cpp @@ -137,7 +137,7 @@ TEST(PigeonTests, CallSearch) { Writer writer; flutter::EncodableList args; args.push_back(flutter::CustomEncodableValue(request)); - PigeonCodecSerializer::GetInstance().WriteValue(args, &writer); + PigeonInternalCodecSerializer::GetInstance().WriteValue(args, &writer); handler(writer.data_.data(), writer.data_.size(), reply); EXPECT_TRUE(did_call_reply); } diff --git a/packages/pigeon/platform_tests/test_plugin/windows/test_plugin.cpp b/packages/pigeon/platform_tests/test_plugin/windows/test_plugin.cpp index 0dd3e13ce19..e8f77369928 100644 --- a/packages/pigeon/platform_tests/test_plugin/windows/test_plugin.cpp +++ b/packages/pigeon/platform_tests/test_plugin/windows/test_plugin.cpp @@ -21,6 +21,7 @@ using core_tests_pigeontest::AllNullableTypes; using core_tests_pigeontest::AllNullableTypesWithoutRecursion; using core_tests_pigeontest::AllTypes; using core_tests_pigeontest::AnEnum; +using core_tests_pigeontest::AnotherEnum; using core_tests_pigeontest::ErrorOr; using core_tests_pigeontest::FlutterError; using core_tests_pigeontest::FlutterIntegrationCoreApi; @@ -151,6 +152,11 @@ ErrorOr TestPlugin::EchoClassWrapper( ErrorOr TestPlugin::EchoEnum(const AnEnum& an_enum) { return an_enum; } +ErrorOr TestPlugin::EchoAnotherEnum( + const AnotherEnum& another_enum) { + return another_enum; +} + ErrorOr TestPlugin::EchoNamedDefaultString( const std::string& a_string) { return a_string; @@ -292,6 +298,14 @@ ErrorOr> TestPlugin::EchoNullableEnum( return *an_enum; } +ErrorOr> TestPlugin::EchoAnotherNullableEnum( + const AnotherEnum* another_enum) { + if (!another_enum) { + return std::nullopt; + } + return *another_enum; +} + ErrorOr> TestPlugin::EchoOptionalNullableInt( const int64_t* a_nullable_int) { if (!a_nullable_int) { @@ -383,6 +397,12 @@ void TestPlugin::EchoAsyncEnum( result(an_enum); } +void TestPlugin::EchoAnotherAsyncEnum( + const AnotherEnum& another_enum, + std::function reply)> result) { + result(another_enum); +} + void TestPlugin::EchoAsyncNullableAllNullableTypes( const AllNullableTypes* everything, std::function> reply)> @@ -457,6 +477,13 @@ void TestPlugin::EchoAsyncNullableEnum( result(an_enum ? std::optional(*an_enum) : std::nullopt); } +void TestPlugin::EchoAnotherAsyncNullableEnum( + const AnotherEnum* another_enum, + std::function> reply)> result) { + result(another_enum ? std::optional(*another_enum) + : std::nullopt); +} + void TestPlugin::CallFlutterNoop( std::function reply)> result) { flutter_api_->Noop([result]() { result(std::nullopt); }, @@ -595,6 +622,14 @@ void TestPlugin::CallFlutterEchoEnum( [result](const FlutterError& error) { result(error); }); } +void TestPlugin::CallFlutterEchoAnotherEnum( + const AnotherEnum& another_enum, + std::function reply)> result) { + flutter_api_->EchoAnotherEnum( + another_enum, [result](const AnotherEnum& echo) { result(echo); }, + [result](const FlutterError& error) { result(error); }); +} + void TestPlugin::CallFlutterEchoNullableBool( const bool* a_bool, std::function> reply)> result) { @@ -685,6 +720,17 @@ void TestPlugin::CallFlutterEchoNullableEnum( [result](const FlutterError& error) { result(error); }); } +void TestPlugin::CallFlutterEchoAnotherNullableEnum( + const AnotherEnum* another_enum, + std::function> reply)> result) { + flutter_api_->EchoAnotherNullableEnum( + another_enum, + [result](const AnotherEnum* echo) { + result(echo ? std::optional(*echo) : std::nullopt); + }, + [result](const FlutterError& error) { result(error); }); +} + void TestPlugin::CallFlutterSmallApiEchoString( const std::string& a_string, std::function reply)> result) { diff --git a/packages/pigeon/platform_tests/test_plugin/windows/test_plugin.h b/packages/pigeon/platform_tests/test_plugin/windows/test_plugin.h index 0123df09022..deb0ab62cb4 100644 --- a/packages/pigeon/platform_tests/test_plugin/windows/test_plugin.h +++ b/packages/pigeon/platform_tests/test_plugin/windows/test_plugin.h @@ -88,6 +88,9 @@ class TestPlugin : public flutter::Plugin, const core_tests_pigeontest::AllClassesWrapper& wrapper) override; core_tests_pigeontest::ErrorOr EchoEnum( const core_tests_pigeontest::AnEnum& an_enum) override; + core_tests_pigeontest::ErrorOr + EchoAnotherEnum( + const core_tests_pigeontest::AnotherEnum& another_enum) override; core_tests_pigeontest::ErrorOr EchoNamedDefaultString( const std::string& a_string) override; core_tests_pigeontest::ErrorOr EchoOptionalDefaultDouble( @@ -127,6 +130,10 @@ class TestPlugin : public flutter::Plugin, EchoNullableMap(const flutter::EncodableMap* a_nullable_map) override; core_tests_pigeontest::ErrorOr> EchoNullableEnum(const core_tests_pigeontest::AnEnum* an_enum) override; + core_tests_pigeontest::ErrorOr< + std::optional> + EchoAnotherNullableEnum( + const core_tests_pigeontest::AnotherEnum* another_enum) override; core_tests_pigeontest::ErrorOr> EchoOptionalNullableInt(const int64_t* a_nullable_int) override; core_tests_pigeontest::ErrorOr> @@ -208,6 +215,12 @@ class TestPlugin : public flutter::Plugin, std::function reply)> result) override; + void EchoAnotherAsyncEnum( + const core_tests_pigeontest::AnotherEnum& another_enum, + std::function + reply)> + result) override; void EchoAsyncNullableInt( const int64_t* an_int, std::function< @@ -258,6 +271,12 @@ class TestPlugin : public flutter::Plugin, std::optional> reply)> result) override; + void EchoAnotherAsyncNullableEnum( + const core_tests_pigeontest::AnotherEnum* another_enum, + std::function> + reply)> + result) override; void CallFlutterNoop( std::function< void(std::optional reply)> @@ -341,6 +360,12 @@ class TestPlugin : public flutter::Plugin, std::function reply)> result) override; + void CallFlutterEchoAnotherEnum( + const core_tests_pigeontest::AnotherEnum& another_enum, + std::function + reply)> + result) override; void CallFlutterEchoNullableBool( const bool* a_bool, std::function< @@ -385,6 +410,12 @@ class TestPlugin : public flutter::Plugin, std::optional> reply)> result) override; + void CallFlutterEchoAnotherNullableEnum( + const core_tests_pigeontest::AnotherEnum* another_enum, + std::function> + reply)> + result) override; void CallFlutterSmallApiEchoString( const std::string& a_string, std::function reply)> diff --git a/packages/pigeon/pubspec.yaml b/packages/pigeon/pubspec.yaml index f58356d75f8..65d27bdb3fb 100644 --- a/packages/pigeon/pubspec.yaml +++ b/packages/pigeon/pubspec.yaml @@ -2,7 +2,7 @@ name: pigeon description: Code generator tool to make communication between Flutter and the host platform type-safe and easier. repository: https://github.com/flutter/packages/tree/main/packages/pigeon issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+pigeon%22 -version: 21.1.0 # This must match the version in lib/generator_tools.dart +version: 21.2.0 # This must match the version in lib/generator_tools.dart environment: sdk: ^3.3.0 diff --git a/packages/pigeon/test/dart/proxy_api_test.dart b/packages/pigeon/test/dart/proxy_api_test.dart index a8b3a5a9eb0..8e7f230f7ed 100644 --- a/packages/pigeon/test/dart/proxy_api_test.dart +++ b/packages/pigeon/test/dart/proxy_api_test.dart @@ -80,18 +80,19 @@ void main() { final String collapsedCode = _collapseNewlineAndIndentation(code); // Instance Manager - expect(code, contains(r'class PigeonInstanceManager')); - expect(code, contains(r'class _PigeonInstanceManagerApi')); + expect(code, contains(r'class PigeonInternalInstanceManager')); + expect(code, contains(r'class _PigeonInternalInstanceManagerApi')); // Base Api class expect( code, - contains(r'abstract class PigeonProxyApiBaseClass'), + contains(r'abstract class PigeonInternalProxyApiBaseClass'), ); // Codec and class - expect(code, contains('class _PigeonProxyApiBaseCodec')); - expect(code, contains(r'class Api extends PigeonProxyApiBaseClass')); + expect(code, contains('class _PigeonInternalProxyApiBaseCodec')); + expect( + code, contains(r'class Api extends PigeonInternalProxyApiBaseClass')); // Constructors expect( @@ -146,7 +147,7 @@ void main() { final String code = sink.toString(); final String collapsedCode = _collapseNewlineAndIndentation(code); - expect(code, contains(r'class _PigeonInstanceManagerApi')); + expect(code, contains(r'class _PigeonInternalInstanceManagerApi')); expect( code, @@ -157,13 +158,13 @@ void main() { expect( code, contains( - 'dev.flutter.pigeon.$DEFAULT_PACKAGE_NAME.PigeonInstanceManagerApi.removeStrongReference', + 'dev.flutter.pigeon.$DEFAULT_PACKAGE_NAME.PigeonInternalInstanceManagerApi.removeStrongReference', ), ); expect( collapsedCode, contains( - '(instanceManager ?? PigeonInstanceManager.instance) .remove(arg_identifier!);', + '(instanceManager ?? PigeonInternalInstanceManager.instance) .remove(arg_identifier!);', ), ); @@ -171,7 +172,7 @@ void main() { expect( code, contains( - 'dev.flutter.pigeon.$DEFAULT_PACKAGE_NAME.PigeonInstanceManagerApi.clear', + 'dev.flutter.pigeon.$DEFAULT_PACKAGE_NAME.PigeonInternalInstanceManagerApi.clear', ), ); }); @@ -252,7 +253,7 @@ void main() { expect( code, contains( - r'class Api extends PigeonProxyApiBaseClass implements Api2', + r'class Api extends PigeonInternalProxyApiBaseClass implements Api2', ), ); }); @@ -304,7 +305,7 @@ void main() { expect( code, contains( - r'class Api extends PigeonProxyApiBaseClass implements Api2, Api3', + r'class Api extends PigeonInternalProxyApiBaseClass implements Api2, Api3', ), ); }); @@ -359,7 +360,7 @@ void main() { expect( code, contains( - r'class Api extends PigeonProxyApiBaseClass implements Api2', + r'class Api extends PigeonInternalProxyApiBaseClass implements Api2', ), ); expect( @@ -409,13 +410,13 @@ void main() { expect( collapsedCode, contains( - r"const String __pigeon_channelName = 'dev.flutter.pigeon.test_package.Api.pigeon_defaultConstructor';", + r"const String pigeonVar_channelName = 'dev.flutter.pigeon.test_package.Api.pigeon_defaultConstructor';", ), ); expect( collapsedCode, contains( - r'__pigeon_channel .send([__pigeon_instanceIdentifier])', + r'pigeonVar_channel .send([pigeonVar_instanceIdentifier])', ), ); }); @@ -515,8 +516,8 @@ void main() { expect( collapsedCode, contains( - r'__pigeon_channel.send([ ' - r'__pigeon_instanceIdentifier, ' + r'pigeonVar_channel.send([ ' + r'pigeonVar_instanceIdentifier, ' r'validType, enumType, proxyApiType, ' r'nullableValidType, nullableEnumType, nullableProxyApiType ])', ), @@ -625,8 +626,8 @@ void main() { expect( collapsedCode, contains( - r'__pigeon_channel.send([ ' - r'__pigeon_instanceIdentifier, ' + r'pigeonVar_channel.send([ ' + r'pigeonVar_instanceIdentifier, ' r'validType, enumType, proxyApiType, ' r'nullableValidType, nullableEnumType, nullableProxyApiType ])', ), @@ -697,8 +698,8 @@ void main() { ); final String code = sink.toString(); expect(code, contains('class Api')); - expect(code, contains(r'late final Api2 aField = __pigeon_aField();')); - expect(code, contains(r'Api2 __pigeon_aField()')); + expect(code, contains(r'late final Api2 aField = pigeonVar_aField();')); + expect(code, contains(r'Api2 pigeonVar_aField()')); }); test('static attached field', () { @@ -743,8 +744,8 @@ void main() { final String code = sink.toString(); expect(code, contains('class Api')); expect( - code, contains(r'static final Api2 aField = __pigeon_aField();')); - expect(code, contains(r'static Api2 __pigeon_aField()')); + code, contains(r'static final Api2 aField = pigeonVar_aField();')); + expect(code, contains(r'static Api2 pigeonVar_aField()')); }); }); @@ -846,7 +847,7 @@ void main() { expect( collapsedCode, contains( - r'await __pigeon_channel.send([ this, validType, ' + r'await pigeonVar_channel.send([ this, validType, ' r'enumType, proxyApiType, nullableValidType, ' r'nullableEnumType, nullableProxyApiType ])', ), @@ -889,12 +890,12 @@ void main() { collapsedCode, contains( r'static Future doSomething({ BinaryMessenger? pigeon_binaryMessenger, ' - r'PigeonInstanceManager? pigeon_instanceManager, })', + r'PigeonInternalInstanceManager? pigeon_instanceManager, })', ), ); expect( collapsedCode, - contains(r'await __pigeon_channel.send(null)'), + contains(r'await pigeonVar_channel.send(null)'), ); }); }); diff --git a/packages/pigeon/test/dart_generator_test.dart b/packages/pigeon/test/dart_generator_test.dart index 944c6e334ce..93aacafd1cd 100644 --- a/packages/pigeon/test/dart_generator_test.dart +++ b/packages/pigeon/test/dart_generator_test.dart @@ -167,7 +167,7 @@ void main() { final String code = sink.toString(); expect(code, contains('class Api')); expect(code, contains('Future add(int x, int y)')); - expect(code, contains('await __pigeon_channel.send([x, y])')); + expect(code, contains('await pigeonVar_channel.send([x, y])')); }); test('flutter multiple args', () { @@ -573,7 +573,7 @@ void main() { final String code = sink.toString(); expect(code, contains('enum Foo {')); expect(code, contains('Future bar(Foo? foo) async')); - expect(code, contains('__pigeon_channel.send([foo])')); + expect(code, contains('pigeonVar_channel.send([foo])')); }); test('flutter non-nullable enum argument with enum class', () { @@ -664,7 +664,7 @@ void main() { dartPackageName: DEFAULT_PACKAGE_NAME, ); final String code = sink.toString(); - expect(code, matches('__pigeon_channel.send[(]null[)]')); + expect(code, matches('pigeonVar_channel.send[(]null[)]')); }); test('mock dart handler', () { @@ -953,7 +953,7 @@ void main() { dartPackageName: DEFAULT_PACKAGE_NAME, ); final String code = sink.toString(); - expect(code, matches('__pigeon_channel.send[(]null[)]')); + expect(code, matches('pigeonVar_channel.send[(]null[)]')); }); Iterable makeIterable(String string) sync* { @@ -1142,7 +1142,7 @@ void main() { expect( code, contains( - 'return (__pigeon_replyList[0] as List?)!.cast();')); + 'return (pigeonVar_replyList[0] as List?)!.cast();')); }); test('flutter generics argument non void return', () { @@ -1217,7 +1217,7 @@ void main() { ); final String code = sink.toString(); expect(code, contains('Future doit()')); - expect(code, contains('return (__pigeon_replyList[0] as int?);')); + expect(code, contains('return (pigeonVar_replyList[0] as int?);')); }); test('return nullable collection host', () { @@ -1252,7 +1252,7 @@ void main() { expect( code, contains( - 'return (__pigeon_replyList[0] as List?)?.cast();')); + 'return (pigeonVar_replyList[0] as List?)?.cast();')); }); test('return nullable async host', () { @@ -1283,7 +1283,7 @@ void main() { ); final String code = sink.toString(); expect(code, contains('Future doit()')); - expect(code, contains('return (__pigeon_replyList[0] as int?);')); + expect(code, contains('return (pigeonVar_replyList[0] as int?);')); }); test('return nullable flutter', () { @@ -1732,7 +1732,7 @@ name: foobar ); final String code = sink.toString(); expect( - code, contains('throw _createConnectionError(__pigeon_channelName);')); + code, contains('throw _createConnectionError(pigeonVar_channelName);')); expect( code, contains( diff --git a/packages/pigeon/test/java_generator_test.dart b/packages/pigeon/test/java_generator_test.dart index 3982c25150b..b58fe1ef739 100644 --- a/packages/pigeon/test/java_generator_test.dart +++ b/packages/pigeon/test/java_generator_test.dart @@ -85,7 +85,7 @@ void main() { expect(code, contains(' TWO_THREE_FOUR(1),')); expect(code, contains(' REMOTE_DB(2);')); expect(code, contains('final int index;')); - expect(code, contains('private Foobar(final int index) {')); + expect(code, contains('Foobar(final int index) {')); expect(code, contains(' this.index = index;')); }); @@ -118,7 +118,6 @@ void main() { ); final String code = sink.toString(); expect(code, contains('package com.google.foobar;')); - expect(code, contains('ArrayList toList()')); }); test('gen one host api', () { @@ -187,7 +186,6 @@ void main() { contains(RegExp( r'@NonNull\s*protected static ArrayList wrapError\(@NonNull Throwable exception\)'))); expect(code, isNot(contains('ArrayList '))); - expect(code, isNot(contains('ArrayList<>'))); }); test('all the simple datatypes header', () { @@ -736,7 +734,7 @@ void main() { expect(code, contains(' TWO_THREE_FOUR(1),')); expect(code, contains(' REMOTE_DB(2);')); expect(code, contains('final int index;')); - expect(code, contains('private Enum1(final int index) {')); + expect(code, contains('Enum1(final int index) {')); expect(code, contains(' this.index = index;')); expect(code, contains('toListResult.add(enum1);')); @@ -1159,7 +1157,7 @@ void main() { expect( code, contains(RegExp( - r'channel.send\(\s*new ArrayList\(Arrays.asList\(xArg, yArg\)\),\s*channelReply ->'))); + r'channel.send\(\s*new ArrayList<>\(Arrays.asList\(xArg, yArg\)\),\s*channelReply ->'))); }); test('flutter single args', () { @@ -1191,7 +1189,7 @@ void main() { expect( code, contains(RegExp( - r'channel.send\(\s*new ArrayList\(Collections.singletonList\(xArg\)\),\s*channelReply ->'))); + r'channel.send\(\s*new ArrayList<>\(Collections.singletonList\(xArg\)\),\s*channelReply ->'))); }); test('return nullable host', () { diff --git a/packages/pigeon/test/kotlin_generator_test.dart b/packages/pigeon/test/kotlin_generator_test.dart index ea87f508ca1..6f47e5b0672 100644 --- a/packages/pigeon/test/kotlin_generator_test.dart +++ b/packages/pigeon/test/kotlin_generator_test.dart @@ -51,7 +51,7 @@ void main() { final String code = sink.toString(); expect(code, contains('data class Foobar (')); expect(code, contains('val field1: Long? = null')); - expect(code, contains('fun fromList(__pigeon_list: List): Foobar')); + expect(code, contains('fun fromList(pigeonVar_list: List): Foobar')); expect(code, contains('fun toList(): List')); }); @@ -132,10 +132,10 @@ void main() { expect(code, contains('data class Bar (')); expect(code, contains('val field1: Foo,')); expect(code, contains('val field2: String')); - expect(code, contains('fun fromList(__pigeon_list: List): Bar')); + expect(code, contains('fun fromList(pigeonVar_list: List): Bar')); expect(code, contains('Foo.ofRaw(it)')); - expect(code, contains('val field1 = __pigeon_list[0] as Foo')); - expect(code, contains('val field2 = __pigeon_list[1] as String\n')); + expect(code, contains('val field1 = pigeonVar_list[0] as Foo')); + expect(code, contains('val field2 = pigeonVar_list[1] as String\n')); expect(code, contains('fun toList(): List')); }); @@ -394,7 +394,7 @@ void main() { expect( code, contains( - 'val aInt = __pigeon_list[1].let { num -> if (num is Int) num.toLong() else num as Long }')); + 'val aInt = pigeonVar_list[1].let { num -> if (num is Int) num.toLong() else num as Long }')); expect(code, contains('val aNullableBool: Boolean? = null')); expect(code, contains('val aNullableInt: Long? = null')); expect(code, contains('val aNullableDouble: Double? = null')); @@ -406,7 +406,7 @@ void main() { expect( code, contains( - 'val aNullableInt = __pigeon_list[9].let { num -> if (num is Int) num.toLong() else num as Long? }')); + 'val aNullableInt = pigeonVar_list[9].let { num -> if (num is Int) num.toLong() else num as Long? }')); }); test('gen one flutter api', () { @@ -736,8 +736,8 @@ void main() { expect(code, contains('data class Outer')); expect(code, contains('data class Nested')); expect(code, contains('val nested: Nested? = null')); - expect(code, contains('fun fromList(__pigeon_list: List): Outer')); - expect(code, contains('val nested = __pigeon_list[0] as Nested?')); + expect(code, contains('fun fromList(pigeonVar_list: List): Outer')); + expect(code, contains('val nested = pigeonVar_list[0] as Nested?')); expect(code, contains('fun toList(): List')); }); diff --git a/packages/pigeon/test/objc_generator_test.dart b/packages/pigeon/test/objc_generator_test.dart index 84146be42db..734145e2c24 100644 --- a/packages/pigeon/test/objc_generator_test.dart +++ b/packages/pigeon/test/objc_generator_test.dart @@ -248,7 +248,7 @@ void main() { contains( 'return enumAsNumber == nil ? nil : [[ACFooBox alloc] initWithValue:[enumAsNumber integerValue]];')); - expect(code, contains('ACFooBox * box = (ACFooBox *)value;')); + expect(code, contains('ACFooBox *box = (ACFooBox *)value;')); } }); diff --git a/packages/pigeon/test/swift_generator_test.dart b/packages/pigeon/test/swift_generator_test.dart index 6ffe4f4d9d7..b90db1e1f24 100644 --- a/packages/pigeon/test/swift_generator_test.dart +++ b/packages/pigeon/test/swift_generator_test.dart @@ -51,7 +51,7 @@ void main() { expect(code, contains('struct Foobar')); expect(code, contains('var field1: Int64? = nil')); expect(code, - contains('static func fromList(_ __pigeon_list: [Any?]) -> Foobar?')); + contains('static func fromList(_ pigeonVar_list: [Any?]) -> Foobar?')); expect(code, contains('func toList() -> [Any?]')); expect(code, isNot(contains('if ('))); }); @@ -123,7 +123,7 @@ void main() { code, contains( 'let enumResultAsInt: Int? = nilOrValue(self.readValue() as? Int)')); - expect(code, contains('enumResult = Foo(rawValue: enumResultAsInt)')); + expect(code, contains('return Foo(rawValue: enumResultAsInt)')); expect(code, contains('let fooArg = args[0] as! Foo')); expect(code, isNot(contains('if ('))); }); @@ -582,9 +582,9 @@ void main() { expect(code, contains('struct Nested')); expect(code, contains('var nested: Nested? = nil')); expect(code, - contains('static func fromList(_ __pigeon_list: [Any?]) -> Outer?')); + contains('static func fromList(_ pigeonVar_list: [Any?]) -> Outer?')); expect( - code, contains('let nested: Nested? = nilOrValue(__pigeon_list[0])')); + code, contains('let nested: Nested? = nilOrValue(pigeonVar_list[0])')); expect(code, contains('func toList() -> [Any?]')); expect(code, isNot(contains('if ('))); // Single-element list serializations should not have a trailing comma. diff --git a/packages/pigeon/tool/generate.dart b/packages/pigeon/tool/generate.dart index ecb465c1394..752e2ffadc2 100644 --- a/packages/pigeon/tool/generate.dart +++ b/packages/pigeon/tool/generate.dart @@ -23,6 +23,7 @@ const String _noFormatFlag = 'no-format'; const String _files = 'files'; const String _test = 'test'; const String _example = 'example'; +const String _overflowFiller = 'overflow'; const List _fileGroups = [_test, _example]; @@ -43,6 +44,13 @@ Future main(List args) async { ) ..addFlag(_helpFlag, negatable: false, abbr: 'h', help: 'Print this reference.') + ..addFlag( + _overflowFiller, + abbr: 'o', + help: + 'Injects 120 Enums into the pigeon ast, used for testing overflow utilities.', + hide: true, + ) ..addMultiOption(_files, help: 'Select specific groups of files to generate; $_test or $_example. Defaults to both.', @@ -59,13 +67,16 @@ ${parser.usage}'''); final String baseDir = p.dirname(p.dirname(Platform.script.toFilePath())); + final bool includeOverflow = argResults.wasParsed(_overflowFiller); + final List toGenerate = argResults.wasParsed(_files) ? argResults[_files] as List : _fileGroups; if (toGenerate.contains(_test)) { print('Generating platform_test/ output...'); - final int generateExitCode = await generateTestPigeons(baseDir: baseDir); + final int generateExitCode = await generateTestPigeons( + baseDir: baseDir, includeOverflow: includeOverflow); if (generateExitCode == 0) { print('Generation complete!'); } else { diff --git a/packages/pigeon/tool/run_tests.dart b/packages/pigeon/tool/run_tests.dart index ec5487b49e3..e380efdd14b 100644 --- a/packages/pigeon/tool/run_tests.dart +++ b/packages/pigeon/tool/run_tests.dart @@ -238,5 +238,5 @@ Future main(List args) async { exit(2); } - await runTests(testsToRun, ciMode: true); + await runTests(testsToRun, ciMode: true, includeOverflow: true); } diff --git a/packages/pigeon/tool/shared/generation.dart b/packages/pigeon/tool/shared/generation.dart index fe3c85b7fc7..6fcb2d0567c 100644 --- a/packages/pigeon/tool/shared/generation.dart +++ b/packages/pigeon/tool/shared/generation.dart @@ -55,7 +55,8 @@ Future generateExamplePigeons() async { ); } -Future generateTestPigeons({required String baseDir}) async { +Future generateTestPigeons( + {required String baseDir, bool includeOverflow = false}) async { // TODO(stuartmorgan): Make this dynamic rather than hard-coded. Or eliminate // it entirely; see https://github.com/flutter/flutter/issues/115169. const List inputs = [ @@ -132,6 +133,7 @@ Future generateTestPigeons({required String baseDir}) async { ? null : '$outputBase/windows/pigeon/$input.gen.cpp', cppNamespace: '${input}_pigeontest', + injectOverflowTypes: includeOverflow && input == 'core_tests', ); if (generateCode != 0) { return generateCode; @@ -148,6 +150,7 @@ Future generateTestPigeons({required String baseDir}) async { swiftErrorClassName: swiftErrorClassName, suppressVersion: true, dartPackageName: 'pigeon_integration_tests', + injectOverflowTypes: includeOverflow && input == 'core_tests', ); if (generateCode != 0) { return generateCode; @@ -174,6 +177,7 @@ Future generateTestPigeons({required String baseDir}) async { objcPrefix: input == 'core_tests' ? 'FLT' : '', suppressVersion: true, dartPackageName: 'pigeon_integration_tests', + injectOverflowTypes: includeOverflow && input == 'core_tests', ); if (generateCode != 0) { return generateCode; @@ -192,6 +196,7 @@ Future generateTestPigeons({required String baseDir}) async { : '$alternateOutputBase/macos/Classes/$pascalCaseName.gen.m', suppressVersion: true, dartPackageName: 'pigeon_integration_tests', + injectOverflowTypes: includeOverflow && input == 'core_tests', ); if (generateCode != 0) { return generateCode; @@ -225,6 +230,7 @@ Future runPigeon({ String copyrightHeader = './copyright_header.txt', String? basePath, String? dartPackageName, + bool injectOverflowTypes = false, }) async { // Temporarily suppress the version output via the global flag if requested. // This is done because having the version in all the generated test output @@ -238,36 +244,39 @@ Future runPigeon({ if (suppressVersion) { includeVersionInGeneratedWarning = false; } - final int result = await Pigeon.runWithOptions(PigeonOptions( - input: input, - copyrightHeader: copyrightHeader, - dartOut: dartOut, - dartTestOut: dartTestOut, - dartOptions: const DartOptions(), - cppHeaderOut: cppHeaderOut, - cppSourceOut: cppSourceOut, - cppOptions: CppOptions(namespace: cppNamespace), - gobjectHeaderOut: gobjectHeaderOut, - gobjectSourceOut: gobjectSourceOut, - gobjectOptions: GObjectOptions(module: gobjectModule), - javaOut: javaOut, - javaOptions: JavaOptions(package: javaPackage), - kotlinOut: kotlinOut, - kotlinOptions: KotlinOptions( - package: kotlinPackage, - errorClassName: kotlinErrorClassName, - includeErrorClass: kotlinIncludeErrorClass, + final int result = await Pigeon.runWithOptions( + PigeonOptions( + input: input, + copyrightHeader: copyrightHeader, + dartOut: dartOut, + dartTestOut: dartTestOut, + dartOptions: const DartOptions(), + cppHeaderOut: cppHeaderOut, + cppSourceOut: cppSourceOut, + cppOptions: CppOptions(namespace: cppNamespace), + gobjectHeaderOut: gobjectHeaderOut, + gobjectSourceOut: gobjectSourceOut, + gobjectOptions: GObjectOptions(module: gobjectModule), + javaOut: javaOut, + javaOptions: JavaOptions(package: javaPackage), + kotlinOut: kotlinOut, + kotlinOptions: KotlinOptions( + package: kotlinPackage, + errorClassName: kotlinErrorClassName, + includeErrorClass: kotlinIncludeErrorClass, + ), + objcHeaderOut: objcHeaderOut, + objcSourceOut: objcSourceOut, + objcOptions: ObjcOptions(prefix: objcPrefix), + swiftOut: swiftOut, + swiftOptions: SwiftOptions( + errorClassName: swiftErrorClassName, + ), + basePath: basePath, + dartPackageName: dartPackageName, ), - objcHeaderOut: objcHeaderOut, - objcSourceOut: objcSourceOut, - objcOptions: ObjcOptions(prefix: objcPrefix), - swiftOut: swiftOut, - swiftOptions: SwiftOptions( - errorClassName: swiftErrorClassName, - ), - basePath: basePath, - dartPackageName: dartPackageName, - )); + injectOverflowTypes: injectOverflowTypes, + ); includeVersionInGeneratedWarning = originalWarningSetting; return result; } diff --git a/packages/pigeon/tool/shared/test_runner.dart b/packages/pigeon/tool/shared/test_runner.dart index f222bf74c5b..cdb769fc029 100644 --- a/packages/pigeon/tool/shared/test_runner.dart +++ b/packages/pigeon/tool/shared/test_runner.dart @@ -18,31 +18,70 @@ Future runTests( bool runFormat = false, bool runGeneration = true, bool ciMode = false, + bool includeOverflow = false, }) async { final String baseDir = p.dirname(p.dirname(Platform.script.toFilePath())); if (runGeneration) { - // Pre-generate the necessary common output files. - // TODO(stuartmorgan): Consider making this conditional on the specific - // tests being run, as not all of them need these files. - print('# Generating platform_test/ output...'); - final int generateExitCode = await generateTestPigeons(baseDir: baseDir); - if (generateExitCode == 0) { - print('Generation complete!'); - } else { - print('Generation failed; see above for errors.'); - } + await _runGenerate(baseDir); } if (runFormat) { - print('Formatting generated output...'); - final int formatExitCode = - await formatAllFiles(repositoryRoot: p.dirname(p.dirname(baseDir))); - if (formatExitCode != 0) { - print('Formatting failed; see above for errors.'); - exit(formatExitCode); + await _runFormat(baseDir); + } + + await _runTests(testsToRun, ciMode: ciMode); + + if (includeOverflow) { + await _runGenerate(baseDir, includeOverflow: true); + + // TODO(tarrinneal): Remove linux filter once overflow class is added to gobject generator. + // https://github.com/flutter/flutter/issues/152916 + await _runTests(testsToRun + .where((String test) => + test.contains('integration') && !test.contains('linux')) + .toList()); + + if (!ciMode) { + await _runGenerate(baseDir); + } + + if (!ciMode && (runFormat || !runGeneration)) { + await _runFormat(baseDir); } } +} +// Pre-generate the necessary common output files. +Future _runGenerate(String baseDir, + {bool includeOverflow = false}) async { + // TODO(stuartmorgan): Consider making this conditional on the specific + // tests being run, as not all of them need these files. + print('# Generating platform_test/ output...'); + final int generateExitCode = await generateTestPigeons( + baseDir: baseDir, + includeOverflow: includeOverflow, + ); + if (generateExitCode == 0) { + print('Generation complete!'); + } else { + print('Generation failed; see above for errors.'); + } +} + +Future _runFormat(String baseDir) async { + print('Formatting generated output...'); + final int formatExitCode = + await formatAllFiles(repositoryRoot: p.dirname(p.dirname(baseDir))); + if (formatExitCode != 0) { + print('Formatting failed; see above for errors.'); + exit(formatExitCode); + } +} + +Future _runTests( + List testsToRun, { + bool ciMode = true, +}) async { for (final String test in testsToRun) { final TestInfo? info = testSuites[test]; if (info != null) { diff --git a/packages/pigeon/tool/test.dart b/packages/pigeon/tool/test.dart index 4dea945fef7..07c7dfdf61b 100644 --- a/packages/pigeon/tool/test.dart +++ b/packages/pigeon/tool/test.dart @@ -23,6 +23,7 @@ const String _testFlag = 'test'; const String _noGen = 'no-generation'; const String _listFlag = 'list'; const String _format = 'format'; +const String _overflow = 'overflow'; Future main(List args) async { final ArgParser parser = ArgParser() @@ -31,6 +32,10 @@ Future main(List args) async { abbr: 'g', help: 'Skips the generation step.', negatable: false) ..addFlag(_format, abbr: 'f', help: 'Formats generated test files before running tests.') + ..addFlag(_overflow, + help: + 'Generates overflow files for integration tests, runs tests with and without overflow files.', + abbr: 'o') ..addFlag(_listFlag, negatable: false, abbr: 'l', help: 'List available tests.') ..addFlag('help', @@ -122,5 +127,6 @@ ${parser.usage}'''); testsToRun, runGeneration: !argResults.wasParsed(_noGen), runFormat: argResults.wasParsed(_format), + includeOverflow: argResults.wasParsed(_overflow), ); }