From b58c0168c1a5cecbf8fc6b12991602531fd24e2f Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Thu, 18 Jan 2024 15:10:44 -0500 Subject: [PATCH 1/9] Format generated code --- .../ios/Classes/CoreTests.gen.swift | 1486 +++++++++++------ .../test_plugin/ios/Classes/TestPlugin.swift | 287 ++-- .../macos/Classes/CoreTests.gen.swift | 1486 +++++++++++------ .../macos/Classes/TestPlugin.swift | 287 ++-- 4 files changed, 2234 insertions(+), 1312 deletions(-) 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 773b6e5c12e..14bcb9a4113 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 @@ -1,17 +1,18 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// +// // Autogenerated from Pigeon, do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation + #if os(iOS) -import Flutter + import Flutter #elseif os(macOS) -import FlutterMacOS + import FlutterMacOS #else -#error("Unsupported platform.") + #error("Unsupported platform.") #endif private func wrapResult(_ result: Any?) -> [Any?] { @@ -23,18 +24,20 @@ private func wrapError(_ error: Any) -> [Any?] { return [ flutterError.code, flutterError.message, - flutterError.details + flutterError.details, ] } return [ "\(error)", "\(type(of: error))", - "Stacktrace: \(Thread.callStackSymbols)" + "Stacktrace: \(Thread.callStackSymbols)", ] } private func createConnectionError(withChannelName channelName: String) -> FlutterError { - return FlutterError(code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", details: "") + return FlutterError( + code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", + details: "") } private func isNullish(_ value: Any?) -> Bool { @@ -143,8 +146,10 @@ struct AllNullableTypes { static func fromList(_ list: [Any?]) -> AllNullableTypes? { let aNullableBool: Bool? = nilOrValue(list[0]) - let aNullableInt: Int64? = isNullish(list[1]) ? nil : (list[1] is Int64? ? list[1] as! Int64? : Int64(list[1] as! Int32)) - let aNullableInt64: Int64? = isNullish(list[2]) ? nil : (list[2] is Int64? ? list[2] as! Int64? : Int64(list[2] as! Int32)) + let aNullableInt: Int64? = + isNullish(list[1]) ? nil : (list[1] is Int64? ? list[1] as! Int64? : Int64(list[1] as! Int32)) + let aNullableInt64: Int64? = + isNullish(list[2]) ? nil : (list[2] is Int64? ? list[2] as! Int64? : Int64(list[2] as! Int32)) let aNullableDouble: Double? = nilOrValue(list[3]) let aNullableByteArray: FlutterStandardTypedData? = nilOrValue(list[4]) let aNullable4ByteArray: FlutterStandardTypedData? = nilOrValue(list[5]) @@ -250,7 +255,7 @@ struct TestMessage { } func toList() -> [Any?] { return [ - testList, + testList ] } } @@ -258,16 +263,16 @@ struct TestMessage { private class HostIntegrationCoreApiCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { - case 128: - return AllClassesWrapper.fromList(self.readValue() as! [Any?]) - case 129: - return AllNullableTypes.fromList(self.readValue() as! [Any?]) - case 130: - return AllTypes.fromList(self.readValue() as! [Any?]) - case 131: - return TestMessage.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) + case 128: + return AllClassesWrapper.fromList(self.readValue() as! [Any?]) + case 129: + return AllNullableTypes.fromList(self.readValue() as! [Any?]) + case 130: + return AllTypes.fromList(self.readValue() as! [Any?]) + case 131: + return TestMessage.fromList(self.readValue() as! [Any?]) + default: + return super.readValue(ofType: type) } } } @@ -303,7 +308,8 @@ private class HostIntegrationCoreApiCodecReaderWriter: FlutterStandardReaderWrit } class HostIntegrationCoreApiCodec: FlutterStandardMessageCodec { - static let shared = HostIntegrationCoreApiCodec(readerWriter: HostIntegrationCoreApiCodecReaderWriter()) + static let shared = HostIntegrationCoreApiCodec( + readerWriter: HostIntegrationCoreApiCodecReaderWriter()) } /// The core interface that each host language plugin must implement in @@ -357,7 +363,9 @@ protocol HostIntegrationCoreApi { /// sending of nested objects. func createNestedObject(with nullableString: String?) throws -> AllClassesWrapper /// Returns passed in arguments of multiple types. - func sendMultipleNullableTypes(aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String?) throws -> AllNullableTypes + func sendMultipleNullableTypes( + aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String? + ) throws -> AllNullableTypes /// Returns passed in int. func echo(_ aNullableInt: Int64?) throws -> Int64? /// Returns passed in double. @@ -391,13 +399,16 @@ protocol HostIntegrationCoreApi { /// Returns the passed string asynchronously. func echoAsync(_ aString: String, completion: @escaping (Result) -> Void) /// Returns the passed in Uint8List asynchronously. - func echoAsync(_ aUint8List: FlutterStandardTypedData, completion: @escaping (Result) -> Void) + func echoAsync( + _ aUint8List: FlutterStandardTypedData, + completion: @escaping (Result) -> Void) /// Returns the passed in generic Object asynchronously. func echoAsync(_ anObject: Any, completion: @escaping (Result) -> Void) /// Returns the passed list, to test asynchronous serialization and deserialization. func echoAsync(_ aList: [Any?], completion: @escaping (Result<[Any?], Error>) -> Void) /// Returns the passed map, to test asynchronous serialization and deserialization. - func echoAsync(_ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) + func echoAsync( + _ 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) /// Responds with an error from an async function returning a value. @@ -409,7 +420,9 @@ protocol HostIntegrationCoreApi { /// Returns the passed object, to test async serialization and deserialization. func echoAsync(_ everything: AllTypes, completion: @escaping (Result) -> Void) /// Returns the passed object, to test serialization and deserialization. - func echoAsync(_ everything: AllNullableTypes?, completion: @escaping (Result) -> Void) + func echoAsync( + _ everything: AllNullableTypes?, + completion: @escaping (Result) -> Void) /// Returns passed in int asynchronously. func echoAsyncNullable(_ anInt: Int64?, completion: @escaping (Result) -> Void) /// Returns passed in double asynchronously. @@ -419,37 +432,56 @@ protocol HostIntegrationCoreApi { /// Returns the passed string asynchronously. func echoAsyncNullable(_ aString: String?, completion: @escaping (Result) -> Void) /// Returns the passed in Uint8List asynchronously. - func echoAsyncNullable(_ aUint8List: FlutterStandardTypedData?, completion: @escaping (Result) -> Void) + func echoAsyncNullable( + _ aUint8List: FlutterStandardTypedData?, + completion: @escaping (Result) -> Void) /// Returns the passed in generic Object asynchronously. func echoAsyncNullable(_ anObject: Any?, completion: @escaping (Result) -> Void) /// Returns the passed list, to test asynchronous serialization and deserialization. func echoAsyncNullable(_ aList: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void) /// Returns the passed map, to test asynchronous serialization and deserialization. - func echoAsyncNullable(_ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) + func echoAsyncNullable( + _ 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) func callFlutterNoop(completion: @escaping (Result) -> Void) func callFlutterThrowError(completion: @escaping (Result) -> Void) func callFlutterThrowErrorFromVoid(completion: @escaping (Result) -> Void) - func callFlutterEcho(_ everything: AllTypes, completion: @escaping (Result) -> Void) - func callFlutterEcho(_ everything: AllNullableTypes?, completion: @escaping (Result) -> Void) - func callFlutterSendMultipleNullableTypes(aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String?, completion: @escaping (Result) -> Void) + func callFlutterEcho( + _ everything: AllTypes, completion: @escaping (Result) -> Void) + func callFlutterEcho( + _ everything: AllNullableTypes?, + completion: @escaping (Result) -> Void) + func callFlutterSendMultipleNullableTypes( + aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String?, + completion: @escaping (Result) -> Void) func callFlutterEcho(_ aBool: Bool, completion: @escaping (Result) -> Void) func callFlutterEcho(_ anInt: Int64, completion: @escaping (Result) -> Void) func callFlutterEcho(_ aDouble: Double, completion: @escaping (Result) -> Void) func callFlutterEcho(_ aString: String, completion: @escaping (Result) -> Void) - func callFlutterEcho(_ aList: FlutterStandardTypedData, completion: @escaping (Result) -> Void) + func callFlutterEcho( + _ aList: FlutterStandardTypedData, + completion: @escaping (Result) -> Void) func callFlutterEcho(_ aList: [Any?], completion: @escaping (Result<[Any?], Error>) -> Void) - func callFlutterEcho(_ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) + func callFlutterEcho( + _ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) func callFlutterEcho(_ anEnum: AnEnum, completion: @escaping (Result) -> Void) func callFlutterEchoNullable(_ aBool: Bool?, completion: @escaping (Result) -> Void) - func callFlutterEchoNullable(_ anInt: Int64?, completion: @escaping (Result) -> Void) - func callFlutterEchoNullable(_ aDouble: Double?, completion: @escaping (Result) -> Void) - func callFlutterEchoNullable(_ aString: String?, completion: @escaping (Result) -> Void) - func callFlutterEchoNullable(_ aList: FlutterStandardTypedData?, completion: @escaping (Result) -> Void) - func callFlutterEchoNullable(_ aList: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void) - func callFlutterEchoNullable(_ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) - func callFlutterNullableEcho(_ anEnum: AnEnum?, completion: @escaping (Result) -> Void) + func callFlutterEchoNullable( + _ anInt: Int64?, completion: @escaping (Result) -> Void) + func callFlutterEchoNullable( + _ aDouble: Double?, completion: @escaping (Result) -> Void) + func callFlutterEchoNullable( + _ aString: String?, completion: @escaping (Result) -> Void) + func callFlutterEchoNullable( + _ aList: FlutterStandardTypedData?, + completion: @escaping (Result) -> Void) + func callFlutterEchoNullable( + _ aList: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void) + func callFlutterEchoNullable( + _ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) + func callFlutterNullableEcho( + _ anEnum: AnEnum?, completion: @escaping (Result) -> Void) } /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. @@ -460,7 +492,9 @@ class HostIntegrationCoreApiSetup { static func setUp(binaryMessenger: FlutterBinaryMessenger, api: HostIntegrationCoreApi?) { /// A no-op function taking no arguments and returning no value, to sanity /// test basic calling. - let noopChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noop", binaryMessenger: binaryMessenger, codec: codec) + let noopChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noop", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { noopChannel.setMessageHandler { _, reply in do { @@ -474,7 +508,9 @@ class HostIntegrationCoreApiSetup { noopChannel.setMessageHandler(nil) } /// Returns the passed object, to test serialization and deserialization. - let echoAllTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllTypes", binaryMessenger: binaryMessenger, codec: codec) + let echoAllTypesChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAllTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -490,7 +526,9 @@ class HostIntegrationCoreApiSetup { echoAllTypesChannel.setMessageHandler(nil) } /// Returns an error, to test error handling. - let throwErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwError", binaryMessenger: binaryMessenger, codec: codec) + let throwErrorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwError", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwErrorChannel.setMessageHandler { _, reply in do { @@ -504,7 +542,9 @@ class HostIntegrationCoreApiSetup { throwErrorChannel.setMessageHandler(nil) } /// Returns an error from a void function, to test error handling. - let throwErrorFromVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwErrorFromVoid", binaryMessenger: binaryMessenger, codec: codec) + let throwErrorFromVoidChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwErrorFromVoid", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwErrorFromVoidChannel.setMessageHandler { _, reply in do { @@ -518,7 +558,9 @@ class HostIntegrationCoreApiSetup { throwErrorFromVoidChannel.setMessageHandler(nil) } /// Returns a Flutter error, to test error handling. - let throwFlutterErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwFlutterError", binaryMessenger: binaryMessenger, codec: codec) + let throwFlutterErrorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwFlutterError", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwFlutterErrorChannel.setMessageHandler { _, reply in do { @@ -532,7 +574,9 @@ class HostIntegrationCoreApiSetup { throwFlutterErrorChannel.setMessageHandler(nil) } /// Returns passed in int. - let echoIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoInt", binaryMessenger: binaryMessenger, codec: codec) + let echoIntChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -548,7 +592,9 @@ class HostIntegrationCoreApiSetup { echoIntChannel.setMessageHandler(nil) } /// Returns passed in double. - let echoDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoDouble", binaryMessenger: binaryMessenger, codec: codec) + let echoDoubleChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -564,7 +610,9 @@ class HostIntegrationCoreApiSetup { echoDoubleChannel.setMessageHandler(nil) } /// Returns the passed in boolean. - let echoBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoBool", binaryMessenger: binaryMessenger, codec: codec) + let echoBoolChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -580,7 +628,9 @@ class HostIntegrationCoreApiSetup { echoBoolChannel.setMessageHandler(nil) } /// Returns the passed in string. - let echoStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoString", binaryMessenger: binaryMessenger, codec: codec) + let echoStringChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -596,7 +646,9 @@ class HostIntegrationCoreApiSetup { echoStringChannel.setMessageHandler(nil) } /// Returns the passed in Uint8List. - let echoUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoUint8List", binaryMessenger: binaryMessenger, codec: codec) + let echoUint8ListChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -612,7 +664,9 @@ class HostIntegrationCoreApiSetup { echoUint8ListChannel.setMessageHandler(nil) } /// Returns the passed in generic Object. - let echoObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoObject", binaryMessenger: binaryMessenger, codec: codec) + let echoObjectChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoObject", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -628,7 +682,9 @@ class HostIntegrationCoreApiSetup { echoObjectChannel.setMessageHandler(nil) } /// Returns the passed list, to test serialization and deserialization. - let echoListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoList", binaryMessenger: binaryMessenger, codec: codec) + let echoListChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -644,7 +700,9 @@ class HostIntegrationCoreApiSetup { echoListChannel.setMessageHandler(nil) } /// Returns the passed map, to test serialization and deserialization. - let echoMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoMap", binaryMessenger: binaryMessenger, codec: codec) + let echoMapChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -660,7 +718,9 @@ class HostIntegrationCoreApiSetup { echoMapChannel.setMessageHandler(nil) } /// Returns the passed map to test nested class serialization and deserialization. - let echoClassWrapperChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoClassWrapper", binaryMessenger: binaryMessenger, codec: codec) + let echoClassWrapperChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoClassWrapper", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoClassWrapperChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -676,7 +736,9 @@ class HostIntegrationCoreApiSetup { echoClassWrapperChannel.setMessageHandler(nil) } /// Returns the passed enum to test serialization and deserialization. - let echoEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoEnum", binaryMessenger: binaryMessenger, codec: codec) + let echoEnumChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -692,7 +754,10 @@ class HostIntegrationCoreApiSetup { echoEnumChannel.setMessageHandler(nil) } /// Returns the default string. - let echoNamedDefaultStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedDefaultString", binaryMessenger: binaryMessenger, codec: codec) + let echoNamedDefaultStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedDefaultString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNamedDefaultStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -708,7 +773,10 @@ class HostIntegrationCoreApiSetup { echoNamedDefaultStringChannel.setMessageHandler(nil) } /// Returns passed in double. - let echoOptionalDefaultDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalDefaultDouble", binaryMessenger: binaryMessenger, codec: codec) + let echoOptionalDefaultDoubleChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalDefaultDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoOptionalDefaultDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -724,7 +792,9 @@ class HostIntegrationCoreApiSetup { echoOptionalDefaultDoubleChannel.setMessageHandler(nil) } /// Returns passed in int. - let echoRequiredIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoRequiredInt", binaryMessenger: binaryMessenger, codec: codec) + let echoRequiredIntChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoRequiredInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoRequiredIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -740,7 +810,10 @@ class HostIntegrationCoreApiSetup { echoRequiredIntChannel.setMessageHandler(nil) } /// Returns the passed object, to test serialization and deserialization. - let echoAllNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllNullableTypes", binaryMessenger: binaryMessenger, codec: codec) + let echoAllNullableTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllNullableTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAllNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -757,7 +830,10 @@ class HostIntegrationCoreApiSetup { } /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. - let extractNestedNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.extractNestedNullableString", binaryMessenger: binaryMessenger, codec: codec) + let extractNestedNullableStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.extractNestedNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { extractNestedNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -774,7 +850,10 @@ class HostIntegrationCoreApiSetup { } /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. - let createNestedNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.createNestedNullableString", binaryMessenger: binaryMessenger, codec: codec) + let createNestedNullableStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.createNestedNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { createNestedNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -790,15 +869,21 @@ class HostIntegrationCoreApiSetup { createNestedNullableStringChannel.setMessageHandler(nil) } /// Returns passed in arguments of multiple types. - let sendMultipleNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.sendMultipleNullableTypes", binaryMessenger: binaryMessenger, codec: codec) + let sendMultipleNullableTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.sendMultipleNullableTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { sendMultipleNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableBoolArg: Bool? = nilOrValue(args[0]) - let aNullableIntArg: Int64? = isNullish(args[1]) ? nil : (args[1] is Int64? ? args[1] as! Int64? : Int64(args[1] as! Int32)) + let aNullableIntArg: Int64? = + isNullish(args[1]) + ? nil : (args[1] is Int64? ? args[1] as! Int64? : Int64(args[1] as! Int32)) let aNullableStringArg: String? = nilOrValue(args[2]) do { - let result = try api.sendMultipleNullableTypes(aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg) + let result = try api.sendMultipleNullableTypes( + aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -808,11 +893,15 @@ class HostIntegrationCoreApiSetup { sendMultipleNullableTypesChannel.setMessageHandler(nil) } /// Returns passed in int. - let echoNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableInt", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableIntChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] - let aNullableIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) + let aNullableIntArg: Int64? = + isNullish(args[0]) + ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) do { let result = try api.echo(aNullableIntArg) reply(wrapResult(result)) @@ -824,7 +913,9 @@ class HostIntegrationCoreApiSetup { echoNullableIntChannel.setMessageHandler(nil) } /// Returns passed in double. - let echoNullableDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableDouble", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableDoubleChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -840,7 +931,9 @@ class HostIntegrationCoreApiSetup { echoNullableDoubleChannel.setMessageHandler(nil) } /// Returns the passed in boolean. - let echoNullableBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableBool", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableBoolChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -856,7 +949,9 @@ class HostIntegrationCoreApiSetup { echoNullableBoolChannel.setMessageHandler(nil) } /// Returns the passed in string. - let echoNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableString", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableStringChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -872,7 +967,10 @@ class HostIntegrationCoreApiSetup { echoNullableStringChannel.setMessageHandler(nil) } /// Returns the passed in Uint8List. - let echoNullableUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableUint8List", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableUint8ListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -888,7 +986,9 @@ class HostIntegrationCoreApiSetup { echoNullableUint8ListChannel.setMessageHandler(nil) } /// Returns the passed in generic Object. - let echoNullableObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableObject", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableObjectChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableObject", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -904,7 +1004,9 @@ class HostIntegrationCoreApiSetup { echoNullableObjectChannel.setMessageHandler(nil) } /// Returns the passed list, to test serialization and deserialization. - let echoNullableListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableList", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableListChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -920,7 +1022,9 @@ class HostIntegrationCoreApiSetup { echoNullableListChannel.setMessageHandler(nil) } /// Returns the passed map, to test serialization and deserialization. - let echoNullableMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableMap", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableMapChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -935,7 +1039,9 @@ class HostIntegrationCoreApiSetup { } else { echoNullableMapChannel.setMessageHandler(nil) } - let echoNullableEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableEnum", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableEnumChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -951,11 +1057,16 @@ class HostIntegrationCoreApiSetup { echoNullableEnumChannel.setMessageHandler(nil) } /// Returns passed in int. - let echoOptionalNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalNullableInt", binaryMessenger: binaryMessenger, codec: codec) + let echoOptionalNullableIntChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalNullableInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoOptionalNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] - let aNullableIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) + let aNullableIntArg: Int64? = + isNullish(args[0]) + ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) do { let result = try api.echoOptional(aNullableIntArg) reply(wrapResult(result)) @@ -967,7 +1078,10 @@ class HostIntegrationCoreApiSetup { echoOptionalNullableIntChannel.setMessageHandler(nil) } /// Returns the passed in string. - let echoNamedNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedNullableString", binaryMessenger: binaryMessenger, codec: codec) + let echoNamedNullableStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNamedNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -984,15 +1098,17 @@ class HostIntegrationCoreApiSetup { } /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. - let noopAsyncChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noopAsync", binaryMessenger: binaryMessenger, codec: codec) + let noopAsyncChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noopAsync", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { noopAsyncChannel.setMessageHandler { _, reply in - api.noopAsync() { result in + api.noopAsync { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1000,17 +1116,19 @@ class HostIntegrationCoreApiSetup { noopAsyncChannel.setMessageHandler(nil) } /// Returns passed in int asynchronously. - let echoAsyncIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncInt", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncIntChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anIntArg = args[0] is Int64 ? args[0] as! Int64 : Int64(args[0] as! Int32) api.echoAsync(anIntArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1018,17 +1136,19 @@ class HostIntegrationCoreApiSetup { echoAsyncIntChannel.setMessageHandler(nil) } /// Returns passed in double asynchronously. - let echoAsyncDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncDouble", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncDoubleChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aDoubleArg = args[0] as! Double api.echoAsync(aDoubleArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1036,17 +1156,19 @@ class HostIntegrationCoreApiSetup { echoAsyncDoubleChannel.setMessageHandler(nil) } /// Returns the passed in boolean asynchronously. - let echoAsyncBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncBool", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncBoolChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aBoolArg = args[0] as! Bool api.echoAsync(aBoolArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1054,17 +1176,19 @@ class HostIntegrationCoreApiSetup { echoAsyncBoolChannel.setMessageHandler(nil) } /// Returns the passed string asynchronously. - let echoAsyncStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncString", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncStringChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg = args[0] as! String api.echoAsync(aStringArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1072,17 +1196,19 @@ class HostIntegrationCoreApiSetup { echoAsyncStringChannel.setMessageHandler(nil) } /// Returns the passed in Uint8List asynchronously. - let echoAsyncUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncUint8List", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncUint8ListChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aUint8ListArg = args[0] as! FlutterStandardTypedData api.echoAsync(aUint8ListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1090,17 +1216,19 @@ class HostIntegrationCoreApiSetup { echoAsyncUint8ListChannel.setMessageHandler(nil) } /// Returns the passed in generic Object asynchronously. - let echoAsyncObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncObject", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncObjectChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncObject", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anObjectArg = args[0]! api.echoAsync(anObjectArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1108,17 +1236,19 @@ class HostIntegrationCoreApiSetup { echoAsyncObjectChannel.setMessageHandler(nil) } /// Returns the passed list, to test asynchronous serialization and deserialization. - let echoAsyncListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncList", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncListChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aListArg = args[0] as! [Any?] api.echoAsync(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1126,17 +1256,19 @@ class HostIntegrationCoreApiSetup { echoAsyncListChannel.setMessageHandler(nil) } /// Returns the passed map, to test asynchronous serialization and deserialization. - let echoAsyncMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncMap", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncMapChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aMapArg = args[0] as! [String?: Any?] api.echoAsync(aMapArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1144,17 +1276,19 @@ class HostIntegrationCoreApiSetup { echoAsyncMapChannel.setMessageHandler(nil) } /// Returns the passed enum, to test asynchronous serialization and deserialization. - let echoAsyncEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncEnum", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncEnumChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anEnumArg = AnEnum(rawValue: args[0] as! Int)! api.echoAsync(anEnumArg) { result in switch result { - case .success(let res): - reply(wrapResult(res.rawValue)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res.rawValue)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1162,15 +1296,17 @@ class HostIntegrationCoreApiSetup { echoAsyncEnumChannel.setMessageHandler(nil) } /// Responds with an error from an async function returning a value. - let throwAsyncErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncError", binaryMessenger: binaryMessenger, codec: codec) + let throwAsyncErrorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncError", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwAsyncErrorChannel.setMessageHandler { _, reply in - api.throwAsyncError() { result in + api.throwAsyncError { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1178,15 +1314,18 @@ class HostIntegrationCoreApiSetup { throwAsyncErrorChannel.setMessageHandler(nil) } /// Responds with an error from an async void function. - let throwAsyncErrorFromVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncErrorFromVoid", binaryMessenger: binaryMessenger, codec: codec) + let throwAsyncErrorFromVoidChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncErrorFromVoid", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwAsyncErrorFromVoidChannel.setMessageHandler { _, reply in - api.throwAsyncErrorFromVoid() { result in + api.throwAsyncErrorFromVoid { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1194,15 +1333,18 @@ class HostIntegrationCoreApiSetup { throwAsyncErrorFromVoidChannel.setMessageHandler(nil) } /// Responds with a Flutter error from an async function returning a value. - let throwAsyncFlutterErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncFlutterError", binaryMessenger: binaryMessenger, codec: codec) + let throwAsyncFlutterErrorChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncFlutterError", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwAsyncFlutterErrorChannel.setMessageHandler { _, reply in - api.throwAsyncFlutterError() { result in + api.throwAsyncFlutterError { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1210,17 +1352,19 @@ class HostIntegrationCoreApiSetup { throwAsyncFlutterErrorChannel.setMessageHandler(nil) } /// Returns the passed object, to test async serialization and deserialization. - let echoAsyncAllTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncAllTypes", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncAllTypesChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncAllTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncAllTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let everythingArg = args[0] as! AllTypes api.echoAsync(everythingArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1228,17 +1372,20 @@ class HostIntegrationCoreApiSetup { echoAsyncAllTypesChannel.setMessageHandler(nil) } /// Returns the passed object, to test serialization and deserialization. - let echoAsyncNullableAllNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableAllNullableTypes", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableAllNullableTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableAllNullableTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableAllNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let everythingArg: AllNullableTypes? = nilOrValue(args[0]) api.echoAsync(everythingArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1246,17 +1393,22 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableAllNullableTypesChannel.setMessageHandler(nil) } /// Returns passed in int asynchronously. - let echoAsyncNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableInt", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableIntChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] - let anIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) + let anIntArg: Int64? = + isNullish(args[0]) + ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) api.echoAsyncNullable(anIntArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1264,17 +1416,20 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableIntChannel.setMessageHandler(nil) } /// Returns passed in double asynchronously. - let echoAsyncNullableDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableDouble", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableDoubleChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aDoubleArg: Double? = nilOrValue(args[0]) api.echoAsyncNullable(aDoubleArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1282,17 +1437,20 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableDoubleChannel.setMessageHandler(nil) } /// Returns the passed in boolean asynchronously. - let echoAsyncNullableBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableBool", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableBoolChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aBoolArg: Bool? = nilOrValue(args[0]) api.echoAsyncNullable(aBoolArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1300,17 +1458,20 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableBoolChannel.setMessageHandler(nil) } /// Returns the passed string asynchronously. - let echoAsyncNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableString", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg: String? = nilOrValue(args[0]) api.echoAsyncNullable(aStringArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1318,17 +1479,20 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableStringChannel.setMessageHandler(nil) } /// Returns the passed in Uint8List asynchronously. - let echoAsyncNullableUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableUint8List", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableUint8ListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aUint8ListArg: FlutterStandardTypedData? = nilOrValue(args[0]) api.echoAsyncNullable(aUint8ListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1336,17 +1500,20 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableUint8ListChannel.setMessageHandler(nil) } /// Returns the passed in generic Object asynchronously. - let echoAsyncNullableObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableObject", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableObjectChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableObject", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anObjectArg: Any? = args[0] api.echoAsyncNullable(anObjectArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1354,17 +1521,20 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableObjectChannel.setMessageHandler(nil) } /// Returns the passed list, to test asynchronous serialization and deserialization. - let echoAsyncNullableListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableList", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aListArg: [Any?]? = nilOrValue(args[0]) api.echoAsyncNullable(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1372,17 +1542,20 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableListChannel.setMessageHandler(nil) } /// Returns the passed map, to test asynchronous serialization and deserialization. - let echoAsyncNullableMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableMap", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableMapChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aMapArg: [String?: Any?]? = nilOrValue(args[0]) api.echoAsyncNullable(aMapArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1390,387 +1563,459 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableMapChannel.setMessageHandler(nil) } /// Returns the passed enum, to test asynchronous serialization and deserialization. - let echoAsyncNullableEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableEnum", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableEnumChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anEnumArg: AnEnum? = isNullish(args[0]) ? nil : AnEnum(rawValue: args[0] as! Int)! api.echoAsyncNullable(anEnumArg) { result in switch result { - case .success(let res): - reply(wrapResult(res?.rawValue)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res?.rawValue)) + case .failure(let error): + reply(wrapError(error)) } } } } else { echoAsyncNullableEnumChannel.setMessageHandler(nil) } - let callFlutterNoopChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterNoop", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterNoopChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterNoop", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterNoopChannel.setMessageHandler { _, reply in - api.callFlutterNoop() { result in + api.callFlutterNoop { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterNoopChannel.setMessageHandler(nil) } - let callFlutterThrowErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowError", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterThrowErrorChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowError", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterThrowErrorChannel.setMessageHandler { _, reply in - api.callFlutterThrowError() { result in + api.callFlutterThrowError { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterThrowErrorChannel.setMessageHandler(nil) } - let callFlutterThrowErrorFromVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowErrorFromVoid", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterThrowErrorFromVoidChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowErrorFromVoid", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterThrowErrorFromVoidChannel.setMessageHandler { _, reply in - api.callFlutterThrowErrorFromVoid() { result in + api.callFlutterThrowErrorFromVoid { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterThrowErrorFromVoidChannel.setMessageHandler(nil) } - let callFlutterEchoAllTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllTypes", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoAllTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoAllTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let everythingArg = args[0] as! AllTypes api.callFlutterEcho(everythingArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoAllTypesChannel.setMessageHandler(nil) } - let callFlutterEchoAllNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllNullableTypes", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoAllNullableTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllNullableTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoAllNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let everythingArg: AllNullableTypes? = nilOrValue(args[0]) api.callFlutterEcho(everythingArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoAllNullableTypesChannel.setMessageHandler(nil) } - let callFlutterSendMultipleNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterSendMultipleNullableTypes", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterSendMultipleNullableTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterSendMultipleNullableTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterSendMultipleNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableBoolArg: Bool? = nilOrValue(args[0]) - let aNullableIntArg: Int64? = isNullish(args[1]) ? nil : (args[1] is Int64? ? args[1] as! Int64? : Int64(args[1] as! Int32)) + let aNullableIntArg: Int64? = + isNullish(args[1]) + ? nil : (args[1] is Int64? ? args[1] as! Int64? : Int64(args[1] as! Int32)) let aNullableStringArg: String? = nilOrValue(args[2]) - api.callFlutterSendMultipleNullableTypes(aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg) { result in + api.callFlutterSendMultipleNullableTypes( + aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg + ) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterSendMultipleNullableTypesChannel.setMessageHandler(nil) } - let callFlutterEchoBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoBool", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoBoolChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aBoolArg = args[0] as! Bool api.callFlutterEcho(aBoolArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoBoolChannel.setMessageHandler(nil) } - let callFlutterEchoIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoInt", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoIntChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anIntArg = args[0] is Int64 ? args[0] as! Int64 : Int64(args[0] as! Int32) api.callFlutterEcho(anIntArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoIntChannel.setMessageHandler(nil) } - let callFlutterEchoDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoDouble", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoDoubleChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aDoubleArg = args[0] as! Double api.callFlutterEcho(aDoubleArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoDoubleChannel.setMessageHandler(nil) } - let callFlutterEchoStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoString", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg = args[0] as! String api.callFlutterEcho(aStringArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoStringChannel.setMessageHandler(nil) } - let callFlutterEchoUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoUint8List", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoUint8ListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aListArg = args[0] as! FlutterStandardTypedData api.callFlutterEcho(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoUint8ListChannel.setMessageHandler(nil) } - let callFlutterEchoListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoList", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aListArg = args[0] as! [Any?] api.callFlutterEcho(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoListChannel.setMessageHandler(nil) } - let callFlutterEchoMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoMap", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoMapChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aMapArg = args[0] as! [String?: Any?] api.callFlutterEcho(aMapArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoMapChannel.setMessageHandler(nil) } - let callFlutterEchoEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoEnum", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoEnumChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anEnumArg = AnEnum(rawValue: args[0] as! Int)! api.callFlutterEcho(anEnumArg) { result in switch result { - case .success(let res): - reply(wrapResult(res.rawValue)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res.rawValue)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoEnumChannel.setMessageHandler(nil) } - let callFlutterEchoNullableBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableBool", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableBoolChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aBoolArg: Bool? = nilOrValue(args[0]) api.callFlutterEchoNullable(aBoolArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoNullableBoolChannel.setMessageHandler(nil) } - let callFlutterEchoNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableInt", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableIntChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] - let anIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) + let anIntArg: Int64? = + isNullish(args[0]) + ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) api.callFlutterEchoNullable(anIntArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoNullableIntChannel.setMessageHandler(nil) } - let callFlutterEchoNullableDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableDouble", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableDoubleChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aDoubleArg: Double? = nilOrValue(args[0]) api.callFlutterEchoNullable(aDoubleArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoNullableDoubleChannel.setMessageHandler(nil) } - let callFlutterEchoNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableString", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg: String? = nilOrValue(args[0]) api.callFlutterEchoNullable(aStringArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoNullableStringChannel.setMessageHandler(nil) } - let callFlutterEchoNullableUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableUint8List", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableUint8ListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aListArg: FlutterStandardTypedData? = nilOrValue(args[0]) api.callFlutterEchoNullable(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoNullableUint8ListChannel.setMessageHandler(nil) } - let callFlutterEchoNullableListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableList", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aListArg: [Any?]? = nilOrValue(args[0]) api.callFlutterEchoNullable(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoNullableListChannel.setMessageHandler(nil) } - let callFlutterEchoNullableMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableMap", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableMapChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aMapArg: [String?: Any?]? = nilOrValue(args[0]) api.callFlutterEchoNullable(aMapArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoNullableMapChannel.setMessageHandler(nil) } - let callFlutterEchoNullableEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableEnum", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableEnumChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anEnumArg: AnEnum? = isNullish(args[0]) ? nil : AnEnum(rawValue: args[0] as! Int)! api.callFlutterNullableEcho(anEnumArg) { result in switch result { - case .success(let res): - reply(wrapResult(res?.rawValue)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res?.rawValue)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1782,16 +2027,16 @@ class HostIntegrationCoreApiSetup { private class FlutterIntegrationCoreApiCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { - case 128: - return AllClassesWrapper.fromList(self.readValue() as! [Any?]) - case 129: - return AllNullableTypes.fromList(self.readValue() as! [Any?]) - case 130: - return AllTypes.fromList(self.readValue() as! [Any?]) - case 131: - return TestMessage.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) + case 128: + return AllClassesWrapper.fromList(self.readValue() as! [Any?]) + case 129: + return AllNullableTypes.fromList(self.readValue() as! [Any?]) + case 130: + return AllTypes.fromList(self.readValue() as! [Any?]) + case 131: + return TestMessage.fromList(self.readValue() as! [Any?]) + default: + return super.readValue(ofType: type) } } } @@ -1827,7 +2072,8 @@ private class FlutterIntegrationCoreApiCodecReaderWriter: FlutterStandardReaderW } class FlutterIntegrationCoreApiCodec: FlutterStandardMessageCodec { - static let shared = FlutterIntegrationCoreApiCodec(readerWriter: FlutterIntegrationCoreApiCodecReaderWriter()) + static let shared = FlutterIntegrationCoreApiCodec( + readerWriter: FlutterIntegrationCoreApiCodecReaderWriter()) } /// The core interface that the Dart platform_test code implements for host @@ -1843,13 +2089,19 @@ protocol FlutterIntegrationCoreApiProtocol { /// Responds with an error from an async void function. func throwErrorFromVoid(completion: @escaping (Result) -> Void) /// Returns the passed object, to test serialization and deserialization. - func echo(_ everythingArg: AllTypes, completion: @escaping (Result) -> Void) + func echo( + _ everythingArg: AllTypes, completion: @escaping (Result) -> Void) /// Returns the passed object, to test serialization and deserialization. - func echoNullable(_ everythingArg: AllNullableTypes?, completion: @escaping (Result) -> Void) + func echoNullable( + _ everythingArg: AllNullableTypes?, + completion: @escaping (Result) -> Void) /// Returns passed in arguments of multiple types. /// /// Tests multiple-arity FlutterApi handling. - func sendMultipleNullableTypes(aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int64?, aString aNullableStringArg: String?, completion: @escaping (Result) -> Void) + func sendMultipleNullableTypes( + aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int64?, + aString aNullableStringArg: String?, + completion: @escaping (Result) -> Void) /// Returns the passed boolean, to test serialization and deserialization. func echo(_ aBoolArg: Bool, completion: @escaping (Result) -> Void) /// Returns the passed int, to test serialization and deserialization. @@ -1859,29 +2111,42 @@ protocol FlutterIntegrationCoreApiProtocol { /// Returns the passed string, to test serialization and deserialization. func echo(_ aStringArg: String, completion: @escaping (Result) -> Void) /// Returns the passed byte list, to test serialization and deserialization. - func echo(_ aListArg: FlutterStandardTypedData, completion: @escaping (Result) -> Void) + func echo( + _ aListArg: FlutterStandardTypedData, + completion: @escaping (Result) -> Void) /// Returns the passed list, to test serialization and deserialization. func echo(_ aListArg: [Any?], completion: @escaping (Result<[Any?], FlutterError>) -> Void) /// Returns the passed map, to test serialization and deserialization. - func echo(_ aMapArg: [String?: Any?], completion: @escaping (Result<[String?: Any?], FlutterError>) -> Void) + func echo( + _ aMapArg: [String?: Any?], + completion: @escaping (Result<[String?: Any?], FlutterError>) -> Void) /// Returns the passed enum to test serialization and deserialization. func echo(_ anEnumArg: AnEnum, 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. - func echoNullable(_ anIntArg: Int64?, completion: @escaping (Result) -> Void) + func echoNullable( + _ anIntArg: Int64?, completion: @escaping (Result) -> Void) /// Returns the passed double, to test serialization and deserialization. - func echoNullable(_ aDoubleArg: Double?, completion: @escaping (Result) -> Void) + func echoNullable( + _ aDoubleArg: Double?, completion: @escaping (Result) -> Void) /// Returns the passed string, to test serialization and deserialization. - func echoNullable(_ aStringArg: String?, completion: @escaping (Result) -> Void) + func echoNullable( + _ aStringArg: String?, completion: @escaping (Result) -> Void) /// Returns the passed byte list, to test serialization and deserialization. - func echoNullable(_ aListArg: FlutterStandardTypedData?, completion: @escaping (Result) -> Void) + func echoNullable( + _ aListArg: FlutterStandardTypedData?, + completion: @escaping (Result) -> Void) /// Returns the passed list, to test serialization and deserialization. - func echoNullable(_ aListArg: [Any?]?, completion: @escaping (Result<[Any?]?, FlutterError>) -> Void) + func echoNullable( + _ aListArg: [Any?]?, completion: @escaping (Result<[Any?]?, FlutterError>) -> Void) /// Returns the passed map, to test serialization and deserialization. - func echoNullable(_ aMapArg: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, FlutterError>) -> Void) + func echoNullable( + _ aMapArg: [String?: Any?]?, + completion: @escaping (Result<[String?: Any?]?, FlutterError>) -> Void) /// Returns the passed enum to test serialization and deserialization. - func echoNullable(_ anEnumArg: AnEnum?, completion: @escaping (Result) -> Void) + func echoNullable( + _ anEnumArg: AnEnum?, 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) @@ -1890,7 +2155,7 @@ protocol FlutterIntegrationCoreApiProtocol { } class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { private let binaryMessenger: FlutterBinaryMessenger - init(binaryMessenger: FlutterBinaryMessenger){ + init(binaryMessenger: FlutterBinaryMessenger) { self.binaryMessenger = binaryMessenger } var codec: FlutterStandardMessageCodec { @@ -1899,18 +2164,20 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { /// A no-op function taking no arguments and returning no value, to sanity /// test basic calling. func noop(completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noop" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noop" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { completion(.success(Void())) } @@ -1918,18 +2185,20 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Responds with an error from an async function returning a value. func throwError(completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwError" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwError" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: Any? = listResponse[0] completion(.success(result)) @@ -1938,39 +2207,49 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Responds with an error from an async void function. func throwErrorFromVoid(completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwErrorFromVoid" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwErrorFromVoid" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { completion(.success(Void())) } } } /// Returns the passed object, to test serialization and deserialization. - func echo(_ everythingArg: AllTypes, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllTypes" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echo( + _ everythingArg: AllTypes, completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllTypes" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([everythingArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! AllTypes completion(.success(result)) @@ -1978,19 +2257,24 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed object, to test serialization and deserialization. - func echoNullable(_ everythingArg: AllNullableTypes?, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllNullableTypes" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ everythingArg: AllNullableTypes?, + completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllNullableTypes" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([everythingArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: AllNullableTypes? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2000,21 +2284,32 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { /// Returns passed in arguments of multiple types. /// /// Tests multiple-arity FlutterApi handling. - func sendMultipleNullableTypes(aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int64?, aString aNullableStringArg: String?, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.sendMultipleNullableTypes" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([aNullableBoolArg, aNullableIntArg, aNullableStringArg] as [Any?]) { response in + func sendMultipleNullableTypes( + aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int64?, + aString aNullableStringArg: String?, + completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.sendMultipleNullableTypes" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([aNullableBoolArg, aNullableIntArg, aNullableStringArg] as [Any?]) { + response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! AllNullableTypes completion(.success(result)) @@ -2023,20 +2318,26 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed boolean, to test serialization and deserialization. func echo(_ aBoolArg: Bool, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoBool" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoBool" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aBoolArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! Bool completion(.success(result)) @@ -2045,42 +2346,55 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed int, to test serialization and deserialization. func echo(_ anIntArg: Int64, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoInt" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoInt" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anIntArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { - let result = listResponse[0] is Int64 ? listResponse[0] as! Int64 : Int64(listResponse[0] as! Int32) + let result = + listResponse[0] is Int64 ? listResponse[0] as! Int64 : Int64(listResponse[0] as! Int32) completion(.success(result)) } } } /// Returns the passed double, to test serialization and deserialization. func echo(_ aDoubleArg: Double, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoDouble" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoDouble" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aDoubleArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! Double completion(.success(result)) @@ -2089,20 +2403,26 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed string, to test serialization and deserialization. func echo(_ aStringArg: String, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoString" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoString" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! String completion(.success(result)) @@ -2110,21 +2430,30 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed byte list, to test serialization and deserialization. - func echo(_ aListArg: FlutterStandardTypedData, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoUint8List" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echo( + _ aListArg: FlutterStandardTypedData, + completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoUint8List" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! FlutterStandardTypedData completion(.success(result)) @@ -2133,20 +2462,26 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed list, to test serialization and deserialization. func echo(_ aListArg: [Any?], completion: @escaping (Result<[Any?], FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoList" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoList" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! [Any?] completion(.success(result)) @@ -2154,21 +2489,30 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed map, to test serialization and deserialization. - func echo(_ aMapArg: [String?: Any?], completion: @escaping (Result<[String?: Any?], FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoMap" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echo( + _ aMapArg: [String?: Any?], + completion: @escaping (Result<[String?: Any?], FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoMap" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aMapArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! [String?: Any?] completion(.success(result)) @@ -2177,20 +2521,26 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed enum to test serialization and deserialization. func echo(_ anEnumArg: AnEnum, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoEnum" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoEnum" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anEnumArg.rawValue] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = AnEnum(rawValue: listResponse[0] as! Int)! completion(.success(result)) @@ -2198,19 +2548,22 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed boolean, to test serialization and deserialization. - func echoNullable(_ aBoolArg: Bool?, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableBool" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable(_ aBoolArg: Bool?, completion: @escaping (Result) -> Void) + { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableBool" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aBoolArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: Bool? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2218,39 +2571,51 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed int, to test serialization and deserialization. - func echoNullable(_ anIntArg: Int64?, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableInt" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ anIntArg: Int64?, completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableInt" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anIntArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { - let result: Int64? = isNullish(listResponse[0]) ? nil : (listResponse[0] is Int64? ? listResponse[0] as! Int64? : Int64(listResponse[0] as! Int32)) + let result: Int64? = + isNullish(listResponse[0]) + ? nil + : (listResponse[0] is Int64? + ? listResponse[0] as! Int64? : Int64(listResponse[0] as! Int32)) completion(.success(result)) } } } /// Returns the passed double, to test serialization and deserialization. - func echoNullable(_ aDoubleArg: Double?, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableDouble" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ aDoubleArg: Double?, completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableDouble" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aDoubleArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: Double? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2258,19 +2623,23 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed string, to test serialization and deserialization. - func echoNullable(_ aStringArg: String?, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableString" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ aStringArg: String?, completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableString" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: String? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2278,19 +2647,24 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed byte list, to test serialization and deserialization. - func echoNullable(_ aListArg: FlutterStandardTypedData?, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableUint8List" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ aListArg: FlutterStandardTypedData?, + completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableUint8List" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: FlutterStandardTypedData? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2298,19 +2672,23 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed list, to test serialization and deserialization. - func echoNullable(_ aListArg: [Any?]?, completion: @escaping (Result<[Any?]?, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableList" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ aListArg: [Any?]?, completion: @escaping (Result<[Any?]?, FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableList" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: [Any?]? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2318,19 +2696,24 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed map, to test serialization and deserialization. - func echoNullable(_ aMapArg: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableMap" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ aMapArg: [String?: Any?]?, + completion: @escaping (Result<[String?: Any?]?, FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableMap" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aMapArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: [String?: Any?]? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2338,21 +2721,26 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed enum to test serialization and deserialization. - func echoNullable(_ anEnumArg: AnEnum?, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableEnum" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ anEnumArg: AnEnum?, completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableEnum" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anEnumArg?.rawValue] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { - let result: AnEnum? = isNullish(listResponse[0]) ? nil : AnEnum(rawValue: listResponse[0] as! Int)! + let result: AnEnum? = + isNullish(listResponse[0]) ? nil : AnEnum(rawValue: listResponse[0] as! Int)! completion(.success(result)) } } @@ -2360,39 +2748,48 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. func noopAsync(completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noopAsync" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noopAsync" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { completion(.success(Void())) } } } /// Returns the passed in generic Object asynchronously. - func echoAsync(_ aStringArg: String, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAsyncString" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoAsync(_ aStringArg: String, completion: @escaping (Result) -> Void) + { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAsyncString" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! String completion(.success(result)) @@ -2412,7 +2809,9 @@ class HostTrivialApiSetup { /// The codec used by HostTrivialApi. /// Sets up an instance of `HostTrivialApi` to handle messages through the `binaryMessenger`. static func setUp(binaryMessenger: FlutterBinaryMessenger, api: HostTrivialApi?) { - let noopChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostTrivialApi.noop", binaryMessenger: binaryMessenger) + let noopChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostTrivialApi.noop", + binaryMessenger: binaryMessenger) if let api = api { noopChannel.setMessageHandler { _, reply in do { @@ -2440,32 +2839,36 @@ class HostSmallApiSetup { /// The codec used by HostSmallApi. /// Sets up an instance of `HostSmallApi` to handle messages through the `binaryMessenger`. static func setUp(binaryMessenger: FlutterBinaryMessenger, api: HostSmallApi?) { - let echoChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.echo", binaryMessenger: binaryMessenger) + let echoChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.echo", + binaryMessenger: binaryMessenger) if let api = api { echoChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg = args[0] as! String api.echo(aString: aStringArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { echoChannel.setMessageHandler(nil) } - let voidVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.voidVoid", binaryMessenger: binaryMessenger) + let voidVoidChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.voidVoid", + binaryMessenger: binaryMessenger) if let api = api { voidVoidChannel.setMessageHandler { _, reply in - api.voidVoid() { result in + api.voidVoid { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -2477,10 +2880,10 @@ class HostSmallApiSetup { private class FlutterSmallApiCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { - case 128: - return TestMessage.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) + case 128: + return TestMessage.fromList(self.readValue() as! [Any?]) + default: + return super.readValue(ofType: type) } } } @@ -2514,32 +2917,41 @@ class FlutterSmallApiCodec: FlutterStandardMessageCodec { /// /// Generated protocol from Pigeon that represents Flutter messages that can be called from Swift. protocol FlutterSmallApiProtocol { - func echo(_ msgArg: TestMessage, completion: @escaping (Result) -> Void) + func echo( + _ msgArg: TestMessage, completion: @escaping (Result) -> Void) func echo(_ aStringArg: String, completion: @escaping (Result) -> Void) } class FlutterSmallApi: FlutterSmallApiProtocol { private let binaryMessenger: FlutterBinaryMessenger - init(binaryMessenger: FlutterBinaryMessenger){ + init(binaryMessenger: FlutterBinaryMessenger) { self.binaryMessenger = binaryMessenger } var codec: FlutterStandardMessageCodec { return FlutterSmallApiCodec.shared } - func echo(_ msgArg: TestMessage, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoWrappedList" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echo( + _ msgArg: TestMessage, completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoWrappedList" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([msgArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! TestMessage completion(.success(result)) @@ -2547,20 +2959,26 @@ class FlutterSmallApi: FlutterSmallApiProtocol { } } func echo(_ aStringArg: String, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoString" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoString" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! String completion(.success(result)) 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 8b4daf5a08e..0d04c9544ca 100644 --- a/packages/pigeon/platform_tests/test_plugin/ios/Classes/TestPlugin.swift +++ b/packages/pigeon/platform_tests/test_plugin/ios/Classes/TestPlugin.swift @@ -7,10 +7,8 @@ import UIKit extension FlutterError: Error {} -/** - * This plugin handles the native side of the integration tests in - * example/integration_test/. - */ +/// This plugin handles the native side of the integration tests in +/// example/integration_test/. public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { var flutterAPI: FlutterIntegrationCoreApi @@ -90,15 +88,18 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { } func extractNestedNullableString(from wrapper: AllClassesWrapper) -> String? { - return wrapper.allNullableTypes.aNullableString; + return wrapper.allNullableTypes.aNullableString } func createNestedObject(with nullableString: String?) -> AllClassesWrapper { return AllClassesWrapper(allNullableTypes: AllNullableTypes(aNullableString: nullableString)) } - func sendMultipleNullableTypes(aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String?) -> AllNullableTypes { - let someThings = AllNullableTypes(aNullableBool: aNullableBool, aNullableInt: aNullableInt, aNullableString: aNullableString) + func sendMultipleNullableTypes( + aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String? + ) -> AllNullableTypes { + let someThings = AllNullableTypes( + aNullableBool: aNullableBool, aNullableInt: aNullableInt, aNullableString: aNullableString) return someThings } @@ -178,7 +179,10 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { completion(.success(everything)) } - func echoAsync(_ everything: AllNullableTypes?, completion: @escaping (Result) -> Void) { + func echoAsync( + _ everything: AllNullableTypes?, + completion: @escaping (Result) -> Void + ) { completion(.success(everything)) } @@ -198,7 +202,10 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { completion(.success(aString)) } - func echoAsync(_ aUint8List: FlutterStandardTypedData, completion: @escaping (Result) -> Void) { + func echoAsync( + _ aUint8List: FlutterStandardTypedData, + completion: @escaping (Result) -> Void + ) { completion(.success(aUint8List)) } @@ -210,7 +217,9 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { completion(.success(aList)) } - func echoAsync(_ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) { + func echoAsync( + _ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void + ) { completion(.success(aMap)) } @@ -222,7 +231,8 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { completion(.success(anInt)) } - func echoAsyncNullable(_ aDouble: Double?, completion: @escaping (Result) -> Void) { + func echoAsyncNullable(_ aDouble: Double?, completion: @escaping (Result) -> Void) + { completion(.success(aDouble)) } @@ -230,11 +240,15 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { completion(.success(aBool)) } - func echoAsyncNullable(_ aString: String?, completion: @escaping (Result) -> Void) { + func echoAsyncNullable(_ aString: String?, completion: @escaping (Result) -> Void) + { completion(.success(aString)) } - func echoAsyncNullable(_ aUint8List: FlutterStandardTypedData?, completion: @escaping (Result) -> Void) { + func echoAsyncNullable( + _ aUint8List: FlutterStandardTypedData?, + completion: @escaping (Result) -> Void + ) { completion(.success(aUint8List)) } @@ -246,66 +260,74 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { completion(.success(aList)) } - func echoAsyncNullable(_ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) { + func echoAsyncNullable( + _ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void + ) { completion(.success(aMap)) } - func echoAsyncNullable(_ anEnum: AnEnum?, completion: @escaping (Result) -> Void) { + func echoAsyncNullable(_ anEnum: AnEnum?, completion: @escaping (Result) -> Void) + { completion(.success(anEnum)) } func callFlutterNoop(completion: @escaping (Result) -> Void) { - flutterAPI.noop() { response in + flutterAPI.noop { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } func callFlutterThrowError(completion: @escaping (Result) -> Void) { - flutterAPI.throwError() { response in + flutterAPI.throwError { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } func callFlutterThrowErrorFromVoid(completion: @escaping (Result) -> Void) { - flutterAPI.throwErrorFromVoid() { response in + flutterAPI.throwErrorFromVoid { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEcho(_ everything: AllTypes, completion: @escaping (Result) -> Void) { + func callFlutterEcho( + _ everything: AllTypes, completion: @escaping (Result) -> Void + ) { flutterAPI.echo(everything) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) + } } } - func callFlutterEcho(_ everything: AllNullableTypes?, completion: @escaping (Result) -> Void) { + func callFlutterEcho( + _ everything: AllNullableTypes?, + completion: @escaping (Result) -> Void + ) { flutterAPI.echoNullable(everything) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) + } } } @@ -321,10 +343,10 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { aString: aNullableString ) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } @@ -332,10 +354,10 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { func callFlutterEcho(_ aBool: Bool, completion: @escaping (Result) -> Void) { flutterAPI.echo(aBool) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } @@ -343,10 +365,10 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { func callFlutterEcho(_ anInt: Int64, completion: @escaping (Result) -> Void) { flutterAPI.echo(anInt) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } @@ -354,10 +376,10 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { func callFlutterEcho(_ aDouble: Double, completion: @escaping (Result) -> Void) { flutterAPI.echo(aDouble) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } @@ -365,21 +387,24 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { func callFlutterEcho(_ aString: String, completion: @escaping (Result) -> Void) { flutterAPI.echo(aString) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEcho(_ aList: FlutterStandardTypedData, completion: @escaping (Result) -> Void) { + func callFlutterEcho( + _ aList: FlutterStandardTypedData, + completion: @escaping (Result) -> Void + ) { flutterAPI.echo(aList) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } @@ -387,21 +412,23 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { func callFlutterEcho(_ aList: [Any?], completion: @escaping (Result<[Any?], Error>) -> Void) { flutterAPI.echo(aList) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEcho(_ aMap: [String? : Any?], completion: @escaping (Result<[String? : Any?], Error>) -> Void) { + func callFlutterEcho( + _ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void + ) { flutterAPI.echo(aMap) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } @@ -409,99 +436,115 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { func callFlutterEcho(_ anEnum: AnEnum, completion: @escaping (Result) -> Void) { flutterAPI.echo(anEnum) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEchoNullable(_ aBool: Bool?, completion: @escaping (Result) -> Void) { + func callFlutterEchoNullable(_ aBool: Bool?, completion: @escaping (Result) -> Void) + { flutterAPI.echoNullable(aBool) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEchoNullable(_ anInt: Int64?, completion: @escaping (Result) -> Void) { + func callFlutterEchoNullable( + _ anInt: Int64?, completion: @escaping (Result) -> Void + ) { flutterAPI.echoNullable(anInt) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEchoNullable(_ aDouble: Double?, completion: @escaping (Result) -> Void) { + func callFlutterEchoNullable( + _ aDouble: Double?, completion: @escaping (Result) -> Void + ) { flutterAPI.echoNullable(aDouble) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEchoNullable(_ aString: String?, completion: @escaping (Result) -> Void) { + func callFlutterEchoNullable( + _ aString: String?, completion: @escaping (Result) -> Void + ) { flutterAPI.echoNullable(aString) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - - func callFlutterEchoNullable(_ aList: FlutterStandardTypedData?, completion: @escaping (Result) -> Void) { + + func callFlutterEchoNullable( + _ aList: FlutterStandardTypedData?, + completion: @escaping (Result) -> Void + ) { flutterAPI.echoNullable(aList) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEchoNullable(_ aList: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void) { + func callFlutterEchoNullable( + _ aList: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void + ) { flutterAPI.echoNullable(aList) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEchoNullable(_ aMap: [String? : Any?]?, completion: @escaping (Result<[String? : Any?]?, Error>) -> Void) { + func callFlutterEchoNullable( + _ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void + ) { flutterAPI.echoNullable(aMap) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterNullableEcho(_ anEnum: AnEnum?, completion: @escaping (Result) -> Void) { + func callFlutterNullableEcho( + _ anEnum: AnEnum?, completion: @escaping (Result) -> Void + ) { flutterAPI.echoNullable(anEnum) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } - } + } } } 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 773b6e5c12e..14bcb9a4113 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 @@ -1,17 +1,18 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// +// // Autogenerated from Pigeon, do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation + #if os(iOS) -import Flutter + import Flutter #elseif os(macOS) -import FlutterMacOS + import FlutterMacOS #else -#error("Unsupported platform.") + #error("Unsupported platform.") #endif private func wrapResult(_ result: Any?) -> [Any?] { @@ -23,18 +24,20 @@ private func wrapError(_ error: Any) -> [Any?] { return [ flutterError.code, flutterError.message, - flutterError.details + flutterError.details, ] } return [ "\(error)", "\(type(of: error))", - "Stacktrace: \(Thread.callStackSymbols)" + "Stacktrace: \(Thread.callStackSymbols)", ] } private func createConnectionError(withChannelName channelName: String) -> FlutterError { - return FlutterError(code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", details: "") + return FlutterError( + code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", + details: "") } private func isNullish(_ value: Any?) -> Bool { @@ -143,8 +146,10 @@ struct AllNullableTypes { static func fromList(_ list: [Any?]) -> AllNullableTypes? { let aNullableBool: Bool? = nilOrValue(list[0]) - let aNullableInt: Int64? = isNullish(list[1]) ? nil : (list[1] is Int64? ? list[1] as! Int64? : Int64(list[1] as! Int32)) - let aNullableInt64: Int64? = isNullish(list[2]) ? nil : (list[2] is Int64? ? list[2] as! Int64? : Int64(list[2] as! Int32)) + let aNullableInt: Int64? = + isNullish(list[1]) ? nil : (list[1] is Int64? ? list[1] as! Int64? : Int64(list[1] as! Int32)) + let aNullableInt64: Int64? = + isNullish(list[2]) ? nil : (list[2] is Int64? ? list[2] as! Int64? : Int64(list[2] as! Int32)) let aNullableDouble: Double? = nilOrValue(list[3]) let aNullableByteArray: FlutterStandardTypedData? = nilOrValue(list[4]) let aNullable4ByteArray: FlutterStandardTypedData? = nilOrValue(list[5]) @@ -250,7 +255,7 @@ struct TestMessage { } func toList() -> [Any?] { return [ - testList, + testList ] } } @@ -258,16 +263,16 @@ struct TestMessage { private class HostIntegrationCoreApiCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { - case 128: - return AllClassesWrapper.fromList(self.readValue() as! [Any?]) - case 129: - return AllNullableTypes.fromList(self.readValue() as! [Any?]) - case 130: - return AllTypes.fromList(self.readValue() as! [Any?]) - case 131: - return TestMessage.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) + case 128: + return AllClassesWrapper.fromList(self.readValue() as! [Any?]) + case 129: + return AllNullableTypes.fromList(self.readValue() as! [Any?]) + case 130: + return AllTypes.fromList(self.readValue() as! [Any?]) + case 131: + return TestMessage.fromList(self.readValue() as! [Any?]) + default: + return super.readValue(ofType: type) } } } @@ -303,7 +308,8 @@ private class HostIntegrationCoreApiCodecReaderWriter: FlutterStandardReaderWrit } class HostIntegrationCoreApiCodec: FlutterStandardMessageCodec { - static let shared = HostIntegrationCoreApiCodec(readerWriter: HostIntegrationCoreApiCodecReaderWriter()) + static let shared = HostIntegrationCoreApiCodec( + readerWriter: HostIntegrationCoreApiCodecReaderWriter()) } /// The core interface that each host language plugin must implement in @@ -357,7 +363,9 @@ protocol HostIntegrationCoreApi { /// sending of nested objects. func createNestedObject(with nullableString: String?) throws -> AllClassesWrapper /// Returns passed in arguments of multiple types. - func sendMultipleNullableTypes(aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String?) throws -> AllNullableTypes + func sendMultipleNullableTypes( + aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String? + ) throws -> AllNullableTypes /// Returns passed in int. func echo(_ aNullableInt: Int64?) throws -> Int64? /// Returns passed in double. @@ -391,13 +399,16 @@ protocol HostIntegrationCoreApi { /// Returns the passed string asynchronously. func echoAsync(_ aString: String, completion: @escaping (Result) -> Void) /// Returns the passed in Uint8List asynchronously. - func echoAsync(_ aUint8List: FlutterStandardTypedData, completion: @escaping (Result) -> Void) + func echoAsync( + _ aUint8List: FlutterStandardTypedData, + completion: @escaping (Result) -> Void) /// Returns the passed in generic Object asynchronously. func echoAsync(_ anObject: Any, completion: @escaping (Result) -> Void) /// Returns the passed list, to test asynchronous serialization and deserialization. func echoAsync(_ aList: [Any?], completion: @escaping (Result<[Any?], Error>) -> Void) /// Returns the passed map, to test asynchronous serialization and deserialization. - func echoAsync(_ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) + func echoAsync( + _ 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) /// Responds with an error from an async function returning a value. @@ -409,7 +420,9 @@ protocol HostIntegrationCoreApi { /// Returns the passed object, to test async serialization and deserialization. func echoAsync(_ everything: AllTypes, completion: @escaping (Result) -> Void) /// Returns the passed object, to test serialization and deserialization. - func echoAsync(_ everything: AllNullableTypes?, completion: @escaping (Result) -> Void) + func echoAsync( + _ everything: AllNullableTypes?, + completion: @escaping (Result) -> Void) /// Returns passed in int asynchronously. func echoAsyncNullable(_ anInt: Int64?, completion: @escaping (Result) -> Void) /// Returns passed in double asynchronously. @@ -419,37 +432,56 @@ protocol HostIntegrationCoreApi { /// Returns the passed string asynchronously. func echoAsyncNullable(_ aString: String?, completion: @escaping (Result) -> Void) /// Returns the passed in Uint8List asynchronously. - func echoAsyncNullable(_ aUint8List: FlutterStandardTypedData?, completion: @escaping (Result) -> Void) + func echoAsyncNullable( + _ aUint8List: FlutterStandardTypedData?, + completion: @escaping (Result) -> Void) /// Returns the passed in generic Object asynchronously. func echoAsyncNullable(_ anObject: Any?, completion: @escaping (Result) -> Void) /// Returns the passed list, to test asynchronous serialization and deserialization. func echoAsyncNullable(_ aList: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void) /// Returns the passed map, to test asynchronous serialization and deserialization. - func echoAsyncNullable(_ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) + func echoAsyncNullable( + _ 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) func callFlutterNoop(completion: @escaping (Result) -> Void) func callFlutterThrowError(completion: @escaping (Result) -> Void) func callFlutterThrowErrorFromVoid(completion: @escaping (Result) -> Void) - func callFlutterEcho(_ everything: AllTypes, completion: @escaping (Result) -> Void) - func callFlutterEcho(_ everything: AllNullableTypes?, completion: @escaping (Result) -> Void) - func callFlutterSendMultipleNullableTypes(aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String?, completion: @escaping (Result) -> Void) + func callFlutterEcho( + _ everything: AllTypes, completion: @escaping (Result) -> Void) + func callFlutterEcho( + _ everything: AllNullableTypes?, + completion: @escaping (Result) -> Void) + func callFlutterSendMultipleNullableTypes( + aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String?, + completion: @escaping (Result) -> Void) func callFlutterEcho(_ aBool: Bool, completion: @escaping (Result) -> Void) func callFlutterEcho(_ anInt: Int64, completion: @escaping (Result) -> Void) func callFlutterEcho(_ aDouble: Double, completion: @escaping (Result) -> Void) func callFlutterEcho(_ aString: String, completion: @escaping (Result) -> Void) - func callFlutterEcho(_ aList: FlutterStandardTypedData, completion: @escaping (Result) -> Void) + func callFlutterEcho( + _ aList: FlutterStandardTypedData, + completion: @escaping (Result) -> Void) func callFlutterEcho(_ aList: [Any?], completion: @escaping (Result<[Any?], Error>) -> Void) - func callFlutterEcho(_ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) + func callFlutterEcho( + _ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) func callFlutterEcho(_ anEnum: AnEnum, completion: @escaping (Result) -> Void) func callFlutterEchoNullable(_ aBool: Bool?, completion: @escaping (Result) -> Void) - func callFlutterEchoNullable(_ anInt: Int64?, completion: @escaping (Result) -> Void) - func callFlutterEchoNullable(_ aDouble: Double?, completion: @escaping (Result) -> Void) - func callFlutterEchoNullable(_ aString: String?, completion: @escaping (Result) -> Void) - func callFlutterEchoNullable(_ aList: FlutterStandardTypedData?, completion: @escaping (Result) -> Void) - func callFlutterEchoNullable(_ aList: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void) - func callFlutterEchoNullable(_ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) - func callFlutterNullableEcho(_ anEnum: AnEnum?, completion: @escaping (Result) -> Void) + func callFlutterEchoNullable( + _ anInt: Int64?, completion: @escaping (Result) -> Void) + func callFlutterEchoNullable( + _ aDouble: Double?, completion: @escaping (Result) -> Void) + func callFlutterEchoNullable( + _ aString: String?, completion: @escaping (Result) -> Void) + func callFlutterEchoNullable( + _ aList: FlutterStandardTypedData?, + completion: @escaping (Result) -> Void) + func callFlutterEchoNullable( + _ aList: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void) + func callFlutterEchoNullable( + _ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) + func callFlutterNullableEcho( + _ anEnum: AnEnum?, completion: @escaping (Result) -> Void) } /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. @@ -460,7 +492,9 @@ class HostIntegrationCoreApiSetup { static func setUp(binaryMessenger: FlutterBinaryMessenger, api: HostIntegrationCoreApi?) { /// A no-op function taking no arguments and returning no value, to sanity /// test basic calling. - let noopChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noop", binaryMessenger: binaryMessenger, codec: codec) + let noopChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noop", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { noopChannel.setMessageHandler { _, reply in do { @@ -474,7 +508,9 @@ class HostIntegrationCoreApiSetup { noopChannel.setMessageHandler(nil) } /// Returns the passed object, to test serialization and deserialization. - let echoAllTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllTypes", binaryMessenger: binaryMessenger, codec: codec) + let echoAllTypesChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAllTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -490,7 +526,9 @@ class HostIntegrationCoreApiSetup { echoAllTypesChannel.setMessageHandler(nil) } /// Returns an error, to test error handling. - let throwErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwError", binaryMessenger: binaryMessenger, codec: codec) + let throwErrorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwError", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwErrorChannel.setMessageHandler { _, reply in do { @@ -504,7 +542,9 @@ class HostIntegrationCoreApiSetup { throwErrorChannel.setMessageHandler(nil) } /// Returns an error from a void function, to test error handling. - let throwErrorFromVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwErrorFromVoid", binaryMessenger: binaryMessenger, codec: codec) + let throwErrorFromVoidChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwErrorFromVoid", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwErrorFromVoidChannel.setMessageHandler { _, reply in do { @@ -518,7 +558,9 @@ class HostIntegrationCoreApiSetup { throwErrorFromVoidChannel.setMessageHandler(nil) } /// Returns a Flutter error, to test error handling. - let throwFlutterErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwFlutterError", binaryMessenger: binaryMessenger, codec: codec) + let throwFlutterErrorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwFlutterError", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwFlutterErrorChannel.setMessageHandler { _, reply in do { @@ -532,7 +574,9 @@ class HostIntegrationCoreApiSetup { throwFlutterErrorChannel.setMessageHandler(nil) } /// Returns passed in int. - let echoIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoInt", binaryMessenger: binaryMessenger, codec: codec) + let echoIntChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -548,7 +592,9 @@ class HostIntegrationCoreApiSetup { echoIntChannel.setMessageHandler(nil) } /// Returns passed in double. - let echoDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoDouble", binaryMessenger: binaryMessenger, codec: codec) + let echoDoubleChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -564,7 +610,9 @@ class HostIntegrationCoreApiSetup { echoDoubleChannel.setMessageHandler(nil) } /// Returns the passed in boolean. - let echoBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoBool", binaryMessenger: binaryMessenger, codec: codec) + let echoBoolChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -580,7 +628,9 @@ class HostIntegrationCoreApiSetup { echoBoolChannel.setMessageHandler(nil) } /// Returns the passed in string. - let echoStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoString", binaryMessenger: binaryMessenger, codec: codec) + let echoStringChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -596,7 +646,9 @@ class HostIntegrationCoreApiSetup { echoStringChannel.setMessageHandler(nil) } /// Returns the passed in Uint8List. - let echoUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoUint8List", binaryMessenger: binaryMessenger, codec: codec) + let echoUint8ListChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -612,7 +664,9 @@ class HostIntegrationCoreApiSetup { echoUint8ListChannel.setMessageHandler(nil) } /// Returns the passed in generic Object. - let echoObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoObject", binaryMessenger: binaryMessenger, codec: codec) + let echoObjectChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoObject", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -628,7 +682,9 @@ class HostIntegrationCoreApiSetup { echoObjectChannel.setMessageHandler(nil) } /// Returns the passed list, to test serialization and deserialization. - let echoListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoList", binaryMessenger: binaryMessenger, codec: codec) + let echoListChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -644,7 +700,9 @@ class HostIntegrationCoreApiSetup { echoListChannel.setMessageHandler(nil) } /// Returns the passed map, to test serialization and deserialization. - let echoMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoMap", binaryMessenger: binaryMessenger, codec: codec) + let echoMapChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -660,7 +718,9 @@ class HostIntegrationCoreApiSetup { echoMapChannel.setMessageHandler(nil) } /// Returns the passed map to test nested class serialization and deserialization. - let echoClassWrapperChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoClassWrapper", binaryMessenger: binaryMessenger, codec: codec) + let echoClassWrapperChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoClassWrapper", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoClassWrapperChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -676,7 +736,9 @@ class HostIntegrationCoreApiSetup { echoClassWrapperChannel.setMessageHandler(nil) } /// Returns the passed enum to test serialization and deserialization. - let echoEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoEnum", binaryMessenger: binaryMessenger, codec: codec) + let echoEnumChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -692,7 +754,10 @@ class HostIntegrationCoreApiSetup { echoEnumChannel.setMessageHandler(nil) } /// Returns the default string. - let echoNamedDefaultStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedDefaultString", binaryMessenger: binaryMessenger, codec: codec) + let echoNamedDefaultStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedDefaultString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNamedDefaultStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -708,7 +773,10 @@ class HostIntegrationCoreApiSetup { echoNamedDefaultStringChannel.setMessageHandler(nil) } /// Returns passed in double. - let echoOptionalDefaultDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalDefaultDouble", binaryMessenger: binaryMessenger, codec: codec) + let echoOptionalDefaultDoubleChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalDefaultDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoOptionalDefaultDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -724,7 +792,9 @@ class HostIntegrationCoreApiSetup { echoOptionalDefaultDoubleChannel.setMessageHandler(nil) } /// Returns passed in int. - let echoRequiredIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoRequiredInt", binaryMessenger: binaryMessenger, codec: codec) + let echoRequiredIntChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoRequiredInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoRequiredIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -740,7 +810,10 @@ class HostIntegrationCoreApiSetup { echoRequiredIntChannel.setMessageHandler(nil) } /// Returns the passed object, to test serialization and deserialization. - let echoAllNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllNullableTypes", binaryMessenger: binaryMessenger, codec: codec) + let echoAllNullableTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllNullableTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAllNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -757,7 +830,10 @@ class HostIntegrationCoreApiSetup { } /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. - let extractNestedNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.extractNestedNullableString", binaryMessenger: binaryMessenger, codec: codec) + let extractNestedNullableStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.extractNestedNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { extractNestedNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -774,7 +850,10 @@ class HostIntegrationCoreApiSetup { } /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. - let createNestedNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.createNestedNullableString", binaryMessenger: binaryMessenger, codec: codec) + let createNestedNullableStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.createNestedNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { createNestedNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -790,15 +869,21 @@ class HostIntegrationCoreApiSetup { createNestedNullableStringChannel.setMessageHandler(nil) } /// Returns passed in arguments of multiple types. - let sendMultipleNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.sendMultipleNullableTypes", binaryMessenger: binaryMessenger, codec: codec) + let sendMultipleNullableTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.sendMultipleNullableTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { sendMultipleNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableBoolArg: Bool? = nilOrValue(args[0]) - let aNullableIntArg: Int64? = isNullish(args[1]) ? nil : (args[1] is Int64? ? args[1] as! Int64? : Int64(args[1] as! Int32)) + let aNullableIntArg: Int64? = + isNullish(args[1]) + ? nil : (args[1] is Int64? ? args[1] as! Int64? : Int64(args[1] as! Int32)) let aNullableStringArg: String? = nilOrValue(args[2]) do { - let result = try api.sendMultipleNullableTypes(aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg) + let result = try api.sendMultipleNullableTypes( + aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -808,11 +893,15 @@ class HostIntegrationCoreApiSetup { sendMultipleNullableTypesChannel.setMessageHandler(nil) } /// Returns passed in int. - let echoNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableInt", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableIntChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] - let aNullableIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) + let aNullableIntArg: Int64? = + isNullish(args[0]) + ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) do { let result = try api.echo(aNullableIntArg) reply(wrapResult(result)) @@ -824,7 +913,9 @@ class HostIntegrationCoreApiSetup { echoNullableIntChannel.setMessageHandler(nil) } /// Returns passed in double. - let echoNullableDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableDouble", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableDoubleChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -840,7 +931,9 @@ class HostIntegrationCoreApiSetup { echoNullableDoubleChannel.setMessageHandler(nil) } /// Returns the passed in boolean. - let echoNullableBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableBool", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableBoolChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -856,7 +949,9 @@ class HostIntegrationCoreApiSetup { echoNullableBoolChannel.setMessageHandler(nil) } /// Returns the passed in string. - let echoNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableString", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableStringChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -872,7 +967,10 @@ class HostIntegrationCoreApiSetup { echoNullableStringChannel.setMessageHandler(nil) } /// Returns the passed in Uint8List. - let echoNullableUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableUint8List", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableUint8ListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -888,7 +986,9 @@ class HostIntegrationCoreApiSetup { echoNullableUint8ListChannel.setMessageHandler(nil) } /// Returns the passed in generic Object. - let echoNullableObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableObject", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableObjectChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableObject", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -904,7 +1004,9 @@ class HostIntegrationCoreApiSetup { echoNullableObjectChannel.setMessageHandler(nil) } /// Returns the passed list, to test serialization and deserialization. - let echoNullableListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableList", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableListChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -920,7 +1022,9 @@ class HostIntegrationCoreApiSetup { echoNullableListChannel.setMessageHandler(nil) } /// Returns the passed map, to test serialization and deserialization. - let echoNullableMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableMap", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableMapChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -935,7 +1039,9 @@ class HostIntegrationCoreApiSetup { } else { echoNullableMapChannel.setMessageHandler(nil) } - let echoNullableEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableEnum", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableEnumChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -951,11 +1057,16 @@ class HostIntegrationCoreApiSetup { echoNullableEnumChannel.setMessageHandler(nil) } /// Returns passed in int. - let echoOptionalNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalNullableInt", binaryMessenger: binaryMessenger, codec: codec) + let echoOptionalNullableIntChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalNullableInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoOptionalNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] - let aNullableIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) + let aNullableIntArg: Int64? = + isNullish(args[0]) + ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) do { let result = try api.echoOptional(aNullableIntArg) reply(wrapResult(result)) @@ -967,7 +1078,10 @@ class HostIntegrationCoreApiSetup { echoOptionalNullableIntChannel.setMessageHandler(nil) } /// Returns the passed in string. - let echoNamedNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedNullableString", binaryMessenger: binaryMessenger, codec: codec) + let echoNamedNullableStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNamedNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -984,15 +1098,17 @@ class HostIntegrationCoreApiSetup { } /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. - let noopAsyncChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noopAsync", binaryMessenger: binaryMessenger, codec: codec) + let noopAsyncChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noopAsync", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { noopAsyncChannel.setMessageHandler { _, reply in - api.noopAsync() { result in + api.noopAsync { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1000,17 +1116,19 @@ class HostIntegrationCoreApiSetup { noopAsyncChannel.setMessageHandler(nil) } /// Returns passed in int asynchronously. - let echoAsyncIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncInt", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncIntChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anIntArg = args[0] is Int64 ? args[0] as! Int64 : Int64(args[0] as! Int32) api.echoAsync(anIntArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1018,17 +1136,19 @@ class HostIntegrationCoreApiSetup { echoAsyncIntChannel.setMessageHandler(nil) } /// Returns passed in double asynchronously. - let echoAsyncDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncDouble", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncDoubleChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aDoubleArg = args[0] as! Double api.echoAsync(aDoubleArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1036,17 +1156,19 @@ class HostIntegrationCoreApiSetup { echoAsyncDoubleChannel.setMessageHandler(nil) } /// Returns the passed in boolean asynchronously. - let echoAsyncBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncBool", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncBoolChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aBoolArg = args[0] as! Bool api.echoAsync(aBoolArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1054,17 +1176,19 @@ class HostIntegrationCoreApiSetup { echoAsyncBoolChannel.setMessageHandler(nil) } /// Returns the passed string asynchronously. - let echoAsyncStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncString", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncStringChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg = args[0] as! String api.echoAsync(aStringArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1072,17 +1196,19 @@ class HostIntegrationCoreApiSetup { echoAsyncStringChannel.setMessageHandler(nil) } /// Returns the passed in Uint8List asynchronously. - let echoAsyncUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncUint8List", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncUint8ListChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aUint8ListArg = args[0] as! FlutterStandardTypedData api.echoAsync(aUint8ListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1090,17 +1216,19 @@ class HostIntegrationCoreApiSetup { echoAsyncUint8ListChannel.setMessageHandler(nil) } /// Returns the passed in generic Object asynchronously. - let echoAsyncObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncObject", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncObjectChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncObject", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anObjectArg = args[0]! api.echoAsync(anObjectArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1108,17 +1236,19 @@ class HostIntegrationCoreApiSetup { echoAsyncObjectChannel.setMessageHandler(nil) } /// Returns the passed list, to test asynchronous serialization and deserialization. - let echoAsyncListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncList", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncListChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aListArg = args[0] as! [Any?] api.echoAsync(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1126,17 +1256,19 @@ class HostIntegrationCoreApiSetup { echoAsyncListChannel.setMessageHandler(nil) } /// Returns the passed map, to test asynchronous serialization and deserialization. - let echoAsyncMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncMap", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncMapChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aMapArg = args[0] as! [String?: Any?] api.echoAsync(aMapArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1144,17 +1276,19 @@ class HostIntegrationCoreApiSetup { echoAsyncMapChannel.setMessageHandler(nil) } /// Returns the passed enum, to test asynchronous serialization and deserialization. - let echoAsyncEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncEnum", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncEnumChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anEnumArg = AnEnum(rawValue: args[0] as! Int)! api.echoAsync(anEnumArg) { result in switch result { - case .success(let res): - reply(wrapResult(res.rawValue)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res.rawValue)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1162,15 +1296,17 @@ class HostIntegrationCoreApiSetup { echoAsyncEnumChannel.setMessageHandler(nil) } /// Responds with an error from an async function returning a value. - let throwAsyncErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncError", binaryMessenger: binaryMessenger, codec: codec) + let throwAsyncErrorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncError", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwAsyncErrorChannel.setMessageHandler { _, reply in - api.throwAsyncError() { result in + api.throwAsyncError { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1178,15 +1314,18 @@ class HostIntegrationCoreApiSetup { throwAsyncErrorChannel.setMessageHandler(nil) } /// Responds with an error from an async void function. - let throwAsyncErrorFromVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncErrorFromVoid", binaryMessenger: binaryMessenger, codec: codec) + let throwAsyncErrorFromVoidChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncErrorFromVoid", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwAsyncErrorFromVoidChannel.setMessageHandler { _, reply in - api.throwAsyncErrorFromVoid() { result in + api.throwAsyncErrorFromVoid { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1194,15 +1333,18 @@ class HostIntegrationCoreApiSetup { throwAsyncErrorFromVoidChannel.setMessageHandler(nil) } /// Responds with a Flutter error from an async function returning a value. - let throwAsyncFlutterErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncFlutterError", binaryMessenger: binaryMessenger, codec: codec) + let throwAsyncFlutterErrorChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncFlutterError", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwAsyncFlutterErrorChannel.setMessageHandler { _, reply in - api.throwAsyncFlutterError() { result in + api.throwAsyncFlutterError { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1210,17 +1352,19 @@ class HostIntegrationCoreApiSetup { throwAsyncFlutterErrorChannel.setMessageHandler(nil) } /// Returns the passed object, to test async serialization and deserialization. - let echoAsyncAllTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncAllTypes", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncAllTypesChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncAllTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncAllTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let everythingArg = args[0] as! AllTypes api.echoAsync(everythingArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1228,17 +1372,20 @@ class HostIntegrationCoreApiSetup { echoAsyncAllTypesChannel.setMessageHandler(nil) } /// Returns the passed object, to test serialization and deserialization. - let echoAsyncNullableAllNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableAllNullableTypes", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableAllNullableTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableAllNullableTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableAllNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let everythingArg: AllNullableTypes? = nilOrValue(args[0]) api.echoAsync(everythingArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1246,17 +1393,22 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableAllNullableTypesChannel.setMessageHandler(nil) } /// Returns passed in int asynchronously. - let echoAsyncNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableInt", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableIntChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] - let anIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) + let anIntArg: Int64? = + isNullish(args[0]) + ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) api.echoAsyncNullable(anIntArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1264,17 +1416,20 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableIntChannel.setMessageHandler(nil) } /// Returns passed in double asynchronously. - let echoAsyncNullableDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableDouble", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableDoubleChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aDoubleArg: Double? = nilOrValue(args[0]) api.echoAsyncNullable(aDoubleArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1282,17 +1437,20 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableDoubleChannel.setMessageHandler(nil) } /// Returns the passed in boolean asynchronously. - let echoAsyncNullableBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableBool", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableBoolChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aBoolArg: Bool? = nilOrValue(args[0]) api.echoAsyncNullable(aBoolArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1300,17 +1458,20 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableBoolChannel.setMessageHandler(nil) } /// Returns the passed string asynchronously. - let echoAsyncNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableString", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg: String? = nilOrValue(args[0]) api.echoAsyncNullable(aStringArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1318,17 +1479,20 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableStringChannel.setMessageHandler(nil) } /// Returns the passed in Uint8List asynchronously. - let echoAsyncNullableUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableUint8List", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableUint8ListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aUint8ListArg: FlutterStandardTypedData? = nilOrValue(args[0]) api.echoAsyncNullable(aUint8ListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1336,17 +1500,20 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableUint8ListChannel.setMessageHandler(nil) } /// Returns the passed in generic Object asynchronously. - let echoAsyncNullableObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableObject", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableObjectChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableObject", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anObjectArg: Any? = args[0] api.echoAsyncNullable(anObjectArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1354,17 +1521,20 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableObjectChannel.setMessageHandler(nil) } /// Returns the passed list, to test asynchronous serialization and deserialization. - let echoAsyncNullableListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableList", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aListArg: [Any?]? = nilOrValue(args[0]) api.echoAsyncNullable(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1372,17 +1542,20 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableListChannel.setMessageHandler(nil) } /// Returns the passed map, to test asynchronous serialization and deserialization. - let echoAsyncNullableMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableMap", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableMapChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aMapArg: [String?: Any?]? = nilOrValue(args[0]) api.echoAsyncNullable(aMapArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1390,387 +1563,459 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableMapChannel.setMessageHandler(nil) } /// Returns the passed enum, to test asynchronous serialization and deserialization. - let echoAsyncNullableEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableEnum", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableEnumChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anEnumArg: AnEnum? = isNullish(args[0]) ? nil : AnEnum(rawValue: args[0] as! Int)! api.echoAsyncNullable(anEnumArg) { result in switch result { - case .success(let res): - reply(wrapResult(res?.rawValue)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res?.rawValue)) + case .failure(let error): + reply(wrapError(error)) } } } } else { echoAsyncNullableEnumChannel.setMessageHandler(nil) } - let callFlutterNoopChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterNoop", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterNoopChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterNoop", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterNoopChannel.setMessageHandler { _, reply in - api.callFlutterNoop() { result in + api.callFlutterNoop { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterNoopChannel.setMessageHandler(nil) } - let callFlutterThrowErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowError", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterThrowErrorChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowError", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterThrowErrorChannel.setMessageHandler { _, reply in - api.callFlutterThrowError() { result in + api.callFlutterThrowError { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterThrowErrorChannel.setMessageHandler(nil) } - let callFlutterThrowErrorFromVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowErrorFromVoid", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterThrowErrorFromVoidChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowErrorFromVoid", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterThrowErrorFromVoidChannel.setMessageHandler { _, reply in - api.callFlutterThrowErrorFromVoid() { result in + api.callFlutterThrowErrorFromVoid { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterThrowErrorFromVoidChannel.setMessageHandler(nil) } - let callFlutterEchoAllTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllTypes", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoAllTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoAllTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let everythingArg = args[0] as! AllTypes api.callFlutterEcho(everythingArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoAllTypesChannel.setMessageHandler(nil) } - let callFlutterEchoAllNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllNullableTypes", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoAllNullableTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllNullableTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoAllNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let everythingArg: AllNullableTypes? = nilOrValue(args[0]) api.callFlutterEcho(everythingArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoAllNullableTypesChannel.setMessageHandler(nil) } - let callFlutterSendMultipleNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterSendMultipleNullableTypes", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterSendMultipleNullableTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterSendMultipleNullableTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterSendMultipleNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableBoolArg: Bool? = nilOrValue(args[0]) - let aNullableIntArg: Int64? = isNullish(args[1]) ? nil : (args[1] is Int64? ? args[1] as! Int64? : Int64(args[1] as! Int32)) + let aNullableIntArg: Int64? = + isNullish(args[1]) + ? nil : (args[1] is Int64? ? args[1] as! Int64? : Int64(args[1] as! Int32)) let aNullableStringArg: String? = nilOrValue(args[2]) - api.callFlutterSendMultipleNullableTypes(aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg) { result in + api.callFlutterSendMultipleNullableTypes( + aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg + ) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterSendMultipleNullableTypesChannel.setMessageHandler(nil) } - let callFlutterEchoBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoBool", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoBoolChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aBoolArg = args[0] as! Bool api.callFlutterEcho(aBoolArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoBoolChannel.setMessageHandler(nil) } - let callFlutterEchoIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoInt", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoIntChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anIntArg = args[0] is Int64 ? args[0] as! Int64 : Int64(args[0] as! Int32) api.callFlutterEcho(anIntArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoIntChannel.setMessageHandler(nil) } - let callFlutterEchoDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoDouble", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoDoubleChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aDoubleArg = args[0] as! Double api.callFlutterEcho(aDoubleArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoDoubleChannel.setMessageHandler(nil) } - let callFlutterEchoStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoString", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg = args[0] as! String api.callFlutterEcho(aStringArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoStringChannel.setMessageHandler(nil) } - let callFlutterEchoUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoUint8List", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoUint8ListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aListArg = args[0] as! FlutterStandardTypedData api.callFlutterEcho(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoUint8ListChannel.setMessageHandler(nil) } - let callFlutterEchoListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoList", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aListArg = args[0] as! [Any?] api.callFlutterEcho(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoListChannel.setMessageHandler(nil) } - let callFlutterEchoMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoMap", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoMapChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aMapArg = args[0] as! [String?: Any?] api.callFlutterEcho(aMapArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoMapChannel.setMessageHandler(nil) } - let callFlutterEchoEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoEnum", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoEnumChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anEnumArg = AnEnum(rawValue: args[0] as! Int)! api.callFlutterEcho(anEnumArg) { result in switch result { - case .success(let res): - reply(wrapResult(res.rawValue)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res.rawValue)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoEnumChannel.setMessageHandler(nil) } - let callFlutterEchoNullableBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableBool", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableBoolChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aBoolArg: Bool? = nilOrValue(args[0]) api.callFlutterEchoNullable(aBoolArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoNullableBoolChannel.setMessageHandler(nil) } - let callFlutterEchoNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableInt", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableIntChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] - let anIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) + let anIntArg: Int64? = + isNullish(args[0]) + ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) api.callFlutterEchoNullable(anIntArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoNullableIntChannel.setMessageHandler(nil) } - let callFlutterEchoNullableDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableDouble", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableDoubleChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aDoubleArg: Double? = nilOrValue(args[0]) api.callFlutterEchoNullable(aDoubleArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoNullableDoubleChannel.setMessageHandler(nil) } - let callFlutterEchoNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableString", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg: String? = nilOrValue(args[0]) api.callFlutterEchoNullable(aStringArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoNullableStringChannel.setMessageHandler(nil) } - let callFlutterEchoNullableUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableUint8List", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableUint8ListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aListArg: FlutterStandardTypedData? = nilOrValue(args[0]) api.callFlutterEchoNullable(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoNullableUint8ListChannel.setMessageHandler(nil) } - let callFlutterEchoNullableListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableList", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aListArg: [Any?]? = nilOrValue(args[0]) api.callFlutterEchoNullable(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoNullableListChannel.setMessageHandler(nil) } - let callFlutterEchoNullableMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableMap", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableMapChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aMapArg: [String?: Any?]? = nilOrValue(args[0]) api.callFlutterEchoNullable(aMapArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoNullableMapChannel.setMessageHandler(nil) } - let callFlutterEchoNullableEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableEnum", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableEnumChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anEnumArg: AnEnum? = isNullish(args[0]) ? nil : AnEnum(rawValue: args[0] as! Int)! api.callFlutterNullableEcho(anEnumArg) { result in switch result { - case .success(let res): - reply(wrapResult(res?.rawValue)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res?.rawValue)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1782,16 +2027,16 @@ class HostIntegrationCoreApiSetup { private class FlutterIntegrationCoreApiCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { - case 128: - return AllClassesWrapper.fromList(self.readValue() as! [Any?]) - case 129: - return AllNullableTypes.fromList(self.readValue() as! [Any?]) - case 130: - return AllTypes.fromList(self.readValue() as! [Any?]) - case 131: - return TestMessage.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) + case 128: + return AllClassesWrapper.fromList(self.readValue() as! [Any?]) + case 129: + return AllNullableTypes.fromList(self.readValue() as! [Any?]) + case 130: + return AllTypes.fromList(self.readValue() as! [Any?]) + case 131: + return TestMessage.fromList(self.readValue() as! [Any?]) + default: + return super.readValue(ofType: type) } } } @@ -1827,7 +2072,8 @@ private class FlutterIntegrationCoreApiCodecReaderWriter: FlutterStandardReaderW } class FlutterIntegrationCoreApiCodec: FlutterStandardMessageCodec { - static let shared = FlutterIntegrationCoreApiCodec(readerWriter: FlutterIntegrationCoreApiCodecReaderWriter()) + static let shared = FlutterIntegrationCoreApiCodec( + readerWriter: FlutterIntegrationCoreApiCodecReaderWriter()) } /// The core interface that the Dart platform_test code implements for host @@ -1843,13 +2089,19 @@ protocol FlutterIntegrationCoreApiProtocol { /// Responds with an error from an async void function. func throwErrorFromVoid(completion: @escaping (Result) -> Void) /// Returns the passed object, to test serialization and deserialization. - func echo(_ everythingArg: AllTypes, completion: @escaping (Result) -> Void) + func echo( + _ everythingArg: AllTypes, completion: @escaping (Result) -> Void) /// Returns the passed object, to test serialization and deserialization. - func echoNullable(_ everythingArg: AllNullableTypes?, completion: @escaping (Result) -> Void) + func echoNullable( + _ everythingArg: AllNullableTypes?, + completion: @escaping (Result) -> Void) /// Returns passed in arguments of multiple types. /// /// Tests multiple-arity FlutterApi handling. - func sendMultipleNullableTypes(aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int64?, aString aNullableStringArg: String?, completion: @escaping (Result) -> Void) + func sendMultipleNullableTypes( + aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int64?, + aString aNullableStringArg: String?, + completion: @escaping (Result) -> Void) /// Returns the passed boolean, to test serialization and deserialization. func echo(_ aBoolArg: Bool, completion: @escaping (Result) -> Void) /// Returns the passed int, to test serialization and deserialization. @@ -1859,29 +2111,42 @@ protocol FlutterIntegrationCoreApiProtocol { /// Returns the passed string, to test serialization and deserialization. func echo(_ aStringArg: String, completion: @escaping (Result) -> Void) /// Returns the passed byte list, to test serialization and deserialization. - func echo(_ aListArg: FlutterStandardTypedData, completion: @escaping (Result) -> Void) + func echo( + _ aListArg: FlutterStandardTypedData, + completion: @escaping (Result) -> Void) /// Returns the passed list, to test serialization and deserialization. func echo(_ aListArg: [Any?], completion: @escaping (Result<[Any?], FlutterError>) -> Void) /// Returns the passed map, to test serialization and deserialization. - func echo(_ aMapArg: [String?: Any?], completion: @escaping (Result<[String?: Any?], FlutterError>) -> Void) + func echo( + _ aMapArg: [String?: Any?], + completion: @escaping (Result<[String?: Any?], FlutterError>) -> Void) /// Returns the passed enum to test serialization and deserialization. func echo(_ anEnumArg: AnEnum, 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. - func echoNullable(_ anIntArg: Int64?, completion: @escaping (Result) -> Void) + func echoNullable( + _ anIntArg: Int64?, completion: @escaping (Result) -> Void) /// Returns the passed double, to test serialization and deserialization. - func echoNullable(_ aDoubleArg: Double?, completion: @escaping (Result) -> Void) + func echoNullable( + _ aDoubleArg: Double?, completion: @escaping (Result) -> Void) /// Returns the passed string, to test serialization and deserialization. - func echoNullable(_ aStringArg: String?, completion: @escaping (Result) -> Void) + func echoNullable( + _ aStringArg: String?, completion: @escaping (Result) -> Void) /// Returns the passed byte list, to test serialization and deserialization. - func echoNullable(_ aListArg: FlutterStandardTypedData?, completion: @escaping (Result) -> Void) + func echoNullable( + _ aListArg: FlutterStandardTypedData?, + completion: @escaping (Result) -> Void) /// Returns the passed list, to test serialization and deserialization. - func echoNullable(_ aListArg: [Any?]?, completion: @escaping (Result<[Any?]?, FlutterError>) -> Void) + func echoNullable( + _ aListArg: [Any?]?, completion: @escaping (Result<[Any?]?, FlutterError>) -> Void) /// Returns the passed map, to test serialization and deserialization. - func echoNullable(_ aMapArg: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, FlutterError>) -> Void) + func echoNullable( + _ aMapArg: [String?: Any?]?, + completion: @escaping (Result<[String?: Any?]?, FlutterError>) -> Void) /// Returns the passed enum to test serialization and deserialization. - func echoNullable(_ anEnumArg: AnEnum?, completion: @escaping (Result) -> Void) + func echoNullable( + _ anEnumArg: AnEnum?, 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) @@ -1890,7 +2155,7 @@ protocol FlutterIntegrationCoreApiProtocol { } class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { private let binaryMessenger: FlutterBinaryMessenger - init(binaryMessenger: FlutterBinaryMessenger){ + init(binaryMessenger: FlutterBinaryMessenger) { self.binaryMessenger = binaryMessenger } var codec: FlutterStandardMessageCodec { @@ -1899,18 +2164,20 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { /// A no-op function taking no arguments and returning no value, to sanity /// test basic calling. func noop(completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noop" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noop" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { completion(.success(Void())) } @@ -1918,18 +2185,20 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Responds with an error from an async function returning a value. func throwError(completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwError" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwError" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: Any? = listResponse[0] completion(.success(result)) @@ -1938,39 +2207,49 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Responds with an error from an async void function. func throwErrorFromVoid(completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwErrorFromVoid" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwErrorFromVoid" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { completion(.success(Void())) } } } /// Returns the passed object, to test serialization and deserialization. - func echo(_ everythingArg: AllTypes, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllTypes" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echo( + _ everythingArg: AllTypes, completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllTypes" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([everythingArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! AllTypes completion(.success(result)) @@ -1978,19 +2257,24 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed object, to test serialization and deserialization. - func echoNullable(_ everythingArg: AllNullableTypes?, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllNullableTypes" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ everythingArg: AllNullableTypes?, + completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllNullableTypes" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([everythingArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: AllNullableTypes? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2000,21 +2284,32 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { /// Returns passed in arguments of multiple types. /// /// Tests multiple-arity FlutterApi handling. - func sendMultipleNullableTypes(aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int64?, aString aNullableStringArg: String?, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.sendMultipleNullableTypes" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([aNullableBoolArg, aNullableIntArg, aNullableStringArg] as [Any?]) { response in + func sendMultipleNullableTypes( + aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int64?, + aString aNullableStringArg: String?, + completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.sendMultipleNullableTypes" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([aNullableBoolArg, aNullableIntArg, aNullableStringArg] as [Any?]) { + response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! AllNullableTypes completion(.success(result)) @@ -2023,20 +2318,26 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed boolean, to test serialization and deserialization. func echo(_ aBoolArg: Bool, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoBool" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoBool" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aBoolArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! Bool completion(.success(result)) @@ -2045,42 +2346,55 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed int, to test serialization and deserialization. func echo(_ anIntArg: Int64, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoInt" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoInt" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anIntArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { - let result = listResponse[0] is Int64 ? listResponse[0] as! Int64 : Int64(listResponse[0] as! Int32) + let result = + listResponse[0] is Int64 ? listResponse[0] as! Int64 : Int64(listResponse[0] as! Int32) completion(.success(result)) } } } /// Returns the passed double, to test serialization and deserialization. func echo(_ aDoubleArg: Double, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoDouble" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoDouble" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aDoubleArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! Double completion(.success(result)) @@ -2089,20 +2403,26 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed string, to test serialization and deserialization. func echo(_ aStringArg: String, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoString" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoString" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! String completion(.success(result)) @@ -2110,21 +2430,30 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed byte list, to test serialization and deserialization. - func echo(_ aListArg: FlutterStandardTypedData, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoUint8List" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echo( + _ aListArg: FlutterStandardTypedData, + completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoUint8List" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! FlutterStandardTypedData completion(.success(result)) @@ -2133,20 +2462,26 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed list, to test serialization and deserialization. func echo(_ aListArg: [Any?], completion: @escaping (Result<[Any?], FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoList" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoList" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! [Any?] completion(.success(result)) @@ -2154,21 +2489,30 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed map, to test serialization and deserialization. - func echo(_ aMapArg: [String?: Any?], completion: @escaping (Result<[String?: Any?], FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoMap" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echo( + _ aMapArg: [String?: Any?], + completion: @escaping (Result<[String?: Any?], FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoMap" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aMapArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! [String?: Any?] completion(.success(result)) @@ -2177,20 +2521,26 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed enum to test serialization and deserialization. func echo(_ anEnumArg: AnEnum, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoEnum" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoEnum" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anEnumArg.rawValue] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = AnEnum(rawValue: listResponse[0] as! Int)! completion(.success(result)) @@ -2198,19 +2548,22 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed boolean, to test serialization and deserialization. - func echoNullable(_ aBoolArg: Bool?, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableBool" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable(_ aBoolArg: Bool?, completion: @escaping (Result) -> Void) + { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableBool" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aBoolArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: Bool? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2218,39 +2571,51 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed int, to test serialization and deserialization. - func echoNullable(_ anIntArg: Int64?, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableInt" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ anIntArg: Int64?, completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableInt" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anIntArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { - let result: Int64? = isNullish(listResponse[0]) ? nil : (listResponse[0] is Int64? ? listResponse[0] as! Int64? : Int64(listResponse[0] as! Int32)) + let result: Int64? = + isNullish(listResponse[0]) + ? nil + : (listResponse[0] is Int64? + ? listResponse[0] as! Int64? : Int64(listResponse[0] as! Int32)) completion(.success(result)) } } } /// Returns the passed double, to test serialization and deserialization. - func echoNullable(_ aDoubleArg: Double?, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableDouble" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ aDoubleArg: Double?, completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableDouble" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aDoubleArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: Double? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2258,19 +2623,23 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed string, to test serialization and deserialization. - func echoNullable(_ aStringArg: String?, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableString" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ aStringArg: String?, completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableString" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: String? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2278,19 +2647,24 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed byte list, to test serialization and deserialization. - func echoNullable(_ aListArg: FlutterStandardTypedData?, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableUint8List" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ aListArg: FlutterStandardTypedData?, + completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableUint8List" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: FlutterStandardTypedData? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2298,19 +2672,23 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed list, to test serialization and deserialization. - func echoNullable(_ aListArg: [Any?]?, completion: @escaping (Result<[Any?]?, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableList" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ aListArg: [Any?]?, completion: @escaping (Result<[Any?]?, FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableList" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: [Any?]? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2318,19 +2696,24 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed map, to test serialization and deserialization. - func echoNullable(_ aMapArg: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableMap" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ aMapArg: [String?: Any?]?, + completion: @escaping (Result<[String?: Any?]?, FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableMap" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aMapArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: [String?: Any?]? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2338,21 +2721,26 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed enum to test serialization and deserialization. - func echoNullable(_ anEnumArg: AnEnum?, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableEnum" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ anEnumArg: AnEnum?, completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableEnum" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anEnumArg?.rawValue] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { - let result: AnEnum? = isNullish(listResponse[0]) ? nil : AnEnum(rawValue: listResponse[0] as! Int)! + let result: AnEnum? = + isNullish(listResponse[0]) ? nil : AnEnum(rawValue: listResponse[0] as! Int)! completion(.success(result)) } } @@ -2360,39 +2748,48 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. func noopAsync(completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noopAsync" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noopAsync" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { completion(.success(Void())) } } } /// Returns the passed in generic Object asynchronously. - func echoAsync(_ aStringArg: String, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAsyncString" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoAsync(_ aStringArg: String, completion: @escaping (Result) -> Void) + { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAsyncString" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! String completion(.success(result)) @@ -2412,7 +2809,9 @@ class HostTrivialApiSetup { /// The codec used by HostTrivialApi. /// Sets up an instance of `HostTrivialApi` to handle messages through the `binaryMessenger`. static func setUp(binaryMessenger: FlutterBinaryMessenger, api: HostTrivialApi?) { - let noopChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostTrivialApi.noop", binaryMessenger: binaryMessenger) + let noopChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostTrivialApi.noop", + binaryMessenger: binaryMessenger) if let api = api { noopChannel.setMessageHandler { _, reply in do { @@ -2440,32 +2839,36 @@ class HostSmallApiSetup { /// The codec used by HostSmallApi. /// Sets up an instance of `HostSmallApi` to handle messages through the `binaryMessenger`. static func setUp(binaryMessenger: FlutterBinaryMessenger, api: HostSmallApi?) { - let echoChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.echo", binaryMessenger: binaryMessenger) + let echoChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.echo", + binaryMessenger: binaryMessenger) if let api = api { echoChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg = args[0] as! String api.echo(aString: aStringArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { echoChannel.setMessageHandler(nil) } - let voidVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.voidVoid", binaryMessenger: binaryMessenger) + let voidVoidChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.voidVoid", + binaryMessenger: binaryMessenger) if let api = api { voidVoidChannel.setMessageHandler { _, reply in - api.voidVoid() { result in + api.voidVoid { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -2477,10 +2880,10 @@ class HostSmallApiSetup { private class FlutterSmallApiCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { - case 128: - return TestMessage.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) + case 128: + return TestMessage.fromList(self.readValue() as! [Any?]) + default: + return super.readValue(ofType: type) } } } @@ -2514,32 +2917,41 @@ class FlutterSmallApiCodec: FlutterStandardMessageCodec { /// /// Generated protocol from Pigeon that represents Flutter messages that can be called from Swift. protocol FlutterSmallApiProtocol { - func echo(_ msgArg: TestMessage, completion: @escaping (Result) -> Void) + func echo( + _ msgArg: TestMessage, completion: @escaping (Result) -> Void) func echo(_ aStringArg: String, completion: @escaping (Result) -> Void) } class FlutterSmallApi: FlutterSmallApiProtocol { private let binaryMessenger: FlutterBinaryMessenger - init(binaryMessenger: FlutterBinaryMessenger){ + init(binaryMessenger: FlutterBinaryMessenger) { self.binaryMessenger = binaryMessenger } var codec: FlutterStandardMessageCodec { return FlutterSmallApiCodec.shared } - func echo(_ msgArg: TestMessage, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoWrappedList" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echo( + _ msgArg: TestMessage, completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoWrappedList" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([msgArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! TestMessage completion(.success(result)) @@ -2547,20 +2959,26 @@ class FlutterSmallApi: FlutterSmallApiProtocol { } } func echo(_ aStringArg: String, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoString" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoString" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! String completion(.success(result)) 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 c82f94b1c0b..5da16290c7a 100644 --- a/packages/pigeon/platform_tests/test_plugin/macos/Classes/TestPlugin.swift +++ b/packages/pigeon/platform_tests/test_plugin/macos/Classes/TestPlugin.swift @@ -7,10 +7,8 @@ import FlutterMacOS extension FlutterError: Error {} -/** - * This plugin handles the native side of the integration tests in - * example/integration_test/. - */ +/// This plugin handles the native side of the integration tests in +/// example/integration_test/. public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { var flutterAPI: FlutterIntegrationCoreApi @@ -102,15 +100,18 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { } func extractNestedNullableString(from wrapper: AllClassesWrapper) -> String? { - return wrapper.allNullableTypes.aNullableString; + return wrapper.allNullableTypes.aNullableString } func createNestedObject(with nullableString: String?) -> AllClassesWrapper { return AllClassesWrapper(allNullableTypes: AllNullableTypes(aNullableString: nullableString)) } - func sendMultipleNullableTypes(aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String?) -> AllNullableTypes { - let someThings = AllNullableTypes(aNullableBool: aNullableBool, aNullableInt: aNullableInt, aNullableString: aNullableString) + func sendMultipleNullableTypes( + aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String? + ) -> AllNullableTypes { + let someThings = AllNullableTypes( + aNullableBool: aNullableBool, aNullableInt: aNullableInt, aNullableString: aNullableString) return someThings } @@ -178,7 +179,10 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { completion(.success(everything)) } - func echoAsync(_ everything: AllNullableTypes?, completion: @escaping (Result) -> Void) { + func echoAsync( + _ everything: AllNullableTypes?, + completion: @escaping (Result) -> Void + ) { completion(.success(everything)) } @@ -198,7 +202,10 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { completion(.success(aString)) } - func echoAsync(_ aUint8List: FlutterStandardTypedData, completion: @escaping (Result) -> Void) { + func echoAsync( + _ aUint8List: FlutterStandardTypedData, + completion: @escaping (Result) -> Void + ) { completion(.success(aUint8List)) } @@ -210,7 +217,9 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { completion(.success(aList)) } - func echoAsync(_ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) { + func echoAsync( + _ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void + ) { completion(.success(aMap)) } @@ -222,7 +231,8 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { completion(.success(anInt)) } - func echoAsyncNullable(_ aDouble: Double?, completion: @escaping (Result) -> Void) { + func echoAsyncNullable(_ aDouble: Double?, completion: @escaping (Result) -> Void) + { completion(.success(aDouble)) } @@ -230,11 +240,15 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { completion(.success(aBool)) } - func echoAsyncNullable(_ aString: String?, completion: @escaping (Result) -> Void) { + func echoAsyncNullable(_ aString: String?, completion: @escaping (Result) -> Void) + { completion(.success(aString)) } - func echoAsyncNullable(_ aUint8List: FlutterStandardTypedData?, completion: @escaping (Result) -> Void) { + func echoAsyncNullable( + _ aUint8List: FlutterStandardTypedData?, + completion: @escaping (Result) -> Void + ) { completion(.success(aUint8List)) } @@ -246,66 +260,74 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { completion(.success(aList)) } - func echoAsyncNullable(_ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) { + func echoAsyncNullable( + _ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void + ) { completion(.success(aMap)) } - func echoAsyncNullable(_ anEnum: AnEnum?, completion: @escaping (Result) -> Void) { + func echoAsyncNullable(_ anEnum: AnEnum?, completion: @escaping (Result) -> Void) + { completion(.success(anEnum)) } func callFlutterNoop(completion: @escaping (Result) -> Void) { - flutterAPI.noop() { response in + flutterAPI.noop { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } func callFlutterThrowError(completion: @escaping (Result) -> Void) { - flutterAPI.throwError() { response in + flutterAPI.throwError { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } func callFlutterThrowErrorFromVoid(completion: @escaping (Result) -> Void) { - flutterAPI.throwErrorFromVoid() { response in + flutterAPI.throwErrorFromVoid { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEcho(_ everything: AllTypes, completion: @escaping (Result) -> Void) { + func callFlutterEcho( + _ everything: AllTypes, completion: @escaping (Result) -> Void + ) { flutterAPI.echo(everything) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) + } } } - func callFlutterEcho(_ everything: AllNullableTypes?, completion: @escaping (Result) -> Void) { + func callFlutterEcho( + _ everything: AllNullableTypes?, + completion: @escaping (Result) -> Void + ) { flutterAPI.echoNullable(everything) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) + } } } @@ -321,10 +343,10 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { aString: aNullableString ) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } @@ -332,10 +354,10 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { func callFlutterEcho(_ aBool: Bool, completion: @escaping (Result) -> Void) { flutterAPI.echo(aBool) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } @@ -343,10 +365,10 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { func callFlutterEcho(_ anInt: Int64, completion: @escaping (Result) -> Void) { flutterAPI.echo(anInt) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } @@ -354,10 +376,10 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { func callFlutterEcho(_ aDouble: Double, completion: @escaping (Result) -> Void) { flutterAPI.echo(aDouble) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } @@ -365,21 +387,24 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { func callFlutterEcho(_ aString: String, completion: @escaping (Result) -> Void) { flutterAPI.echo(aString) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEcho(_ aList: FlutterStandardTypedData, completion: @escaping (Result) -> Void) { + func callFlutterEcho( + _ aList: FlutterStandardTypedData, + completion: @escaping (Result) -> Void + ) { flutterAPI.echo(aList) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } @@ -387,21 +412,23 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { func callFlutterEcho(_ aList: [Any?], completion: @escaping (Result<[Any?], Error>) -> Void) { flutterAPI.echo(aList) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEcho(_ aMap: [String? : Any?], completion: @escaping (Result<[String? : Any?], Error>) -> Void) { + func callFlutterEcho( + _ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void + ) { flutterAPI.echo(aMap) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } @@ -409,99 +436,115 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { func callFlutterEcho(_ anEnum: AnEnum, completion: @escaping (Result) -> Void) { flutterAPI.echo(anEnum) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEchoNullable(_ aBool: Bool?, completion: @escaping (Result) -> Void) { + func callFlutterEchoNullable(_ aBool: Bool?, completion: @escaping (Result) -> Void) + { flutterAPI.echoNullable(aBool) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEchoNullable(_ anInt: Int64?, completion: @escaping (Result) -> Void) { + func callFlutterEchoNullable( + _ anInt: Int64?, completion: @escaping (Result) -> Void + ) { flutterAPI.echoNullable(anInt) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEchoNullable(_ aDouble: Double?, completion: @escaping (Result) -> Void) { + func callFlutterEchoNullable( + _ aDouble: Double?, completion: @escaping (Result) -> Void + ) { flutterAPI.echoNullable(aDouble) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEchoNullable(_ aString: String?, completion: @escaping (Result) -> Void) { + func callFlutterEchoNullable( + _ aString: String?, completion: @escaping (Result) -> Void + ) { flutterAPI.echoNullable(aString) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - - func callFlutterEchoNullable(_ aList: FlutterStandardTypedData?, completion: @escaping (Result) -> Void) { + + func callFlutterEchoNullable( + _ aList: FlutterStandardTypedData?, + completion: @escaping (Result) -> Void + ) { flutterAPI.echoNullable(aList) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEchoNullable(_ aList: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void) { + func callFlutterEchoNullable( + _ aList: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void + ) { flutterAPI.echoNullable(aList) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEchoNullable(_ aMap: [String? : Any?]?, completion: @escaping (Result<[String? : Any?]?, Error>) -> Void) { + func callFlutterEchoNullable( + _ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void + ) { flutterAPI.echoNullable(aMap) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterNullableEcho(_ anEnum: AnEnum?, completion: @escaping (Result) -> Void) { + func callFlutterNullableEcho( + _ anEnum: AnEnum?, completion: @escaping (Result) -> Void + ) { flutterAPI.echoNullable(anEnum) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } - } + } } } From 865d95c2c0d5a2967300bd0b754dfbe7dd7fec26 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Thu, 18 Jan 2024 15:24:44 -0500 Subject: [PATCH 2/9] Fix trailing whitespace in prologue --- packages/pigeon/lib/generator_tools.dart | 2 +- packages/pigeon/test/swift_generator_test.dart | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/pigeon/lib/generator_tools.dart b/packages/pigeon/lib/generator_tools.dart index 31a4d0e778b..1743cea12a1 100644 --- a/packages/pigeon/lib/generator_tools.dart +++ b/packages/pigeon/lib/generator_tools.dart @@ -309,7 +309,7 @@ bool isVoid(TypeMirror type) { void addLines(Indent indent, Iterable lines, {String? linePrefix}) { final String prefix = linePrefix ?? ''; for (final String line in lines) { - indent.writeln('$prefix$line'); + indent.writeln('$prefix$line'.trimRight()); } } diff --git a/packages/pigeon/test/swift_generator_test.dart b/packages/pigeon/test/swift_generator_test.dart index 4c07b784eb7..468b46df429 100644 --- a/packages/pigeon/test/swift_generator_test.dart +++ b/packages/pigeon/test/swift_generator_test.dart @@ -714,8 +714,8 @@ void main() { test('header', () { final Root root = Root(apis: [], classes: [], enums: []); final StringBuffer sink = StringBuffer(); - final SwiftOptions swiftOptions = SwiftOptions( - copyrightHeader: makeIterable('hello world'), + const SwiftOptions swiftOptions = SwiftOptions( + copyrightHeader: ['hello world', ''], ); const SwiftGenerator generator = SwiftGenerator(); generator.generate( @@ -726,6 +726,8 @@ void main() { ); final String code = sink.toString(); expect(code, startsWith('// hello world')); + // There should be no trailing whitespace on generated comments. + expect(code, isNot(matches(RegExp(r'^//.* $', multiLine: true)))); }); test('generics - list', () { From b5aee8fc2022cf8cce8d987a88ffb34994a93fe8 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Fri, 19 Jan 2024 08:16:50 -0500 Subject: [PATCH 3/9] Various small fixes --- packages/pigeon/lib/swift_generator.dart | 34 ++++++++++++------- .../pigeon/test/swift_generator_test.dart | 17 ++++++++++ 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/packages/pigeon/lib/swift_generator.dart b/packages/pigeon/lib/swift_generator.dart index ae869426e62..bba3ec78c69 100644 --- a/packages/pigeon/lib/swift_generator.dart +++ b/packages/pigeon/lib/swift_generator.dart @@ -76,13 +76,14 @@ class SwiftGenerator extends StructuredGenerator { required String dartPackageName, }) { indent.writeln('import Foundation'); + indent.newln(); indent.format(''' #if os(iOS) -import Flutter + import Flutter #elseif os(macOS) -import FlutterMacOS + import FlutterMacOS #else -#error("Unsupported platform.") + #error("Unsupported platform.") #endif'''); } @@ -160,6 +161,9 @@ import FlutterMacOS indent.addScoped('{', '}', () { indent.write('return '); indent.addScoped('[', ']', () { + // Follow swift-format style, which is to use a trailing comma unless + // there is only one element. + final String separator = classDefinition.fields.length > 1 ? ',' : ''; for (final NamedType field in getFieldsInSerializationOrder(classDefinition)) { String toWriteValue = ''; @@ -173,7 +177,7 @@ import FlutterMacOS toWriteValue = field.name; } - indent.writeln('$toWriteValue,'); + indent.writeln('$toWriteValue$separator'); } }); }); @@ -294,7 +298,7 @@ import FlutterMacOS indent.write('class ${api.name}: ${api.name}Protocol '); indent.addScoped('{', '}', () { indent.writeln('private let binaryMessenger: FlutterBinaryMessenger'); - indent.write('init(binaryMessenger: FlutterBinaryMessenger)'); + indent.write('init(binaryMessenger: FlutterBinaryMessenger) '); indent.addScoped('{', '}', () { indent.writeln('self.binaryMessenger = binaryMessenger'); }); @@ -333,7 +337,7 @@ import FlutterMacOS 'completion(.failure(createConnectionError(withChannelName:channelName)))'); indent.writeln('return'); }); - indent.writeScoped('if (listResponse.count > 1) {', '} ', () { + indent.writeScoped('if listResponse.count > 1 {', '} ', () { indent.writeln('let code: String = listResponse[0] as! String'); indent.writeln( 'let message: String? = nilOrValue(listResponse[1])'); @@ -343,7 +347,7 @@ import FlutterMacOS 'completion(.failure(FlutterError(code: code, message: message, details: details)));'); }, addTrailingNewline: false); if (!func.returnType.isNullable && !func.returnType.isVoid) { - indent.addScoped('else if (listResponse[0] == nil) {', '} ', () { + indent.addScoped('else if listResponse[0] == nil {', '} ', () { indent.writeln( 'completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: "")))'); }, addTrailingNewline: false); @@ -495,8 +499,14 @@ import FlutterMacOS }); } final String tryStatement = method.isAsynchronous ? '' : 'try '; + // Empty parens are not required when calling a method whose only + // argument is a trailing closure. + final String argumentString = + methodArgument.isEmpty && method.isAsynchronous + ? '' + : '(${methodArgument.join(', ')})'; final String call = - '${tryStatement}api.${components.name}(${methodArgument.join(', ')})'; + '${tryStatement}api.${components.name}$argumentString'; if (method.isAsynchronous) { final String resultName = method.returnType.isVoid ? 'nil' : 'res'; @@ -506,7 +516,7 @@ import FlutterMacOS indent.addScoped('{ result in', '}', () { indent.write('switch result '); - indent.addScoped('{', '}', () { + indent.addScoped('{', '}', nestCount: 0, () { final String nullsafe = method.returnType.isNullable ? '?' : ''; final String enumTag = @@ -573,7 +583,7 @@ import FlutterMacOS indent.write('override func readValue(ofType type: UInt8) -> Any? '); indent.addScoped('{', '}', () { indent.write('switch type '); - indent.addScoped('{', '}', () { + indent.addScoped('{', '}', nestCount: 0, () { for (final EnumeratedClass customClass in getCodecClasses(api, root)) { indent.writeln('case ${customClass.enumeration}:'); @@ -764,14 +774,14 @@ import FlutterMacOS indent.addScoped('[', ']', () { indent.writeln('flutterError.code,'); indent.writeln('flutterError.message,'); - indent.writeln('flutterError.details'); + indent.writeln('flutterError.details,'); }); }); indent.write('return '); indent.addScoped('[', ']', () { indent.writeln(r'"\(error)",'); indent.writeln(r'"\(type(of: error))",'); - indent.writeln(r'"Stacktrace: \(Thread.callStackSymbols)"'); + indent.writeln(r'"Stacktrace: \(Thread.callStackSymbols)",'); }); }); } diff --git a/packages/pigeon/test/swift_generator_test.dart b/packages/pigeon/test/swift_generator_test.dart index 468b46df429..285e1ae02a8 100644 --- a/packages/pigeon/test/swift_generator_test.dart +++ b/packages/pigeon/test/swift_generator_test.dart @@ -52,6 +52,7 @@ void main() { expect(code, contains('var field1: Int64? = nil')); expect(code, contains('static func fromList(_ list: [Any?]) -> Foobar?')); expect(code, contains('func toList() -> [Any?]')); + expect(code, isNot(contains('if ('))); }); test('gen one enum', () { @@ -80,6 +81,7 @@ void main() { expect(code, contains('enum Foobar: Int')); expect(code, contains(' case one = 0')); expect(code, contains(' case two = 1')); + expect(code, isNot(contains('if ('))); }); test('primitive enum host', () { @@ -116,6 +118,7 @@ void main() { final String code = sink.toString(); expect(code, contains('enum Foo: Int')); expect(code, contains('let fooArg = Foo(rawValue: args[0] as! Int)!')); + expect(code, isNot(contains('if ('))); }); test('gen one host api', () { @@ -170,6 +173,7 @@ void main() { expect(code, contains('protocol Api')); expect(code, matches('func doSomething.*Input.*Output')); expect(code, contains('doSomethingChannel.setMessageHandler')); + expect(code, isNot(contains('if ('))); }); test('all the simple datatypes header', () { @@ -298,6 +302,7 @@ void main() { expect(code, contains('class Api')); expect(code, contains('init(binaryMessenger: FlutterBinaryMessenger)')); expect(code, matches('func doSomething.*Input.*Output')); + expect(code, isNot(contains('if ('))); }); test('gen host void api', () { @@ -339,6 +344,7 @@ void main() { final String code = sink.toString(); expect(code, isNot(matches('.*doSomething(.*) ->'))); expect(code, matches('doSomething(.*)')); + expect(code, isNot(contains('if ('))); }); test('gen flutter void return api', () { @@ -381,6 +387,7 @@ void main() { expect(code, contains('completion: @escaping (Result) -> Void')); expect(code, contains('completion(.success(Void()))')); + expect(code, isNot(contains('if ('))); }); test('gen host void argument api', () { @@ -419,6 +426,7 @@ void main() { expect(code, contains('func doSomething() throws -> Output')); expect(code, contains('let result = try api.doSomething()')); expect(code, contains('reply(wrapResult(result))')); + expect(code, isNot(contains('if ('))); }); test('gen flutter void argument api', () { @@ -459,6 +467,7 @@ void main() { contains( 'func doSomething(completion: @escaping (Result) -> Void)')); expect(code, contains('channel.sendMessage(nil')); + expect(code, isNot(contains('if ('))); }); test('gen list', () { @@ -484,6 +493,7 @@ void main() { final String code = sink.toString(); expect(code, contains('struct Foobar')); expect(code, contains('var field1: [Any?]? = nil')); + expect(code, isNot(contains('if ('))); }); test('gen map', () { @@ -509,6 +519,7 @@ void main() { final String code = sink.toString(); expect(code, contains('struct Foobar')); expect(code, contains('var field1: [AnyHashable: Any?]? = nil')); + expect(code, isNot(contains('if ('))); }); test('gen nested', () { @@ -556,6 +567,9 @@ void main() { expect(code, contains('static func fromList(_ list: [Any?]) -> Outer?')); expect(code, contains('nested = Nested.fromList(nestedList)')); expect(code, contains('func toList() -> [Any?]')); + expect(code, isNot(contains('if ('))); + // Single-element list serializations should not have a trailing comma. + expect(code, matches(RegExp(r'return \[\s*data\s*]'))); }); test('gen one async Host Api', () { @@ -611,6 +625,7 @@ void main() { expect(code, contains('protocol Api')); expect(code, contains('api.doSomething(arg: argArg) { result in')); expect(code, contains('reply(wrapResult(res))')); + expect(code, isNot(contains('if ('))); }); test('gen one async Flutter Api', () { @@ -665,6 +680,7 @@ void main() { final String code = sink.toString(); expect(code, contains('class Api')); expect(code, matches('func doSomething.*Input.*completion.*Output.*Void')); + expect(code, isNot(contains('if ('))); }); test('gen one enum class', () { @@ -705,6 +721,7 @@ void main() { expect(code, contains('enum Enum1: Int')); expect(code, contains('case one = 0')); expect(code, contains('case two = 1')); + expect(code, isNot(contains('if ('))); }); Iterable makeIterable(String string) sync* { From b11c297854a405fc4f51feb7cd7e31c18093c09c Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Fri, 19 Jan 2024 08:20:38 -0500 Subject: [PATCH 4/9] semicolon --- packages/pigeon/lib/swift_generator.dart | 2 +- packages/pigeon/test/swift_generator_test.dart | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/pigeon/lib/swift_generator.dart b/packages/pigeon/lib/swift_generator.dart index bba3ec78c69..acb4751c7f0 100644 --- a/packages/pigeon/lib/swift_generator.dart +++ b/packages/pigeon/lib/swift_generator.dart @@ -344,7 +344,7 @@ class SwiftGenerator extends StructuredGenerator { indent.writeln( 'let details: String? = nilOrValue(listResponse[2])'); indent.writeln( - 'completion(.failure(FlutterError(code: code, message: message, details: details)));'); + 'completion(.failure(FlutterError(code: code, message: message, details: details)))'); }, addTrailingNewline: false); if (!func.returnType.isNullable && !func.returnType.isVoid) { indent.addScoped('else if listResponse[0] == nil {', '} ', () { diff --git a/packages/pigeon/test/swift_generator_test.dart b/packages/pigeon/test/swift_generator_test.dart index 285e1ae02a8..c4404af08fc 100644 --- a/packages/pigeon/test/swift_generator_test.dart +++ b/packages/pigeon/test/swift_generator_test.dart @@ -4,6 +4,7 @@ import 'package:pigeon/ast.dart'; import 'package:pigeon/swift_generator.dart'; +import 'package:test/expect.dart'; import 'package:test/test.dart'; import 'dart_generator_test.dart'; @@ -303,6 +304,7 @@ void main() { expect(code, contains('init(binaryMessenger: FlutterBinaryMessenger)')); expect(code, matches('func doSomething.*Input.*Output')); expect(code, isNot(contains('if ('))); + expect(code, isNot(matches(RegExp(r';$', multiLine: true)))); }); test('gen host void api', () { From 89fa695cd4f191285cc48b8e73879fe2e378e2fc Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Fri, 19 Jan 2024 08:23:54 -0500 Subject: [PATCH 5/9] As generated --- .../example/app/ios/Runner/Messages.g.swift | 37 +- packages/pigeon/lib/swift_generator.dart | 2 +- .../ios/Classes/CoreTests.gen.swift | 837 +++++------------- .../macos/Classes/CoreTests.gen.swift | 837 +++++------------- 4 files changed, 440 insertions(+), 1273 deletions(-) diff --git a/packages/pigeon/example/app/ios/Runner/Messages.g.swift b/packages/pigeon/example/app/ios/Runner/Messages.g.swift index ad6a337a6db..100fa3b7753 100644 --- a/packages/pigeon/example/app/ios/Runner/Messages.g.swift +++ b/packages/pigeon/example/app/ios/Runner/Messages.g.swift @@ -5,12 +5,13 @@ // See also: https://pub.dev/packages/pigeon import Foundation + #if os(iOS) -import Flutter + import Flutter #elseif os(macOS) -import FlutterMacOS + import FlutterMacOS #else -#error("Unsupported platform.") + #error("Unsupported platform.") #endif private func wrapResult(_ result: Any?) -> [Any?] { @@ -22,13 +23,13 @@ private func wrapError(_ error: Any) -> [Any?] { return [ flutterError.code, flutterError.message, - flutterError.details + flutterError.details, ] } return [ "\(error)", "\(type(of: error))", - "Stacktrace: \(Thread.callStackSymbols)" + "Stacktrace: \(Thread.callStackSymbols)", ] } @@ -83,10 +84,10 @@ struct MessageData { private class ExampleHostApiCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { - case 128: - return MessageData.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) + case 128: + return MessageData.fromList(self.readValue() as! [Any?]) + default: + return super.readValue(ofType: type) } } } @@ -165,10 +166,10 @@ class ExampleHostApiSetup { let messageArg = args[0] as! MessageData api.sendMessage(message: messageArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -183,7 +184,7 @@ protocol MessageFlutterApiProtocol { } class MessageFlutterApi: MessageFlutterApiProtocol { private let binaryMessenger: FlutterBinaryMessenger - init(binaryMessenger: FlutterBinaryMessenger){ + init(binaryMessenger: FlutterBinaryMessenger) { self.binaryMessenger = binaryMessenger } func flutterMethod(aString aStringArg: String?, completion: @escaping (Result) -> Void) { @@ -191,15 +192,15 @@ class MessageFlutterApi: MessageFlutterApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + 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(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! String diff --git a/packages/pigeon/lib/swift_generator.dart b/packages/pigeon/lib/swift_generator.dart index acb4751c7f0..91319402c4f 100644 --- a/packages/pigeon/lib/swift_generator.dart +++ b/packages/pigeon/lib/swift_generator.dart @@ -334,7 +334,7 @@ class SwiftGenerator extends StructuredGenerator { indent.writeScoped( 'guard let listResponse = response as? [Any?] else {', '}', () { indent.writeln( - 'completion(.failure(createConnectionError(withChannelName:channelName)))'); + 'completion(.failure(createConnectionError(withChannelName: channelName)))'); indent.writeln('return'); }); indent.writeScoped('if listResponse.count > 1 {', '} ', () { 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 14bcb9a4113..4dd101c0ccc 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 @@ -35,9 +35,7 @@ private func wrapError(_ error: Any) -> [Any?] { } private func createConnectionError(withChannelName channelName: String) -> FlutterError { - return FlutterError( - code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", - details: "") + return FlutterError(code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", details: "") } private func isNullish(_ value: Any?) -> Bool { @@ -146,10 +144,8 @@ struct AllNullableTypes { static func fromList(_ list: [Any?]) -> AllNullableTypes? { let aNullableBool: Bool? = nilOrValue(list[0]) - let aNullableInt: Int64? = - isNullish(list[1]) ? nil : (list[1] is Int64? ? list[1] as! Int64? : Int64(list[1] as! Int32)) - let aNullableInt64: Int64? = - isNullish(list[2]) ? nil : (list[2] is Int64? ? list[2] as! Int64? : Int64(list[2] as! Int32)) + let aNullableInt: Int64? = isNullish(list[1]) ? nil : (list[1] is Int64? ? list[1] as! Int64? : Int64(list[1] as! Int32)) + let aNullableInt64: Int64? = isNullish(list[2]) ? nil : (list[2] is Int64? ? list[2] as! Int64? : Int64(list[2] as! Int32)) let aNullableDouble: Double? = nilOrValue(list[3]) let aNullableByteArray: FlutterStandardTypedData? = nilOrValue(list[4]) let aNullable4ByteArray: FlutterStandardTypedData? = nilOrValue(list[5]) @@ -308,8 +304,7 @@ private class HostIntegrationCoreApiCodecReaderWriter: FlutterStandardReaderWrit } class HostIntegrationCoreApiCodec: FlutterStandardMessageCodec { - static let shared = HostIntegrationCoreApiCodec( - readerWriter: HostIntegrationCoreApiCodecReaderWriter()) + static let shared = HostIntegrationCoreApiCodec(readerWriter: HostIntegrationCoreApiCodecReaderWriter()) } /// The core interface that each host language plugin must implement in @@ -363,9 +358,7 @@ protocol HostIntegrationCoreApi { /// sending of nested objects. func createNestedObject(with nullableString: String?) throws -> AllClassesWrapper /// Returns passed in arguments of multiple types. - func sendMultipleNullableTypes( - aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String? - ) throws -> AllNullableTypes + func sendMultipleNullableTypes(aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String?) throws -> AllNullableTypes /// Returns passed in int. func echo(_ aNullableInt: Int64?) throws -> Int64? /// Returns passed in double. @@ -399,16 +392,13 @@ protocol HostIntegrationCoreApi { /// Returns the passed string asynchronously. func echoAsync(_ aString: String, completion: @escaping (Result) -> Void) /// Returns the passed in Uint8List asynchronously. - func echoAsync( - _ aUint8List: FlutterStandardTypedData, - completion: @escaping (Result) -> Void) + func echoAsync(_ aUint8List: FlutterStandardTypedData, completion: @escaping (Result) -> Void) /// Returns the passed in generic Object asynchronously. func echoAsync(_ anObject: Any, completion: @escaping (Result) -> Void) /// Returns the passed list, to test asynchronous serialization and deserialization. func echoAsync(_ aList: [Any?], completion: @escaping (Result<[Any?], Error>) -> Void) /// Returns the passed map, to test asynchronous serialization and deserialization. - func echoAsync( - _ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) + func echoAsync(_ 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) /// Responds with an error from an async function returning a value. @@ -420,9 +410,7 @@ protocol HostIntegrationCoreApi { /// Returns the passed object, to test async serialization and deserialization. func echoAsync(_ everything: AllTypes, completion: @escaping (Result) -> Void) /// Returns the passed object, to test serialization and deserialization. - func echoAsync( - _ everything: AllNullableTypes?, - completion: @escaping (Result) -> Void) + func echoAsync(_ everything: AllNullableTypes?, completion: @escaping (Result) -> Void) /// Returns passed in int asynchronously. func echoAsyncNullable(_ anInt: Int64?, completion: @escaping (Result) -> Void) /// Returns passed in double asynchronously. @@ -432,56 +420,37 @@ protocol HostIntegrationCoreApi { /// Returns the passed string asynchronously. func echoAsyncNullable(_ aString: String?, completion: @escaping (Result) -> Void) /// Returns the passed in Uint8List asynchronously. - func echoAsyncNullable( - _ aUint8List: FlutterStandardTypedData?, - completion: @escaping (Result) -> Void) + func echoAsyncNullable(_ aUint8List: FlutterStandardTypedData?, completion: @escaping (Result) -> Void) /// Returns the passed in generic Object asynchronously. func echoAsyncNullable(_ anObject: Any?, completion: @escaping (Result) -> Void) /// Returns the passed list, to test asynchronous serialization and deserialization. func echoAsyncNullable(_ aList: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void) /// Returns the passed map, to test asynchronous serialization and deserialization. - func echoAsyncNullable( - _ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) + func echoAsyncNullable(_ 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) func callFlutterNoop(completion: @escaping (Result) -> Void) func callFlutterThrowError(completion: @escaping (Result) -> Void) func callFlutterThrowErrorFromVoid(completion: @escaping (Result) -> Void) - func callFlutterEcho( - _ everything: AllTypes, completion: @escaping (Result) -> Void) - func callFlutterEcho( - _ everything: AllNullableTypes?, - completion: @escaping (Result) -> Void) - func callFlutterSendMultipleNullableTypes( - aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String?, - completion: @escaping (Result) -> Void) + func callFlutterEcho(_ everything: AllTypes, completion: @escaping (Result) -> Void) + func callFlutterEcho(_ everything: AllNullableTypes?, completion: @escaping (Result) -> Void) + func callFlutterSendMultipleNullableTypes(aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String?, completion: @escaping (Result) -> Void) func callFlutterEcho(_ aBool: Bool, completion: @escaping (Result) -> Void) func callFlutterEcho(_ anInt: Int64, completion: @escaping (Result) -> Void) func callFlutterEcho(_ aDouble: Double, completion: @escaping (Result) -> Void) func callFlutterEcho(_ aString: String, completion: @escaping (Result) -> Void) - func callFlutterEcho( - _ aList: FlutterStandardTypedData, - completion: @escaping (Result) -> Void) + func callFlutterEcho(_ aList: FlutterStandardTypedData, completion: @escaping (Result) -> Void) func callFlutterEcho(_ aList: [Any?], completion: @escaping (Result<[Any?], Error>) -> Void) - func callFlutterEcho( - _ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) + func callFlutterEcho(_ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) func callFlutterEcho(_ anEnum: AnEnum, completion: @escaping (Result) -> Void) func callFlutterEchoNullable(_ aBool: Bool?, completion: @escaping (Result) -> Void) - func callFlutterEchoNullable( - _ anInt: Int64?, completion: @escaping (Result) -> Void) - func callFlutterEchoNullable( - _ aDouble: Double?, completion: @escaping (Result) -> Void) - func callFlutterEchoNullable( - _ aString: String?, completion: @escaping (Result) -> Void) - func callFlutterEchoNullable( - _ aList: FlutterStandardTypedData?, - completion: @escaping (Result) -> Void) - func callFlutterEchoNullable( - _ aList: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void) - func callFlutterEchoNullable( - _ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) - func callFlutterNullableEcho( - _ anEnum: AnEnum?, completion: @escaping (Result) -> Void) + func callFlutterEchoNullable(_ anInt: Int64?, completion: @escaping (Result) -> Void) + func callFlutterEchoNullable(_ aDouble: Double?, completion: @escaping (Result) -> Void) + func callFlutterEchoNullable(_ aString: String?, completion: @escaping (Result) -> Void) + func callFlutterEchoNullable(_ aList: FlutterStandardTypedData?, completion: @escaping (Result) -> Void) + func callFlutterEchoNullable(_ aList: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void) + func callFlutterEchoNullable(_ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) + func callFlutterNullableEcho(_ anEnum: AnEnum?, completion: @escaping (Result) -> Void) } /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. @@ -492,9 +461,7 @@ class HostIntegrationCoreApiSetup { static func setUp(binaryMessenger: FlutterBinaryMessenger, api: HostIntegrationCoreApi?) { /// A no-op function taking no arguments and returning no value, to sanity /// test basic calling. - let noopChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noop", - binaryMessenger: binaryMessenger, codec: codec) + let noopChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noop", binaryMessenger: binaryMessenger, codec: codec) if let api = api { noopChannel.setMessageHandler { _, reply in do { @@ -508,9 +475,7 @@ class HostIntegrationCoreApiSetup { noopChannel.setMessageHandler(nil) } /// Returns the passed object, to test serialization and deserialization. - let echoAllTypesChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllTypes", - binaryMessenger: binaryMessenger, codec: codec) + let echoAllTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllTypes", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAllTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -526,9 +491,7 @@ class HostIntegrationCoreApiSetup { echoAllTypesChannel.setMessageHandler(nil) } /// Returns an error, to test error handling. - let throwErrorChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwError", - binaryMessenger: binaryMessenger, codec: codec) + let throwErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwError", binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwErrorChannel.setMessageHandler { _, reply in do { @@ -542,9 +505,7 @@ class HostIntegrationCoreApiSetup { throwErrorChannel.setMessageHandler(nil) } /// Returns an error from a void function, to test error handling. - let throwErrorFromVoidChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwErrorFromVoid", - binaryMessenger: binaryMessenger, codec: codec) + let throwErrorFromVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwErrorFromVoid", binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwErrorFromVoidChannel.setMessageHandler { _, reply in do { @@ -558,9 +519,7 @@ class HostIntegrationCoreApiSetup { throwErrorFromVoidChannel.setMessageHandler(nil) } /// Returns a Flutter error, to test error handling. - let throwFlutterErrorChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwFlutterError", - binaryMessenger: binaryMessenger, codec: codec) + let throwFlutterErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwFlutterError", binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwFlutterErrorChannel.setMessageHandler { _, reply in do { @@ -574,9 +533,7 @@ class HostIntegrationCoreApiSetup { throwFlutterErrorChannel.setMessageHandler(nil) } /// Returns passed in int. - let echoIntChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoInt", - binaryMessenger: binaryMessenger, codec: codec) + let echoIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoInt", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -592,9 +549,7 @@ class HostIntegrationCoreApiSetup { echoIntChannel.setMessageHandler(nil) } /// Returns passed in double. - let echoDoubleChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoDouble", - binaryMessenger: binaryMessenger, codec: codec) + let echoDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoDouble", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -610,9 +565,7 @@ class HostIntegrationCoreApiSetup { echoDoubleChannel.setMessageHandler(nil) } /// Returns the passed in boolean. - let echoBoolChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoBool", - binaryMessenger: binaryMessenger, codec: codec) + let echoBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoBool", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -628,9 +581,7 @@ class HostIntegrationCoreApiSetup { echoBoolChannel.setMessageHandler(nil) } /// Returns the passed in string. - let echoStringChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoString", - binaryMessenger: binaryMessenger, codec: codec) + let echoStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoString", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -646,9 +597,7 @@ class HostIntegrationCoreApiSetup { echoStringChannel.setMessageHandler(nil) } /// Returns the passed in Uint8List. - let echoUint8ListChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoUint8List", - binaryMessenger: binaryMessenger, codec: codec) + let echoUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoUint8List", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -664,9 +613,7 @@ class HostIntegrationCoreApiSetup { echoUint8ListChannel.setMessageHandler(nil) } /// Returns the passed in generic Object. - let echoObjectChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoObject", - binaryMessenger: binaryMessenger, codec: codec) + let echoObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoObject", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -682,9 +629,7 @@ class HostIntegrationCoreApiSetup { echoObjectChannel.setMessageHandler(nil) } /// Returns the passed list, to test serialization and deserialization. - let echoListChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoList", - binaryMessenger: binaryMessenger, codec: codec) + let echoListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoList", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -700,9 +645,7 @@ class HostIntegrationCoreApiSetup { echoListChannel.setMessageHandler(nil) } /// Returns the passed map, to test serialization and deserialization. - let echoMapChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoMap", - binaryMessenger: binaryMessenger, codec: codec) + let echoMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoMap", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -718,9 +661,7 @@ class HostIntegrationCoreApiSetup { echoMapChannel.setMessageHandler(nil) } /// Returns the passed map to test nested class serialization and deserialization. - let echoClassWrapperChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoClassWrapper", - binaryMessenger: binaryMessenger, codec: codec) + let echoClassWrapperChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoClassWrapper", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoClassWrapperChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -736,9 +677,7 @@ class HostIntegrationCoreApiSetup { echoClassWrapperChannel.setMessageHandler(nil) } /// Returns the passed enum to test serialization and deserialization. - let echoEnumChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoEnum", - binaryMessenger: binaryMessenger, codec: codec) + let echoEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoEnum", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -754,10 +693,7 @@ class HostIntegrationCoreApiSetup { echoEnumChannel.setMessageHandler(nil) } /// Returns the default string. - let echoNamedDefaultStringChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedDefaultString", - binaryMessenger: binaryMessenger, codec: codec) + let echoNamedDefaultStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedDefaultString", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNamedDefaultStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -773,10 +709,7 @@ class HostIntegrationCoreApiSetup { echoNamedDefaultStringChannel.setMessageHandler(nil) } /// Returns passed in double. - let echoOptionalDefaultDoubleChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalDefaultDouble", - binaryMessenger: binaryMessenger, codec: codec) + let echoOptionalDefaultDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalDefaultDouble", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoOptionalDefaultDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -792,9 +725,7 @@ class HostIntegrationCoreApiSetup { echoOptionalDefaultDoubleChannel.setMessageHandler(nil) } /// Returns passed in int. - let echoRequiredIntChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoRequiredInt", - binaryMessenger: binaryMessenger, codec: codec) + let echoRequiredIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoRequiredInt", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoRequiredIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -810,10 +741,7 @@ class HostIntegrationCoreApiSetup { echoRequiredIntChannel.setMessageHandler(nil) } /// Returns the passed object, to test serialization and deserialization. - let echoAllNullableTypesChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllNullableTypes", - binaryMessenger: binaryMessenger, codec: codec) + let echoAllNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllNullableTypes", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAllNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -830,10 +758,7 @@ class HostIntegrationCoreApiSetup { } /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. - let extractNestedNullableStringChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.extractNestedNullableString", - binaryMessenger: binaryMessenger, codec: codec) + let extractNestedNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.extractNestedNullableString", binaryMessenger: binaryMessenger, codec: codec) if let api = api { extractNestedNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -850,10 +775,7 @@ class HostIntegrationCoreApiSetup { } /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. - let createNestedNullableStringChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.createNestedNullableString", - binaryMessenger: binaryMessenger, codec: codec) + let createNestedNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.createNestedNullableString", binaryMessenger: binaryMessenger, codec: codec) if let api = api { createNestedNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -869,21 +791,15 @@ class HostIntegrationCoreApiSetup { createNestedNullableStringChannel.setMessageHandler(nil) } /// Returns passed in arguments of multiple types. - let sendMultipleNullableTypesChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.sendMultipleNullableTypes", - binaryMessenger: binaryMessenger, codec: codec) + let sendMultipleNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.sendMultipleNullableTypes", binaryMessenger: binaryMessenger, codec: codec) if let api = api { sendMultipleNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableBoolArg: Bool? = nilOrValue(args[0]) - let aNullableIntArg: Int64? = - isNullish(args[1]) - ? nil : (args[1] is Int64? ? args[1] as! Int64? : Int64(args[1] as! Int32)) + let aNullableIntArg: Int64? = isNullish(args[1]) ? nil : (args[1] is Int64? ? args[1] as! Int64? : Int64(args[1] as! Int32)) let aNullableStringArg: String? = nilOrValue(args[2]) do { - let result = try api.sendMultipleNullableTypes( - aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg) + let result = try api.sendMultipleNullableTypes(aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -893,15 +809,11 @@ class HostIntegrationCoreApiSetup { sendMultipleNullableTypesChannel.setMessageHandler(nil) } /// Returns passed in int. - let echoNullableIntChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableInt", - binaryMessenger: binaryMessenger, codec: codec) + let echoNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableInt", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] - let aNullableIntArg: Int64? = - isNullish(args[0]) - ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) + let aNullableIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) do { let result = try api.echo(aNullableIntArg) reply(wrapResult(result)) @@ -913,9 +825,7 @@ class HostIntegrationCoreApiSetup { echoNullableIntChannel.setMessageHandler(nil) } /// Returns passed in double. - let echoNullableDoubleChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableDouble", - binaryMessenger: binaryMessenger, codec: codec) + let echoNullableDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableDouble", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -931,9 +841,7 @@ class HostIntegrationCoreApiSetup { echoNullableDoubleChannel.setMessageHandler(nil) } /// Returns the passed in boolean. - let echoNullableBoolChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableBool", - binaryMessenger: binaryMessenger, codec: codec) + let echoNullableBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableBool", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -949,9 +857,7 @@ class HostIntegrationCoreApiSetup { echoNullableBoolChannel.setMessageHandler(nil) } /// Returns the passed in string. - let echoNullableStringChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableString", - binaryMessenger: binaryMessenger, codec: codec) + let echoNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableString", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -967,10 +873,7 @@ class HostIntegrationCoreApiSetup { echoNullableStringChannel.setMessageHandler(nil) } /// Returns the passed in Uint8List. - let echoNullableUint8ListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableUint8List", - binaryMessenger: binaryMessenger, codec: codec) + let echoNullableUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableUint8List", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -986,9 +889,7 @@ class HostIntegrationCoreApiSetup { echoNullableUint8ListChannel.setMessageHandler(nil) } /// Returns the passed in generic Object. - let echoNullableObjectChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableObject", - binaryMessenger: binaryMessenger, codec: codec) + let echoNullableObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableObject", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1004,9 +905,7 @@ class HostIntegrationCoreApiSetup { echoNullableObjectChannel.setMessageHandler(nil) } /// Returns the passed list, to test serialization and deserialization. - let echoNullableListChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableList", - binaryMessenger: binaryMessenger, codec: codec) + let echoNullableListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableList", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1022,9 +921,7 @@ class HostIntegrationCoreApiSetup { echoNullableListChannel.setMessageHandler(nil) } /// Returns the passed map, to test serialization and deserialization. - let echoNullableMapChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableMap", - binaryMessenger: binaryMessenger, codec: codec) + let echoNullableMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableMap", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1039,9 +936,7 @@ class HostIntegrationCoreApiSetup { } else { echoNullableMapChannel.setMessageHandler(nil) } - let echoNullableEnumChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableEnum", - binaryMessenger: binaryMessenger, codec: codec) + let echoNullableEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableEnum", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1057,16 +952,11 @@ class HostIntegrationCoreApiSetup { echoNullableEnumChannel.setMessageHandler(nil) } /// Returns passed in int. - let echoOptionalNullableIntChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalNullableInt", - binaryMessenger: binaryMessenger, codec: codec) + let echoOptionalNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalNullableInt", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoOptionalNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] - let aNullableIntArg: Int64? = - isNullish(args[0]) - ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) + let aNullableIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) do { let result = try api.echoOptional(aNullableIntArg) reply(wrapResult(result)) @@ -1078,10 +968,7 @@ class HostIntegrationCoreApiSetup { echoOptionalNullableIntChannel.setMessageHandler(nil) } /// Returns the passed in string. - let echoNamedNullableStringChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedNullableString", - binaryMessenger: binaryMessenger, codec: codec) + let echoNamedNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedNullableString", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNamedNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1098,9 +985,7 @@ class HostIntegrationCoreApiSetup { } /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. - let noopAsyncChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noopAsync", - binaryMessenger: binaryMessenger, codec: codec) + let noopAsyncChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noopAsync", binaryMessenger: binaryMessenger, codec: codec) if let api = api { noopAsyncChannel.setMessageHandler { _, reply in api.noopAsync { result in @@ -1116,9 +1001,7 @@ class HostIntegrationCoreApiSetup { noopAsyncChannel.setMessageHandler(nil) } /// Returns passed in int asynchronously. - let echoAsyncIntChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncInt", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncInt", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1136,9 +1019,7 @@ class HostIntegrationCoreApiSetup { echoAsyncIntChannel.setMessageHandler(nil) } /// Returns passed in double asynchronously. - let echoAsyncDoubleChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncDouble", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncDouble", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1156,9 +1037,7 @@ class HostIntegrationCoreApiSetup { echoAsyncDoubleChannel.setMessageHandler(nil) } /// Returns the passed in boolean asynchronously. - let echoAsyncBoolChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncBool", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncBool", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1176,9 +1055,7 @@ class HostIntegrationCoreApiSetup { echoAsyncBoolChannel.setMessageHandler(nil) } /// Returns the passed string asynchronously. - let echoAsyncStringChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncString", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncString", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1196,9 +1073,7 @@ class HostIntegrationCoreApiSetup { echoAsyncStringChannel.setMessageHandler(nil) } /// Returns the passed in Uint8List asynchronously. - let echoAsyncUint8ListChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncUint8List", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncUint8List", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1216,9 +1091,7 @@ class HostIntegrationCoreApiSetup { echoAsyncUint8ListChannel.setMessageHandler(nil) } /// Returns the passed in generic Object asynchronously. - let echoAsyncObjectChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncObject", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncObject", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1236,9 +1109,7 @@ class HostIntegrationCoreApiSetup { echoAsyncObjectChannel.setMessageHandler(nil) } /// Returns the passed list, to test asynchronous serialization and deserialization. - let echoAsyncListChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncList", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncList", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1256,9 +1127,7 @@ class HostIntegrationCoreApiSetup { echoAsyncListChannel.setMessageHandler(nil) } /// Returns the passed map, to test asynchronous serialization and deserialization. - let echoAsyncMapChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncMap", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncMap", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1276,9 +1145,7 @@ class HostIntegrationCoreApiSetup { echoAsyncMapChannel.setMessageHandler(nil) } /// Returns the passed enum, to test asynchronous serialization and deserialization. - let echoAsyncEnumChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncEnum", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncEnum", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1296,9 +1163,7 @@ class HostIntegrationCoreApiSetup { echoAsyncEnumChannel.setMessageHandler(nil) } /// Responds with an error from an async function returning a value. - let throwAsyncErrorChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncError", - binaryMessenger: binaryMessenger, codec: codec) + let throwAsyncErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncError", binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwAsyncErrorChannel.setMessageHandler { _, reply in api.throwAsyncError { result in @@ -1314,10 +1179,7 @@ class HostIntegrationCoreApiSetup { throwAsyncErrorChannel.setMessageHandler(nil) } /// Responds with an error from an async void function. - let throwAsyncErrorFromVoidChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncErrorFromVoid", - binaryMessenger: binaryMessenger, codec: codec) + let throwAsyncErrorFromVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncErrorFromVoid", binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwAsyncErrorFromVoidChannel.setMessageHandler { _, reply in api.throwAsyncErrorFromVoid { result in @@ -1333,10 +1195,7 @@ class HostIntegrationCoreApiSetup { throwAsyncErrorFromVoidChannel.setMessageHandler(nil) } /// Responds with a Flutter error from an async function returning a value. - let throwAsyncFlutterErrorChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncFlutterError", - binaryMessenger: binaryMessenger, codec: codec) + let throwAsyncFlutterErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncFlutterError", binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwAsyncFlutterErrorChannel.setMessageHandler { _, reply in api.throwAsyncFlutterError { result in @@ -1352,9 +1211,7 @@ class HostIntegrationCoreApiSetup { throwAsyncFlutterErrorChannel.setMessageHandler(nil) } /// Returns the passed object, to test async serialization and deserialization. - let echoAsyncAllTypesChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncAllTypes", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncAllTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncAllTypes", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncAllTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1372,10 +1229,7 @@ class HostIntegrationCoreApiSetup { echoAsyncAllTypesChannel.setMessageHandler(nil) } /// Returns the passed object, to test serialization and deserialization. - let echoAsyncNullableAllNullableTypesChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableAllNullableTypes", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableAllNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableAllNullableTypes", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableAllNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1393,16 +1247,11 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableAllNullableTypesChannel.setMessageHandler(nil) } /// Returns passed in int asynchronously. - let echoAsyncNullableIntChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableInt", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableInt", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] - let anIntArg: Int64? = - isNullish(args[0]) - ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) + let anIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) api.echoAsyncNullable(anIntArg) { result in switch result { case .success(let res): @@ -1416,10 +1265,7 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableIntChannel.setMessageHandler(nil) } /// Returns passed in double asynchronously. - let echoAsyncNullableDoubleChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableDouble", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableDouble", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1437,10 +1283,7 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableDoubleChannel.setMessageHandler(nil) } /// Returns the passed in boolean asynchronously. - let echoAsyncNullableBoolChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableBool", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableBool", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1458,10 +1301,7 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableBoolChannel.setMessageHandler(nil) } /// Returns the passed string asynchronously. - let echoAsyncNullableStringChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableString", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableString", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1479,10 +1319,7 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableStringChannel.setMessageHandler(nil) } /// Returns the passed in Uint8List asynchronously. - let echoAsyncNullableUint8ListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableUint8List", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableUint8List", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1500,10 +1337,7 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableUint8ListChannel.setMessageHandler(nil) } /// Returns the passed in generic Object asynchronously. - let echoAsyncNullableObjectChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableObject", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableObject", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1521,10 +1355,7 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableObjectChannel.setMessageHandler(nil) } /// Returns the passed list, to test asynchronous serialization and deserialization. - let echoAsyncNullableListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableList", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableList", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1542,10 +1373,7 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableListChannel.setMessageHandler(nil) } /// Returns the passed map, to test asynchronous serialization and deserialization. - let echoAsyncNullableMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableMap", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableMap", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1563,10 +1391,7 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableMapChannel.setMessageHandler(nil) } /// Returns the passed enum, to test asynchronous serialization and deserialization. - let echoAsyncNullableEnumChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableEnum", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableEnum", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1583,9 +1408,7 @@ class HostIntegrationCoreApiSetup { } else { echoAsyncNullableEnumChannel.setMessageHandler(nil) } - let callFlutterNoopChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterNoop", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterNoopChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterNoop", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterNoopChannel.setMessageHandler { _, reply in api.callFlutterNoop { result in @@ -1600,10 +1423,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterNoopChannel.setMessageHandler(nil) } - let callFlutterThrowErrorChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowError", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterThrowErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowError", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterThrowErrorChannel.setMessageHandler { _, reply in api.callFlutterThrowError { result in @@ -1618,10 +1438,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterThrowErrorChannel.setMessageHandler(nil) } - let callFlutterThrowErrorFromVoidChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowErrorFromVoid", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterThrowErrorFromVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowErrorFromVoid", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterThrowErrorFromVoidChannel.setMessageHandler { _, reply in api.callFlutterThrowErrorFromVoid { result in @@ -1636,10 +1453,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterThrowErrorFromVoidChannel.setMessageHandler(nil) } - let callFlutterEchoAllTypesChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllTypes", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoAllTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllTypes", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoAllTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1656,10 +1470,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoAllTypesChannel.setMessageHandler(nil) } - let callFlutterEchoAllNullableTypesChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllNullableTypes", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoAllNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllNullableTypes", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoAllNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1676,21 +1487,14 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoAllNullableTypesChannel.setMessageHandler(nil) } - let callFlutterSendMultipleNullableTypesChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterSendMultipleNullableTypes", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterSendMultipleNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterSendMultipleNullableTypes", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterSendMultipleNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableBoolArg: Bool? = nilOrValue(args[0]) - let aNullableIntArg: Int64? = - isNullish(args[1]) - ? nil : (args[1] is Int64? ? args[1] as! Int64? : Int64(args[1] as! Int32)) + let aNullableIntArg: Int64? = isNullish(args[1]) ? nil : (args[1] is Int64? ? args[1] as! Int64? : Int64(args[1] as! Int32)) let aNullableStringArg: String? = nilOrValue(args[2]) - api.callFlutterSendMultipleNullableTypes( - aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg - ) { result in + api.callFlutterSendMultipleNullableTypes(aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg) { result in switch result { case .success(let res): reply(wrapResult(res)) @@ -1702,10 +1506,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterSendMultipleNullableTypesChannel.setMessageHandler(nil) } - let callFlutterEchoBoolChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoBool", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoBool", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1722,9 +1523,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoBoolChannel.setMessageHandler(nil) } - let callFlutterEchoIntChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoInt", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoInt", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1741,10 +1540,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoIntChannel.setMessageHandler(nil) } - let callFlutterEchoDoubleChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoDouble", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoDouble", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1761,10 +1557,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoDoubleChannel.setMessageHandler(nil) } - let callFlutterEchoStringChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoString", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoString", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1781,10 +1574,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoStringChannel.setMessageHandler(nil) } - let callFlutterEchoUint8ListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoUint8List", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoUint8List", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1801,10 +1591,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoUint8ListChannel.setMessageHandler(nil) } - let callFlutterEchoListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoList", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoList", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1821,9 +1608,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoListChannel.setMessageHandler(nil) } - let callFlutterEchoMapChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoMap", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoMap", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1840,10 +1625,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoMapChannel.setMessageHandler(nil) } - let callFlutterEchoEnumChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoEnum", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoEnum", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1860,10 +1642,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoEnumChannel.setMessageHandler(nil) } - let callFlutterEchoNullableBoolChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableBool", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableBool", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1880,16 +1659,11 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoNullableBoolChannel.setMessageHandler(nil) } - let callFlutterEchoNullableIntChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableInt", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableInt", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] - let anIntArg: Int64? = - isNullish(args[0]) - ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) + let anIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) api.callFlutterEchoNullable(anIntArg) { result in switch result { case .success(let res): @@ -1902,10 +1676,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoNullableIntChannel.setMessageHandler(nil) } - let callFlutterEchoNullableDoubleChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableDouble", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableDouble", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1922,10 +1693,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoNullableDoubleChannel.setMessageHandler(nil) } - let callFlutterEchoNullableStringChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableString", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableString", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1942,10 +1710,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoNullableStringChannel.setMessageHandler(nil) } - let callFlutterEchoNullableUint8ListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableUint8List", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableUint8List", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1962,10 +1727,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoNullableUint8ListChannel.setMessageHandler(nil) } - let callFlutterEchoNullableListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableList", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableList", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1982,10 +1744,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoNullableListChannel.setMessageHandler(nil) } - let callFlutterEchoNullableMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableMap", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableMap", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2002,10 +1761,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoNullableMapChannel.setMessageHandler(nil) } - let callFlutterEchoNullableEnumChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableEnum", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableEnum", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2072,8 +1828,7 @@ private class FlutterIntegrationCoreApiCodecReaderWriter: FlutterStandardReaderW } class FlutterIntegrationCoreApiCodec: FlutterStandardMessageCodec { - static let shared = FlutterIntegrationCoreApiCodec( - readerWriter: FlutterIntegrationCoreApiCodecReaderWriter()) + static let shared = FlutterIntegrationCoreApiCodec(readerWriter: FlutterIntegrationCoreApiCodecReaderWriter()) } /// The core interface that the Dart platform_test code implements for host @@ -2089,19 +1844,13 @@ protocol FlutterIntegrationCoreApiProtocol { /// Responds with an error from an async void function. func throwErrorFromVoid(completion: @escaping (Result) -> Void) /// Returns the passed object, to test serialization and deserialization. - func echo( - _ everythingArg: AllTypes, completion: @escaping (Result) -> Void) + func echo(_ everythingArg: AllTypes, completion: @escaping (Result) -> Void) /// Returns the passed object, to test serialization and deserialization. - func echoNullable( - _ everythingArg: AllNullableTypes?, - completion: @escaping (Result) -> Void) + func echoNullable(_ everythingArg: AllNullableTypes?, completion: @escaping (Result) -> Void) /// Returns passed in arguments of multiple types. /// /// Tests multiple-arity FlutterApi handling. - func sendMultipleNullableTypes( - aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int64?, - aString aNullableStringArg: String?, - completion: @escaping (Result) -> Void) + func sendMultipleNullableTypes(aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int64?, aString aNullableStringArg: String?, completion: @escaping (Result) -> Void) /// Returns the passed boolean, to test serialization and deserialization. func echo(_ aBoolArg: Bool, completion: @escaping (Result) -> Void) /// Returns the passed int, to test serialization and deserialization. @@ -2111,42 +1860,29 @@ protocol FlutterIntegrationCoreApiProtocol { /// Returns the passed string, to test serialization and deserialization. func echo(_ aStringArg: String, completion: @escaping (Result) -> Void) /// Returns the passed byte list, to test serialization and deserialization. - func echo( - _ aListArg: FlutterStandardTypedData, - completion: @escaping (Result) -> Void) + func echo(_ aListArg: FlutterStandardTypedData, completion: @escaping (Result) -> Void) /// Returns the passed list, to test serialization and deserialization. func echo(_ aListArg: [Any?], completion: @escaping (Result<[Any?], FlutterError>) -> Void) /// Returns the passed map, to test serialization and deserialization. - func echo( - _ aMapArg: [String?: Any?], - completion: @escaping (Result<[String?: Any?], FlutterError>) -> Void) + func echo(_ aMapArg: [String?: Any?], completion: @escaping (Result<[String?: Any?], FlutterError>) -> Void) /// Returns the passed enum to test serialization and deserialization. func echo(_ anEnumArg: AnEnum, 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. - func echoNullable( - _ anIntArg: Int64?, completion: @escaping (Result) -> Void) + func echoNullable(_ anIntArg: Int64?, completion: @escaping (Result) -> Void) /// Returns the passed double, to test serialization and deserialization. - func echoNullable( - _ aDoubleArg: Double?, completion: @escaping (Result) -> Void) + func echoNullable(_ aDoubleArg: Double?, completion: @escaping (Result) -> Void) /// Returns the passed string, to test serialization and deserialization. - func echoNullable( - _ aStringArg: String?, completion: @escaping (Result) -> Void) + func echoNullable(_ aStringArg: String?, completion: @escaping (Result) -> Void) /// Returns the passed byte list, to test serialization and deserialization. - func echoNullable( - _ aListArg: FlutterStandardTypedData?, - completion: @escaping (Result) -> Void) + func echoNullable(_ aListArg: FlutterStandardTypedData?, completion: @escaping (Result) -> Void) /// Returns the passed list, to test serialization and deserialization. - func echoNullable( - _ aListArg: [Any?]?, completion: @escaping (Result<[Any?]?, FlutterError>) -> Void) + func echoNullable(_ aListArg: [Any?]?, completion: @escaping (Result<[Any?]?, FlutterError>) -> Void) /// Returns the passed map, to test serialization and deserialization. - func echoNullable( - _ aMapArg: [String?: Any?]?, - completion: @escaping (Result<[String?: Any?]?, FlutterError>) -> Void) + func echoNullable(_ aMapArg: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, FlutterError>) -> Void) /// Returns the passed enum to test serialization and deserialization. - func echoNullable( - _ anEnumArg: AnEnum?, completion: @escaping (Result) -> Void) + func echoNullable(_ anEnumArg: AnEnum?, 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) @@ -2164,10 +1900,8 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { /// A no-op function taking no arguments and returning no value, to sanity /// test basic calling. func noop(completion: @escaping (Result) -> Void) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noop" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noop" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2185,10 +1919,8 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Responds with an error from an async function returning a value. func throwError(completion: @escaping (Result) -> Void) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwError" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwError" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2207,10 +1939,8 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Responds with an error from an async void function. func throwErrorFromVoid(completion: @escaping (Result) -> Void) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwErrorFromVoid" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwErrorFromVoid" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2227,13 +1957,9 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed object, to test serialization and deserialization. - func echo( - _ everythingArg: AllTypes, completion: @escaping (Result) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllTypes" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echo(_ everythingArg: AllTypes, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllTypes" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([everythingArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2245,11 +1971,7 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - FlutterError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! AllTypes completion(.success(result)) @@ -2257,14 +1979,9 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed object, to test serialization and deserialization. - func echoNullable( - _ everythingArg: AllNullableTypes?, - completion: @escaping (Result) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllNullableTypes" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable(_ everythingArg: AllNullableTypes?, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllNullableTypes" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([everythingArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2284,17 +2001,10 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { /// Returns passed in arguments of multiple types. /// /// Tests multiple-arity FlutterApi handling. - func sendMultipleNullableTypes( - aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int64?, - aString aNullableStringArg: String?, - completion: @escaping (Result) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.sendMultipleNullableTypes" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([aNullableBoolArg, aNullableIntArg, aNullableStringArg] as [Any?]) { - response in + func sendMultipleNullableTypes(aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int64?, aString aNullableStringArg: String?, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.sendMultipleNullableTypes" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([aNullableBoolArg, aNullableIntArg, aNullableStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -2305,11 +2015,7 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - FlutterError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! AllNullableTypes completion(.success(result)) @@ -2318,10 +2024,8 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed boolean, to test serialization and deserialization. func echo(_ aBoolArg: Bool, completion: @escaping (Result) -> Void) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoBool" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoBool" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aBoolArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2333,11 +2037,7 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - FlutterError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! Bool completion(.success(result)) @@ -2346,10 +2046,8 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed int, to test serialization and deserialization. func echo(_ anIntArg: Int64, completion: @escaping (Result) -> Void) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoInt" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoInt" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anIntArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2361,24 +2059,17 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - FlutterError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { - let result = - listResponse[0] is Int64 ? listResponse[0] as! Int64 : Int64(listResponse[0] as! Int32) + let result = listResponse[0] is Int64 ? listResponse[0] as! Int64 : Int64(listResponse[0] as! Int32) completion(.success(result)) } } } /// Returns the passed double, to test serialization and deserialization. func echo(_ aDoubleArg: Double, completion: @escaping (Result) -> Void) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoDouble" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoDouble" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aDoubleArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2390,11 +2081,7 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - FlutterError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! Double completion(.success(result)) @@ -2403,10 +2090,8 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed string, to test serialization and deserialization. func echo(_ aStringArg: String, completion: @escaping (Result) -> Void) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoString" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoString" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2418,11 +2103,7 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - FlutterError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! String completion(.success(result)) @@ -2430,14 +2111,9 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed byte list, to test serialization and deserialization. - func echo( - _ aListArg: FlutterStandardTypedData, - completion: @escaping (Result) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoUint8List" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echo(_ aListArg: FlutterStandardTypedData, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoUint8List" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2449,11 +2125,7 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - FlutterError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! FlutterStandardTypedData completion(.success(result)) @@ -2462,10 +2134,8 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed list, to test serialization and deserialization. func echo(_ aListArg: [Any?], completion: @escaping (Result<[Any?], FlutterError>) -> Void) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoList" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoList" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2477,11 +2147,7 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - FlutterError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! [Any?] completion(.success(result)) @@ -2489,14 +2155,9 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed map, to test serialization and deserialization. - func echo( - _ aMapArg: [String?: Any?], - completion: @escaping (Result<[String?: Any?], FlutterError>) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoMap" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echo(_ aMapArg: [String?: Any?], completion: @escaping (Result<[String?: Any?], FlutterError>) -> Void) { + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoMap" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aMapArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2508,11 +2169,7 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - FlutterError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! [String?: Any?] completion(.success(result)) @@ -2521,10 +2178,8 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed enum to test serialization and deserialization. func echo(_ anEnumArg: AnEnum, completion: @escaping (Result) -> Void) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoEnum" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoEnum" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anEnumArg.rawValue] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2536,11 +2191,7 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - FlutterError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = AnEnum(rawValue: listResponse[0] as! Int)! completion(.success(result)) @@ -2548,12 +2199,9 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed boolean, to test serialization and deserialization. - func echoNullable(_ aBoolArg: Bool?, completion: @escaping (Result) -> Void) - { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableBool" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable(_ aBoolArg: Bool?, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableBool" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aBoolArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2571,13 +2219,9 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed int, to test serialization and deserialization. - func echoNullable( - _ anIntArg: Int64?, completion: @escaping (Result) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableInt" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable(_ anIntArg: Int64?, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableInt" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anIntArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2589,23 +2233,15 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else { - let result: Int64? = - isNullish(listResponse[0]) - ? nil - : (listResponse[0] is Int64? - ? listResponse[0] as! Int64? : Int64(listResponse[0] as! Int32)) + let result: Int64? = isNullish(listResponse[0]) ? nil : (listResponse[0] is Int64? ? listResponse[0] as! Int64? : Int64(listResponse[0] as! Int32)) completion(.success(result)) } } } /// Returns the passed double, to test serialization and deserialization. - func echoNullable( - _ aDoubleArg: Double?, completion: @escaping (Result) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableDouble" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable(_ aDoubleArg: Double?, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableDouble" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aDoubleArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2623,13 +2259,9 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed string, to test serialization and deserialization. - func echoNullable( - _ aStringArg: String?, completion: @escaping (Result) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableString" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable(_ aStringArg: String?, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableString" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2647,14 +2279,9 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed byte list, to test serialization and deserialization. - func echoNullable( - _ aListArg: FlutterStandardTypedData?, - completion: @escaping (Result) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableUint8List" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable(_ aListArg: FlutterStandardTypedData?, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableUint8List" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2672,13 +2299,9 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed list, to test serialization and deserialization. - func echoNullable( - _ aListArg: [Any?]?, completion: @escaping (Result<[Any?]?, FlutterError>) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableList" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable(_ aListArg: [Any?]?, completion: @escaping (Result<[Any?]?, FlutterError>) -> Void) { + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableList" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2696,14 +2319,9 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed map, to test serialization and deserialization. - func echoNullable( - _ aMapArg: [String?: Any?]?, - completion: @escaping (Result<[String?: Any?]?, FlutterError>) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableMap" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable(_ aMapArg: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, FlutterError>) -> Void) { + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableMap" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aMapArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2721,13 +2339,9 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed enum to test serialization and deserialization. - func echoNullable( - _ anEnumArg: AnEnum?, completion: @escaping (Result) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableEnum" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable(_ anEnumArg: AnEnum?, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableEnum" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anEnumArg?.rawValue] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2739,8 +2353,7 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else { - let result: AnEnum? = - isNullish(listResponse[0]) ? nil : AnEnum(rawValue: listResponse[0] as! Int)! + let result: AnEnum? = isNullish(listResponse[0]) ? nil : AnEnum(rawValue: listResponse[0] as! Int)! completion(.success(result)) } } @@ -2748,10 +2361,8 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. func noopAsync(completion: @escaping (Result) -> Void) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noopAsync" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noopAsync" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2768,12 +2379,9 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed in generic Object asynchronously. - func echoAsync(_ aStringArg: String, completion: @escaping (Result) -> Void) - { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAsyncString" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoAsync(_ aStringArg: String, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAsyncString" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2785,11 +2393,7 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - FlutterError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! String completion(.success(result)) @@ -2809,9 +2413,7 @@ class HostTrivialApiSetup { /// The codec used by HostTrivialApi. /// Sets up an instance of `HostTrivialApi` to handle messages through the `binaryMessenger`. static func setUp(binaryMessenger: FlutterBinaryMessenger, api: HostTrivialApi?) { - let noopChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostTrivialApi.noop", - binaryMessenger: binaryMessenger) + let noopChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostTrivialApi.noop", binaryMessenger: binaryMessenger) if let api = api { noopChannel.setMessageHandler { _, reply in do { @@ -2839,9 +2441,7 @@ class HostSmallApiSetup { /// The codec used by HostSmallApi. /// Sets up an instance of `HostSmallApi` to handle messages through the `binaryMessenger`. static func setUp(binaryMessenger: FlutterBinaryMessenger, api: HostSmallApi?) { - let echoChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.echo", - binaryMessenger: binaryMessenger) + let echoChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.echo", binaryMessenger: binaryMessenger) if let api = api { echoChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2858,9 +2458,7 @@ class HostSmallApiSetup { } else { echoChannel.setMessageHandler(nil) } - let voidVoidChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.voidVoid", - binaryMessenger: binaryMessenger) + let voidVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.voidVoid", binaryMessenger: binaryMessenger) if let api = api { voidVoidChannel.setMessageHandler { _, reply in api.voidVoid { result in @@ -2917,8 +2515,7 @@ class FlutterSmallApiCodec: FlutterStandardMessageCodec { /// /// Generated protocol from Pigeon that represents Flutter messages that can be called from Swift. protocol FlutterSmallApiProtocol { - func echo( - _ msgArg: TestMessage, completion: @escaping (Result) -> Void) + func echo(_ msgArg: TestMessage, completion: @escaping (Result) -> Void) func echo(_ aStringArg: String, completion: @escaping (Result) -> Void) } class FlutterSmallApi: FlutterSmallApiProtocol { @@ -2929,13 +2526,9 @@ class FlutterSmallApi: FlutterSmallApiProtocol { var codec: FlutterStandardMessageCodec { return FlutterSmallApiCodec.shared } - func echo( - _ msgArg: TestMessage, completion: @escaping (Result) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoWrappedList" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echo(_ msgArg: TestMessage, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoWrappedList" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([msgArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2947,11 +2540,7 @@ class FlutterSmallApi: FlutterSmallApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - FlutterError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! TestMessage completion(.success(result)) @@ -2959,10 +2548,8 @@ class FlutterSmallApi: FlutterSmallApiProtocol { } } func echo(_ aStringArg: String, completion: @escaping (Result) -> Void) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoString" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoString" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2974,11 +2561,7 @@ class FlutterSmallApi: FlutterSmallApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - FlutterError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! String completion(.success(result)) 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 14bcb9a4113..4dd101c0ccc 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 @@ -35,9 +35,7 @@ private func wrapError(_ error: Any) -> [Any?] { } private func createConnectionError(withChannelName channelName: String) -> FlutterError { - return FlutterError( - code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", - details: "") + return FlutterError(code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", details: "") } private func isNullish(_ value: Any?) -> Bool { @@ -146,10 +144,8 @@ struct AllNullableTypes { static func fromList(_ list: [Any?]) -> AllNullableTypes? { let aNullableBool: Bool? = nilOrValue(list[0]) - let aNullableInt: Int64? = - isNullish(list[1]) ? nil : (list[1] is Int64? ? list[1] as! Int64? : Int64(list[1] as! Int32)) - let aNullableInt64: Int64? = - isNullish(list[2]) ? nil : (list[2] is Int64? ? list[2] as! Int64? : Int64(list[2] as! Int32)) + let aNullableInt: Int64? = isNullish(list[1]) ? nil : (list[1] is Int64? ? list[1] as! Int64? : Int64(list[1] as! Int32)) + let aNullableInt64: Int64? = isNullish(list[2]) ? nil : (list[2] is Int64? ? list[2] as! Int64? : Int64(list[2] as! Int32)) let aNullableDouble: Double? = nilOrValue(list[3]) let aNullableByteArray: FlutterStandardTypedData? = nilOrValue(list[4]) let aNullable4ByteArray: FlutterStandardTypedData? = nilOrValue(list[5]) @@ -308,8 +304,7 @@ private class HostIntegrationCoreApiCodecReaderWriter: FlutterStandardReaderWrit } class HostIntegrationCoreApiCodec: FlutterStandardMessageCodec { - static let shared = HostIntegrationCoreApiCodec( - readerWriter: HostIntegrationCoreApiCodecReaderWriter()) + static let shared = HostIntegrationCoreApiCodec(readerWriter: HostIntegrationCoreApiCodecReaderWriter()) } /// The core interface that each host language plugin must implement in @@ -363,9 +358,7 @@ protocol HostIntegrationCoreApi { /// sending of nested objects. func createNestedObject(with nullableString: String?) throws -> AllClassesWrapper /// Returns passed in arguments of multiple types. - func sendMultipleNullableTypes( - aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String? - ) throws -> AllNullableTypes + func sendMultipleNullableTypes(aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String?) throws -> AllNullableTypes /// Returns passed in int. func echo(_ aNullableInt: Int64?) throws -> Int64? /// Returns passed in double. @@ -399,16 +392,13 @@ protocol HostIntegrationCoreApi { /// Returns the passed string asynchronously. func echoAsync(_ aString: String, completion: @escaping (Result) -> Void) /// Returns the passed in Uint8List asynchronously. - func echoAsync( - _ aUint8List: FlutterStandardTypedData, - completion: @escaping (Result) -> Void) + func echoAsync(_ aUint8List: FlutterStandardTypedData, completion: @escaping (Result) -> Void) /// Returns the passed in generic Object asynchronously. func echoAsync(_ anObject: Any, completion: @escaping (Result) -> Void) /// Returns the passed list, to test asynchronous serialization and deserialization. func echoAsync(_ aList: [Any?], completion: @escaping (Result<[Any?], Error>) -> Void) /// Returns the passed map, to test asynchronous serialization and deserialization. - func echoAsync( - _ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) + func echoAsync(_ 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) /// Responds with an error from an async function returning a value. @@ -420,9 +410,7 @@ protocol HostIntegrationCoreApi { /// Returns the passed object, to test async serialization and deserialization. func echoAsync(_ everything: AllTypes, completion: @escaping (Result) -> Void) /// Returns the passed object, to test serialization and deserialization. - func echoAsync( - _ everything: AllNullableTypes?, - completion: @escaping (Result) -> Void) + func echoAsync(_ everything: AllNullableTypes?, completion: @escaping (Result) -> Void) /// Returns passed in int asynchronously. func echoAsyncNullable(_ anInt: Int64?, completion: @escaping (Result) -> Void) /// Returns passed in double asynchronously. @@ -432,56 +420,37 @@ protocol HostIntegrationCoreApi { /// Returns the passed string asynchronously. func echoAsyncNullable(_ aString: String?, completion: @escaping (Result) -> Void) /// Returns the passed in Uint8List asynchronously. - func echoAsyncNullable( - _ aUint8List: FlutterStandardTypedData?, - completion: @escaping (Result) -> Void) + func echoAsyncNullable(_ aUint8List: FlutterStandardTypedData?, completion: @escaping (Result) -> Void) /// Returns the passed in generic Object asynchronously. func echoAsyncNullable(_ anObject: Any?, completion: @escaping (Result) -> Void) /// Returns the passed list, to test asynchronous serialization and deserialization. func echoAsyncNullable(_ aList: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void) /// Returns the passed map, to test asynchronous serialization and deserialization. - func echoAsyncNullable( - _ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) + func echoAsyncNullable(_ 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) func callFlutterNoop(completion: @escaping (Result) -> Void) func callFlutterThrowError(completion: @escaping (Result) -> Void) func callFlutterThrowErrorFromVoid(completion: @escaping (Result) -> Void) - func callFlutterEcho( - _ everything: AllTypes, completion: @escaping (Result) -> Void) - func callFlutterEcho( - _ everything: AllNullableTypes?, - completion: @escaping (Result) -> Void) - func callFlutterSendMultipleNullableTypes( - aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String?, - completion: @escaping (Result) -> Void) + func callFlutterEcho(_ everything: AllTypes, completion: @escaping (Result) -> Void) + func callFlutterEcho(_ everything: AllNullableTypes?, completion: @escaping (Result) -> Void) + func callFlutterSendMultipleNullableTypes(aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String?, completion: @escaping (Result) -> Void) func callFlutterEcho(_ aBool: Bool, completion: @escaping (Result) -> Void) func callFlutterEcho(_ anInt: Int64, completion: @escaping (Result) -> Void) func callFlutterEcho(_ aDouble: Double, completion: @escaping (Result) -> Void) func callFlutterEcho(_ aString: String, completion: @escaping (Result) -> Void) - func callFlutterEcho( - _ aList: FlutterStandardTypedData, - completion: @escaping (Result) -> Void) + func callFlutterEcho(_ aList: FlutterStandardTypedData, completion: @escaping (Result) -> Void) func callFlutterEcho(_ aList: [Any?], completion: @escaping (Result<[Any?], Error>) -> Void) - func callFlutterEcho( - _ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) + func callFlutterEcho(_ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) func callFlutterEcho(_ anEnum: AnEnum, completion: @escaping (Result) -> Void) func callFlutterEchoNullable(_ aBool: Bool?, completion: @escaping (Result) -> Void) - func callFlutterEchoNullable( - _ anInt: Int64?, completion: @escaping (Result) -> Void) - func callFlutterEchoNullable( - _ aDouble: Double?, completion: @escaping (Result) -> Void) - func callFlutterEchoNullable( - _ aString: String?, completion: @escaping (Result) -> Void) - func callFlutterEchoNullable( - _ aList: FlutterStandardTypedData?, - completion: @escaping (Result) -> Void) - func callFlutterEchoNullable( - _ aList: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void) - func callFlutterEchoNullable( - _ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) - func callFlutterNullableEcho( - _ anEnum: AnEnum?, completion: @escaping (Result) -> Void) + func callFlutterEchoNullable(_ anInt: Int64?, completion: @escaping (Result) -> Void) + func callFlutterEchoNullable(_ aDouble: Double?, completion: @escaping (Result) -> Void) + func callFlutterEchoNullable(_ aString: String?, completion: @escaping (Result) -> Void) + func callFlutterEchoNullable(_ aList: FlutterStandardTypedData?, completion: @escaping (Result) -> Void) + func callFlutterEchoNullable(_ aList: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void) + func callFlutterEchoNullable(_ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) + func callFlutterNullableEcho(_ anEnum: AnEnum?, completion: @escaping (Result) -> Void) } /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. @@ -492,9 +461,7 @@ class HostIntegrationCoreApiSetup { static func setUp(binaryMessenger: FlutterBinaryMessenger, api: HostIntegrationCoreApi?) { /// A no-op function taking no arguments and returning no value, to sanity /// test basic calling. - let noopChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noop", - binaryMessenger: binaryMessenger, codec: codec) + let noopChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noop", binaryMessenger: binaryMessenger, codec: codec) if let api = api { noopChannel.setMessageHandler { _, reply in do { @@ -508,9 +475,7 @@ class HostIntegrationCoreApiSetup { noopChannel.setMessageHandler(nil) } /// Returns the passed object, to test serialization and deserialization. - let echoAllTypesChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllTypes", - binaryMessenger: binaryMessenger, codec: codec) + let echoAllTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllTypes", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAllTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -526,9 +491,7 @@ class HostIntegrationCoreApiSetup { echoAllTypesChannel.setMessageHandler(nil) } /// Returns an error, to test error handling. - let throwErrorChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwError", - binaryMessenger: binaryMessenger, codec: codec) + let throwErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwError", binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwErrorChannel.setMessageHandler { _, reply in do { @@ -542,9 +505,7 @@ class HostIntegrationCoreApiSetup { throwErrorChannel.setMessageHandler(nil) } /// Returns an error from a void function, to test error handling. - let throwErrorFromVoidChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwErrorFromVoid", - binaryMessenger: binaryMessenger, codec: codec) + let throwErrorFromVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwErrorFromVoid", binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwErrorFromVoidChannel.setMessageHandler { _, reply in do { @@ -558,9 +519,7 @@ class HostIntegrationCoreApiSetup { throwErrorFromVoidChannel.setMessageHandler(nil) } /// Returns a Flutter error, to test error handling. - let throwFlutterErrorChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwFlutterError", - binaryMessenger: binaryMessenger, codec: codec) + let throwFlutterErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwFlutterError", binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwFlutterErrorChannel.setMessageHandler { _, reply in do { @@ -574,9 +533,7 @@ class HostIntegrationCoreApiSetup { throwFlutterErrorChannel.setMessageHandler(nil) } /// Returns passed in int. - let echoIntChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoInt", - binaryMessenger: binaryMessenger, codec: codec) + let echoIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoInt", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -592,9 +549,7 @@ class HostIntegrationCoreApiSetup { echoIntChannel.setMessageHandler(nil) } /// Returns passed in double. - let echoDoubleChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoDouble", - binaryMessenger: binaryMessenger, codec: codec) + let echoDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoDouble", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -610,9 +565,7 @@ class HostIntegrationCoreApiSetup { echoDoubleChannel.setMessageHandler(nil) } /// Returns the passed in boolean. - let echoBoolChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoBool", - binaryMessenger: binaryMessenger, codec: codec) + let echoBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoBool", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -628,9 +581,7 @@ class HostIntegrationCoreApiSetup { echoBoolChannel.setMessageHandler(nil) } /// Returns the passed in string. - let echoStringChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoString", - binaryMessenger: binaryMessenger, codec: codec) + let echoStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoString", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -646,9 +597,7 @@ class HostIntegrationCoreApiSetup { echoStringChannel.setMessageHandler(nil) } /// Returns the passed in Uint8List. - let echoUint8ListChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoUint8List", - binaryMessenger: binaryMessenger, codec: codec) + let echoUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoUint8List", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -664,9 +613,7 @@ class HostIntegrationCoreApiSetup { echoUint8ListChannel.setMessageHandler(nil) } /// Returns the passed in generic Object. - let echoObjectChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoObject", - binaryMessenger: binaryMessenger, codec: codec) + let echoObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoObject", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -682,9 +629,7 @@ class HostIntegrationCoreApiSetup { echoObjectChannel.setMessageHandler(nil) } /// Returns the passed list, to test serialization and deserialization. - let echoListChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoList", - binaryMessenger: binaryMessenger, codec: codec) + let echoListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoList", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -700,9 +645,7 @@ class HostIntegrationCoreApiSetup { echoListChannel.setMessageHandler(nil) } /// Returns the passed map, to test serialization and deserialization. - let echoMapChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoMap", - binaryMessenger: binaryMessenger, codec: codec) + let echoMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoMap", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -718,9 +661,7 @@ class HostIntegrationCoreApiSetup { echoMapChannel.setMessageHandler(nil) } /// Returns the passed map to test nested class serialization and deserialization. - let echoClassWrapperChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoClassWrapper", - binaryMessenger: binaryMessenger, codec: codec) + let echoClassWrapperChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoClassWrapper", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoClassWrapperChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -736,9 +677,7 @@ class HostIntegrationCoreApiSetup { echoClassWrapperChannel.setMessageHandler(nil) } /// Returns the passed enum to test serialization and deserialization. - let echoEnumChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoEnum", - binaryMessenger: binaryMessenger, codec: codec) + let echoEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoEnum", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -754,10 +693,7 @@ class HostIntegrationCoreApiSetup { echoEnumChannel.setMessageHandler(nil) } /// Returns the default string. - let echoNamedDefaultStringChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedDefaultString", - binaryMessenger: binaryMessenger, codec: codec) + let echoNamedDefaultStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedDefaultString", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNamedDefaultStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -773,10 +709,7 @@ class HostIntegrationCoreApiSetup { echoNamedDefaultStringChannel.setMessageHandler(nil) } /// Returns passed in double. - let echoOptionalDefaultDoubleChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalDefaultDouble", - binaryMessenger: binaryMessenger, codec: codec) + let echoOptionalDefaultDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalDefaultDouble", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoOptionalDefaultDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -792,9 +725,7 @@ class HostIntegrationCoreApiSetup { echoOptionalDefaultDoubleChannel.setMessageHandler(nil) } /// Returns passed in int. - let echoRequiredIntChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoRequiredInt", - binaryMessenger: binaryMessenger, codec: codec) + let echoRequiredIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoRequiredInt", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoRequiredIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -810,10 +741,7 @@ class HostIntegrationCoreApiSetup { echoRequiredIntChannel.setMessageHandler(nil) } /// Returns the passed object, to test serialization and deserialization. - let echoAllNullableTypesChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllNullableTypes", - binaryMessenger: binaryMessenger, codec: codec) + let echoAllNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllNullableTypes", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAllNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -830,10 +758,7 @@ class HostIntegrationCoreApiSetup { } /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. - let extractNestedNullableStringChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.extractNestedNullableString", - binaryMessenger: binaryMessenger, codec: codec) + let extractNestedNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.extractNestedNullableString", binaryMessenger: binaryMessenger, codec: codec) if let api = api { extractNestedNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -850,10 +775,7 @@ class HostIntegrationCoreApiSetup { } /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. - let createNestedNullableStringChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.createNestedNullableString", - binaryMessenger: binaryMessenger, codec: codec) + let createNestedNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.createNestedNullableString", binaryMessenger: binaryMessenger, codec: codec) if let api = api { createNestedNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -869,21 +791,15 @@ class HostIntegrationCoreApiSetup { createNestedNullableStringChannel.setMessageHandler(nil) } /// Returns passed in arguments of multiple types. - let sendMultipleNullableTypesChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.sendMultipleNullableTypes", - binaryMessenger: binaryMessenger, codec: codec) + let sendMultipleNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.sendMultipleNullableTypes", binaryMessenger: binaryMessenger, codec: codec) if let api = api { sendMultipleNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableBoolArg: Bool? = nilOrValue(args[0]) - let aNullableIntArg: Int64? = - isNullish(args[1]) - ? nil : (args[1] is Int64? ? args[1] as! Int64? : Int64(args[1] as! Int32)) + let aNullableIntArg: Int64? = isNullish(args[1]) ? nil : (args[1] is Int64? ? args[1] as! Int64? : Int64(args[1] as! Int32)) let aNullableStringArg: String? = nilOrValue(args[2]) do { - let result = try api.sendMultipleNullableTypes( - aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg) + let result = try api.sendMultipleNullableTypes(aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -893,15 +809,11 @@ class HostIntegrationCoreApiSetup { sendMultipleNullableTypesChannel.setMessageHandler(nil) } /// Returns passed in int. - let echoNullableIntChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableInt", - binaryMessenger: binaryMessenger, codec: codec) + let echoNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableInt", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] - let aNullableIntArg: Int64? = - isNullish(args[0]) - ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) + let aNullableIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) do { let result = try api.echo(aNullableIntArg) reply(wrapResult(result)) @@ -913,9 +825,7 @@ class HostIntegrationCoreApiSetup { echoNullableIntChannel.setMessageHandler(nil) } /// Returns passed in double. - let echoNullableDoubleChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableDouble", - binaryMessenger: binaryMessenger, codec: codec) + let echoNullableDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableDouble", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -931,9 +841,7 @@ class HostIntegrationCoreApiSetup { echoNullableDoubleChannel.setMessageHandler(nil) } /// Returns the passed in boolean. - let echoNullableBoolChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableBool", - binaryMessenger: binaryMessenger, codec: codec) + let echoNullableBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableBool", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -949,9 +857,7 @@ class HostIntegrationCoreApiSetup { echoNullableBoolChannel.setMessageHandler(nil) } /// Returns the passed in string. - let echoNullableStringChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableString", - binaryMessenger: binaryMessenger, codec: codec) + let echoNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableString", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -967,10 +873,7 @@ class HostIntegrationCoreApiSetup { echoNullableStringChannel.setMessageHandler(nil) } /// Returns the passed in Uint8List. - let echoNullableUint8ListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableUint8List", - binaryMessenger: binaryMessenger, codec: codec) + let echoNullableUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableUint8List", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -986,9 +889,7 @@ class HostIntegrationCoreApiSetup { echoNullableUint8ListChannel.setMessageHandler(nil) } /// Returns the passed in generic Object. - let echoNullableObjectChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableObject", - binaryMessenger: binaryMessenger, codec: codec) + let echoNullableObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableObject", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1004,9 +905,7 @@ class HostIntegrationCoreApiSetup { echoNullableObjectChannel.setMessageHandler(nil) } /// Returns the passed list, to test serialization and deserialization. - let echoNullableListChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableList", - binaryMessenger: binaryMessenger, codec: codec) + let echoNullableListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableList", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1022,9 +921,7 @@ class HostIntegrationCoreApiSetup { echoNullableListChannel.setMessageHandler(nil) } /// Returns the passed map, to test serialization and deserialization. - let echoNullableMapChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableMap", - binaryMessenger: binaryMessenger, codec: codec) + let echoNullableMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableMap", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1039,9 +936,7 @@ class HostIntegrationCoreApiSetup { } else { echoNullableMapChannel.setMessageHandler(nil) } - let echoNullableEnumChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableEnum", - binaryMessenger: binaryMessenger, codec: codec) + let echoNullableEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableEnum", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1057,16 +952,11 @@ class HostIntegrationCoreApiSetup { echoNullableEnumChannel.setMessageHandler(nil) } /// Returns passed in int. - let echoOptionalNullableIntChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalNullableInt", - binaryMessenger: binaryMessenger, codec: codec) + let echoOptionalNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalNullableInt", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoOptionalNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] - let aNullableIntArg: Int64? = - isNullish(args[0]) - ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) + let aNullableIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) do { let result = try api.echoOptional(aNullableIntArg) reply(wrapResult(result)) @@ -1078,10 +968,7 @@ class HostIntegrationCoreApiSetup { echoOptionalNullableIntChannel.setMessageHandler(nil) } /// Returns the passed in string. - let echoNamedNullableStringChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedNullableString", - binaryMessenger: binaryMessenger, codec: codec) + let echoNamedNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedNullableString", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNamedNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1098,9 +985,7 @@ class HostIntegrationCoreApiSetup { } /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. - let noopAsyncChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noopAsync", - binaryMessenger: binaryMessenger, codec: codec) + let noopAsyncChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noopAsync", binaryMessenger: binaryMessenger, codec: codec) if let api = api { noopAsyncChannel.setMessageHandler { _, reply in api.noopAsync { result in @@ -1116,9 +1001,7 @@ class HostIntegrationCoreApiSetup { noopAsyncChannel.setMessageHandler(nil) } /// Returns passed in int asynchronously. - let echoAsyncIntChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncInt", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncInt", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1136,9 +1019,7 @@ class HostIntegrationCoreApiSetup { echoAsyncIntChannel.setMessageHandler(nil) } /// Returns passed in double asynchronously. - let echoAsyncDoubleChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncDouble", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncDouble", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1156,9 +1037,7 @@ class HostIntegrationCoreApiSetup { echoAsyncDoubleChannel.setMessageHandler(nil) } /// Returns the passed in boolean asynchronously. - let echoAsyncBoolChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncBool", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncBool", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1176,9 +1055,7 @@ class HostIntegrationCoreApiSetup { echoAsyncBoolChannel.setMessageHandler(nil) } /// Returns the passed string asynchronously. - let echoAsyncStringChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncString", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncString", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1196,9 +1073,7 @@ class HostIntegrationCoreApiSetup { echoAsyncStringChannel.setMessageHandler(nil) } /// Returns the passed in Uint8List asynchronously. - let echoAsyncUint8ListChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncUint8List", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncUint8List", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1216,9 +1091,7 @@ class HostIntegrationCoreApiSetup { echoAsyncUint8ListChannel.setMessageHandler(nil) } /// Returns the passed in generic Object asynchronously. - let echoAsyncObjectChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncObject", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncObject", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1236,9 +1109,7 @@ class HostIntegrationCoreApiSetup { echoAsyncObjectChannel.setMessageHandler(nil) } /// Returns the passed list, to test asynchronous serialization and deserialization. - let echoAsyncListChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncList", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncList", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1256,9 +1127,7 @@ class HostIntegrationCoreApiSetup { echoAsyncListChannel.setMessageHandler(nil) } /// Returns the passed map, to test asynchronous serialization and deserialization. - let echoAsyncMapChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncMap", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncMap", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1276,9 +1145,7 @@ class HostIntegrationCoreApiSetup { echoAsyncMapChannel.setMessageHandler(nil) } /// Returns the passed enum, to test asynchronous serialization and deserialization. - let echoAsyncEnumChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncEnum", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncEnum", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1296,9 +1163,7 @@ class HostIntegrationCoreApiSetup { echoAsyncEnumChannel.setMessageHandler(nil) } /// Responds with an error from an async function returning a value. - let throwAsyncErrorChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncError", - binaryMessenger: binaryMessenger, codec: codec) + let throwAsyncErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncError", binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwAsyncErrorChannel.setMessageHandler { _, reply in api.throwAsyncError { result in @@ -1314,10 +1179,7 @@ class HostIntegrationCoreApiSetup { throwAsyncErrorChannel.setMessageHandler(nil) } /// Responds with an error from an async void function. - let throwAsyncErrorFromVoidChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncErrorFromVoid", - binaryMessenger: binaryMessenger, codec: codec) + let throwAsyncErrorFromVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncErrorFromVoid", binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwAsyncErrorFromVoidChannel.setMessageHandler { _, reply in api.throwAsyncErrorFromVoid { result in @@ -1333,10 +1195,7 @@ class HostIntegrationCoreApiSetup { throwAsyncErrorFromVoidChannel.setMessageHandler(nil) } /// Responds with a Flutter error from an async function returning a value. - let throwAsyncFlutterErrorChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncFlutterError", - binaryMessenger: binaryMessenger, codec: codec) + let throwAsyncFlutterErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncFlutterError", binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwAsyncFlutterErrorChannel.setMessageHandler { _, reply in api.throwAsyncFlutterError { result in @@ -1352,9 +1211,7 @@ class HostIntegrationCoreApiSetup { throwAsyncFlutterErrorChannel.setMessageHandler(nil) } /// Returns the passed object, to test async serialization and deserialization. - let echoAsyncAllTypesChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncAllTypes", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncAllTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncAllTypes", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncAllTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1372,10 +1229,7 @@ class HostIntegrationCoreApiSetup { echoAsyncAllTypesChannel.setMessageHandler(nil) } /// Returns the passed object, to test serialization and deserialization. - let echoAsyncNullableAllNullableTypesChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableAllNullableTypes", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableAllNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableAllNullableTypes", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableAllNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1393,16 +1247,11 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableAllNullableTypesChannel.setMessageHandler(nil) } /// Returns passed in int asynchronously. - let echoAsyncNullableIntChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableInt", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableInt", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] - let anIntArg: Int64? = - isNullish(args[0]) - ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) + let anIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) api.echoAsyncNullable(anIntArg) { result in switch result { case .success(let res): @@ -1416,10 +1265,7 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableIntChannel.setMessageHandler(nil) } /// Returns passed in double asynchronously. - let echoAsyncNullableDoubleChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableDouble", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableDouble", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1437,10 +1283,7 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableDoubleChannel.setMessageHandler(nil) } /// Returns the passed in boolean asynchronously. - let echoAsyncNullableBoolChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableBool", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableBool", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1458,10 +1301,7 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableBoolChannel.setMessageHandler(nil) } /// Returns the passed string asynchronously. - let echoAsyncNullableStringChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableString", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableString", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1479,10 +1319,7 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableStringChannel.setMessageHandler(nil) } /// Returns the passed in Uint8List asynchronously. - let echoAsyncNullableUint8ListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableUint8List", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableUint8List", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1500,10 +1337,7 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableUint8ListChannel.setMessageHandler(nil) } /// Returns the passed in generic Object asynchronously. - let echoAsyncNullableObjectChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableObject", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableObject", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1521,10 +1355,7 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableObjectChannel.setMessageHandler(nil) } /// Returns the passed list, to test asynchronous serialization and deserialization. - let echoAsyncNullableListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableList", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableList", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1542,10 +1373,7 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableListChannel.setMessageHandler(nil) } /// Returns the passed map, to test asynchronous serialization and deserialization. - let echoAsyncNullableMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableMap", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableMap", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1563,10 +1391,7 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableMapChannel.setMessageHandler(nil) } /// Returns the passed enum, to test asynchronous serialization and deserialization. - let echoAsyncNullableEnumChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableEnum", - binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableEnum", binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1583,9 +1408,7 @@ class HostIntegrationCoreApiSetup { } else { echoAsyncNullableEnumChannel.setMessageHandler(nil) } - let callFlutterNoopChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterNoop", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterNoopChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterNoop", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterNoopChannel.setMessageHandler { _, reply in api.callFlutterNoop { result in @@ -1600,10 +1423,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterNoopChannel.setMessageHandler(nil) } - let callFlutterThrowErrorChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowError", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterThrowErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowError", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterThrowErrorChannel.setMessageHandler { _, reply in api.callFlutterThrowError { result in @@ -1618,10 +1438,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterThrowErrorChannel.setMessageHandler(nil) } - let callFlutterThrowErrorFromVoidChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowErrorFromVoid", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterThrowErrorFromVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowErrorFromVoid", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterThrowErrorFromVoidChannel.setMessageHandler { _, reply in api.callFlutterThrowErrorFromVoid { result in @@ -1636,10 +1453,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterThrowErrorFromVoidChannel.setMessageHandler(nil) } - let callFlutterEchoAllTypesChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllTypes", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoAllTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllTypes", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoAllTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1656,10 +1470,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoAllTypesChannel.setMessageHandler(nil) } - let callFlutterEchoAllNullableTypesChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllNullableTypes", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoAllNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllNullableTypes", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoAllNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1676,21 +1487,14 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoAllNullableTypesChannel.setMessageHandler(nil) } - let callFlutterSendMultipleNullableTypesChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterSendMultipleNullableTypes", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterSendMultipleNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterSendMultipleNullableTypes", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterSendMultipleNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableBoolArg: Bool? = nilOrValue(args[0]) - let aNullableIntArg: Int64? = - isNullish(args[1]) - ? nil : (args[1] is Int64? ? args[1] as! Int64? : Int64(args[1] as! Int32)) + let aNullableIntArg: Int64? = isNullish(args[1]) ? nil : (args[1] is Int64? ? args[1] as! Int64? : Int64(args[1] as! Int32)) let aNullableStringArg: String? = nilOrValue(args[2]) - api.callFlutterSendMultipleNullableTypes( - aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg - ) { result in + api.callFlutterSendMultipleNullableTypes(aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg) { result in switch result { case .success(let res): reply(wrapResult(res)) @@ -1702,10 +1506,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterSendMultipleNullableTypesChannel.setMessageHandler(nil) } - let callFlutterEchoBoolChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoBool", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoBool", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1722,9 +1523,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoBoolChannel.setMessageHandler(nil) } - let callFlutterEchoIntChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoInt", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoInt", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1741,10 +1540,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoIntChannel.setMessageHandler(nil) } - let callFlutterEchoDoubleChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoDouble", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoDouble", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1761,10 +1557,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoDoubleChannel.setMessageHandler(nil) } - let callFlutterEchoStringChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoString", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoString", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1781,10 +1574,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoStringChannel.setMessageHandler(nil) } - let callFlutterEchoUint8ListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoUint8List", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoUint8List", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1801,10 +1591,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoUint8ListChannel.setMessageHandler(nil) } - let callFlutterEchoListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoList", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoList", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1821,9 +1608,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoListChannel.setMessageHandler(nil) } - let callFlutterEchoMapChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoMap", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoMap", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1840,10 +1625,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoMapChannel.setMessageHandler(nil) } - let callFlutterEchoEnumChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoEnum", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoEnum", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1860,10 +1642,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoEnumChannel.setMessageHandler(nil) } - let callFlutterEchoNullableBoolChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableBool", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableBool", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1880,16 +1659,11 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoNullableBoolChannel.setMessageHandler(nil) } - let callFlutterEchoNullableIntChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableInt", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableInt", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] - let anIntArg: Int64? = - isNullish(args[0]) - ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) + let anIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) api.callFlutterEchoNullable(anIntArg) { result in switch result { case .success(let res): @@ -1902,10 +1676,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoNullableIntChannel.setMessageHandler(nil) } - let callFlutterEchoNullableDoubleChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableDouble", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableDouble", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1922,10 +1693,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoNullableDoubleChannel.setMessageHandler(nil) } - let callFlutterEchoNullableStringChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableString", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableString", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1942,10 +1710,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoNullableStringChannel.setMessageHandler(nil) } - let callFlutterEchoNullableUint8ListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableUint8List", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableUint8List", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1962,10 +1727,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoNullableUint8ListChannel.setMessageHandler(nil) } - let callFlutterEchoNullableListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableList", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableList", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1982,10 +1744,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoNullableListChannel.setMessageHandler(nil) } - let callFlutterEchoNullableMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableMap", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableMap", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2002,10 +1761,7 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoNullableMapChannel.setMessageHandler(nil) } - let callFlutterEchoNullableEnumChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableEnum", - binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableEnum", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2072,8 +1828,7 @@ private class FlutterIntegrationCoreApiCodecReaderWriter: FlutterStandardReaderW } class FlutterIntegrationCoreApiCodec: FlutterStandardMessageCodec { - static let shared = FlutterIntegrationCoreApiCodec( - readerWriter: FlutterIntegrationCoreApiCodecReaderWriter()) + static let shared = FlutterIntegrationCoreApiCodec(readerWriter: FlutterIntegrationCoreApiCodecReaderWriter()) } /// The core interface that the Dart platform_test code implements for host @@ -2089,19 +1844,13 @@ protocol FlutterIntegrationCoreApiProtocol { /// Responds with an error from an async void function. func throwErrorFromVoid(completion: @escaping (Result) -> Void) /// Returns the passed object, to test serialization and deserialization. - func echo( - _ everythingArg: AllTypes, completion: @escaping (Result) -> Void) + func echo(_ everythingArg: AllTypes, completion: @escaping (Result) -> Void) /// Returns the passed object, to test serialization and deserialization. - func echoNullable( - _ everythingArg: AllNullableTypes?, - completion: @escaping (Result) -> Void) + func echoNullable(_ everythingArg: AllNullableTypes?, completion: @escaping (Result) -> Void) /// Returns passed in arguments of multiple types. /// /// Tests multiple-arity FlutterApi handling. - func sendMultipleNullableTypes( - aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int64?, - aString aNullableStringArg: String?, - completion: @escaping (Result) -> Void) + func sendMultipleNullableTypes(aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int64?, aString aNullableStringArg: String?, completion: @escaping (Result) -> Void) /// Returns the passed boolean, to test serialization and deserialization. func echo(_ aBoolArg: Bool, completion: @escaping (Result) -> Void) /// Returns the passed int, to test serialization and deserialization. @@ -2111,42 +1860,29 @@ protocol FlutterIntegrationCoreApiProtocol { /// Returns the passed string, to test serialization and deserialization. func echo(_ aStringArg: String, completion: @escaping (Result) -> Void) /// Returns the passed byte list, to test serialization and deserialization. - func echo( - _ aListArg: FlutterStandardTypedData, - completion: @escaping (Result) -> Void) + func echo(_ aListArg: FlutterStandardTypedData, completion: @escaping (Result) -> Void) /// Returns the passed list, to test serialization and deserialization. func echo(_ aListArg: [Any?], completion: @escaping (Result<[Any?], FlutterError>) -> Void) /// Returns the passed map, to test serialization and deserialization. - func echo( - _ aMapArg: [String?: Any?], - completion: @escaping (Result<[String?: Any?], FlutterError>) -> Void) + func echo(_ aMapArg: [String?: Any?], completion: @escaping (Result<[String?: Any?], FlutterError>) -> Void) /// Returns the passed enum to test serialization and deserialization. func echo(_ anEnumArg: AnEnum, 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. - func echoNullable( - _ anIntArg: Int64?, completion: @escaping (Result) -> Void) + func echoNullable(_ anIntArg: Int64?, completion: @escaping (Result) -> Void) /// Returns the passed double, to test serialization and deserialization. - func echoNullable( - _ aDoubleArg: Double?, completion: @escaping (Result) -> Void) + func echoNullable(_ aDoubleArg: Double?, completion: @escaping (Result) -> Void) /// Returns the passed string, to test serialization and deserialization. - func echoNullable( - _ aStringArg: String?, completion: @escaping (Result) -> Void) + func echoNullable(_ aStringArg: String?, completion: @escaping (Result) -> Void) /// Returns the passed byte list, to test serialization and deserialization. - func echoNullable( - _ aListArg: FlutterStandardTypedData?, - completion: @escaping (Result) -> Void) + func echoNullable(_ aListArg: FlutterStandardTypedData?, completion: @escaping (Result) -> Void) /// Returns the passed list, to test serialization and deserialization. - func echoNullable( - _ aListArg: [Any?]?, completion: @escaping (Result<[Any?]?, FlutterError>) -> Void) + func echoNullable(_ aListArg: [Any?]?, completion: @escaping (Result<[Any?]?, FlutterError>) -> Void) /// Returns the passed map, to test serialization and deserialization. - func echoNullable( - _ aMapArg: [String?: Any?]?, - completion: @escaping (Result<[String?: Any?]?, FlutterError>) -> Void) + func echoNullable(_ aMapArg: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, FlutterError>) -> Void) /// Returns the passed enum to test serialization and deserialization. - func echoNullable( - _ anEnumArg: AnEnum?, completion: @escaping (Result) -> Void) + func echoNullable(_ anEnumArg: AnEnum?, 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) @@ -2164,10 +1900,8 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { /// A no-op function taking no arguments and returning no value, to sanity /// test basic calling. func noop(completion: @escaping (Result) -> Void) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noop" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noop" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2185,10 +1919,8 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Responds with an error from an async function returning a value. func throwError(completion: @escaping (Result) -> Void) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwError" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwError" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2207,10 +1939,8 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Responds with an error from an async void function. func throwErrorFromVoid(completion: @escaping (Result) -> Void) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwErrorFromVoid" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwErrorFromVoid" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2227,13 +1957,9 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed object, to test serialization and deserialization. - func echo( - _ everythingArg: AllTypes, completion: @escaping (Result) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllTypes" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echo(_ everythingArg: AllTypes, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllTypes" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([everythingArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2245,11 +1971,7 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - FlutterError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! AllTypes completion(.success(result)) @@ -2257,14 +1979,9 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed object, to test serialization and deserialization. - func echoNullable( - _ everythingArg: AllNullableTypes?, - completion: @escaping (Result) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllNullableTypes" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable(_ everythingArg: AllNullableTypes?, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllNullableTypes" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([everythingArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2284,17 +2001,10 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { /// Returns passed in arguments of multiple types. /// /// Tests multiple-arity FlutterApi handling. - func sendMultipleNullableTypes( - aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int64?, - aString aNullableStringArg: String?, - completion: @escaping (Result) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.sendMultipleNullableTypes" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([aNullableBoolArg, aNullableIntArg, aNullableStringArg] as [Any?]) { - response in + func sendMultipleNullableTypes(aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int64?, aString aNullableStringArg: String?, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.sendMultipleNullableTypes" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([aNullableBoolArg, aNullableIntArg, aNullableStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -2305,11 +2015,7 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - FlutterError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! AllNullableTypes completion(.success(result)) @@ -2318,10 +2024,8 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed boolean, to test serialization and deserialization. func echo(_ aBoolArg: Bool, completion: @escaping (Result) -> Void) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoBool" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoBool" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aBoolArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2333,11 +2037,7 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - FlutterError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! Bool completion(.success(result)) @@ -2346,10 +2046,8 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed int, to test serialization and deserialization. func echo(_ anIntArg: Int64, completion: @escaping (Result) -> Void) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoInt" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoInt" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anIntArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2361,24 +2059,17 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - FlutterError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { - let result = - listResponse[0] is Int64 ? listResponse[0] as! Int64 : Int64(listResponse[0] as! Int32) + let result = listResponse[0] is Int64 ? listResponse[0] as! Int64 : Int64(listResponse[0] as! Int32) completion(.success(result)) } } } /// Returns the passed double, to test serialization and deserialization. func echo(_ aDoubleArg: Double, completion: @escaping (Result) -> Void) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoDouble" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoDouble" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aDoubleArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2390,11 +2081,7 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - FlutterError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! Double completion(.success(result)) @@ -2403,10 +2090,8 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed string, to test serialization and deserialization. func echo(_ aStringArg: String, completion: @escaping (Result) -> Void) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoString" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoString" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2418,11 +2103,7 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - FlutterError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! String completion(.success(result)) @@ -2430,14 +2111,9 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed byte list, to test serialization and deserialization. - func echo( - _ aListArg: FlutterStandardTypedData, - completion: @escaping (Result) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoUint8List" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echo(_ aListArg: FlutterStandardTypedData, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoUint8List" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2449,11 +2125,7 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - FlutterError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! FlutterStandardTypedData completion(.success(result)) @@ -2462,10 +2134,8 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed list, to test serialization and deserialization. func echo(_ aListArg: [Any?], completion: @escaping (Result<[Any?], FlutterError>) -> Void) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoList" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoList" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2477,11 +2147,7 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - FlutterError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! [Any?] completion(.success(result)) @@ -2489,14 +2155,9 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed map, to test serialization and deserialization. - func echo( - _ aMapArg: [String?: Any?], - completion: @escaping (Result<[String?: Any?], FlutterError>) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoMap" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echo(_ aMapArg: [String?: Any?], completion: @escaping (Result<[String?: Any?], FlutterError>) -> Void) { + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoMap" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aMapArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2508,11 +2169,7 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - FlutterError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! [String?: Any?] completion(.success(result)) @@ -2521,10 +2178,8 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed enum to test serialization and deserialization. func echo(_ anEnumArg: AnEnum, completion: @escaping (Result) -> Void) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoEnum" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoEnum" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anEnumArg.rawValue] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2536,11 +2191,7 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - FlutterError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = AnEnum(rawValue: listResponse[0] as! Int)! completion(.success(result)) @@ -2548,12 +2199,9 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed boolean, to test serialization and deserialization. - func echoNullable(_ aBoolArg: Bool?, completion: @escaping (Result) -> Void) - { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableBool" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable(_ aBoolArg: Bool?, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableBool" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aBoolArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2571,13 +2219,9 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed int, to test serialization and deserialization. - func echoNullable( - _ anIntArg: Int64?, completion: @escaping (Result) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableInt" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable(_ anIntArg: Int64?, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableInt" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anIntArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2589,23 +2233,15 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else { - let result: Int64? = - isNullish(listResponse[0]) - ? nil - : (listResponse[0] is Int64? - ? listResponse[0] as! Int64? : Int64(listResponse[0] as! Int32)) + let result: Int64? = isNullish(listResponse[0]) ? nil : (listResponse[0] is Int64? ? listResponse[0] as! Int64? : Int64(listResponse[0] as! Int32)) completion(.success(result)) } } } /// Returns the passed double, to test serialization and deserialization. - func echoNullable( - _ aDoubleArg: Double?, completion: @escaping (Result) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableDouble" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable(_ aDoubleArg: Double?, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableDouble" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aDoubleArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2623,13 +2259,9 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed string, to test serialization and deserialization. - func echoNullable( - _ aStringArg: String?, completion: @escaping (Result) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableString" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable(_ aStringArg: String?, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableString" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2647,14 +2279,9 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed byte list, to test serialization and deserialization. - func echoNullable( - _ aListArg: FlutterStandardTypedData?, - completion: @escaping (Result) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableUint8List" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable(_ aListArg: FlutterStandardTypedData?, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableUint8List" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2672,13 +2299,9 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed list, to test serialization and deserialization. - func echoNullable( - _ aListArg: [Any?]?, completion: @escaping (Result<[Any?]?, FlutterError>) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableList" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable(_ aListArg: [Any?]?, completion: @escaping (Result<[Any?]?, FlutterError>) -> Void) { + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableList" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2696,14 +2319,9 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed map, to test serialization and deserialization. - func echoNullable( - _ aMapArg: [String?: Any?]?, - completion: @escaping (Result<[String?: Any?]?, FlutterError>) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableMap" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable(_ aMapArg: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, FlutterError>) -> Void) { + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableMap" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aMapArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2721,13 +2339,9 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed enum to test serialization and deserialization. - func echoNullable( - _ anEnumArg: AnEnum?, completion: @escaping (Result) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableEnum" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable(_ anEnumArg: AnEnum?, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableEnum" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anEnumArg?.rawValue] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2739,8 +2353,7 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else { - let result: AnEnum? = - isNullish(listResponse[0]) ? nil : AnEnum(rawValue: listResponse[0] as! Int)! + let result: AnEnum? = isNullish(listResponse[0]) ? nil : AnEnum(rawValue: listResponse[0] as! Int)! completion(.success(result)) } } @@ -2748,10 +2361,8 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. func noopAsync(completion: @escaping (Result) -> Void) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noopAsync" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noopAsync" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2768,12 +2379,9 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed in generic Object asynchronously. - func echoAsync(_ aStringArg: String, completion: @escaping (Result) -> Void) - { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAsyncString" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoAsync(_ aStringArg: String, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAsyncString" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2785,11 +2393,7 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - FlutterError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! String completion(.success(result)) @@ -2809,9 +2413,7 @@ class HostTrivialApiSetup { /// The codec used by HostTrivialApi. /// Sets up an instance of `HostTrivialApi` to handle messages through the `binaryMessenger`. static func setUp(binaryMessenger: FlutterBinaryMessenger, api: HostTrivialApi?) { - let noopChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostTrivialApi.noop", - binaryMessenger: binaryMessenger) + let noopChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostTrivialApi.noop", binaryMessenger: binaryMessenger) if let api = api { noopChannel.setMessageHandler { _, reply in do { @@ -2839,9 +2441,7 @@ class HostSmallApiSetup { /// The codec used by HostSmallApi. /// Sets up an instance of `HostSmallApi` to handle messages through the `binaryMessenger`. static func setUp(binaryMessenger: FlutterBinaryMessenger, api: HostSmallApi?) { - let echoChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.echo", - binaryMessenger: binaryMessenger) + let echoChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.echo", binaryMessenger: binaryMessenger) if let api = api { echoChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2858,9 +2458,7 @@ class HostSmallApiSetup { } else { echoChannel.setMessageHandler(nil) } - let voidVoidChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.voidVoid", - binaryMessenger: binaryMessenger) + let voidVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.voidVoid", binaryMessenger: binaryMessenger) if let api = api { voidVoidChannel.setMessageHandler { _, reply in api.voidVoid { result in @@ -2917,8 +2515,7 @@ class FlutterSmallApiCodec: FlutterStandardMessageCodec { /// /// Generated protocol from Pigeon that represents Flutter messages that can be called from Swift. protocol FlutterSmallApiProtocol { - func echo( - _ msgArg: TestMessage, completion: @escaping (Result) -> Void) + func echo(_ msgArg: TestMessage, completion: @escaping (Result) -> Void) func echo(_ aStringArg: String, completion: @escaping (Result) -> Void) } class FlutterSmallApi: FlutterSmallApiProtocol { @@ -2929,13 +2526,9 @@ class FlutterSmallApi: FlutterSmallApiProtocol { var codec: FlutterStandardMessageCodec { return FlutterSmallApiCodec.shared } - func echo( - _ msgArg: TestMessage, completion: @escaping (Result) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoWrappedList" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echo(_ msgArg: TestMessage, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoWrappedList" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([msgArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2947,11 +2540,7 @@ class FlutterSmallApi: FlutterSmallApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - FlutterError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! TestMessage completion(.success(result)) @@ -2959,10 +2548,8 @@ class FlutterSmallApi: FlutterSmallApiProtocol { } } func echo(_ aStringArg: String, completion: @escaping (Result) -> Void) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoString" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoString" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2974,11 +2561,7 @@ class FlutterSmallApi: FlutterSmallApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - FlutterError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! String completion(.success(result)) From c952664ae7241e1d63dafb80b27488c5dea7a63e Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Fri, 19 Jan 2024 08:25:53 -0500 Subject: [PATCH 6/9] Make whitespace fix more specific --- packages/pigeon/lib/generator_tools.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pigeon/lib/generator_tools.dart b/packages/pigeon/lib/generator_tools.dart index 1743cea12a1..0325c16b976 100644 --- a/packages/pigeon/lib/generator_tools.dart +++ b/packages/pigeon/lib/generator_tools.dart @@ -309,7 +309,7 @@ bool isVoid(TypeMirror type) { void addLines(Indent indent, Iterable lines, {String? linePrefix}) { final String prefix = linePrefix ?? ''; for (final String line in lines) { - indent.writeln('$prefix$line'.trimRight()); + indent.writeln(line.isNotEmpty ? '$prefix$line' : prefix.trimRight()); } } From b8babf125506bd5f502e20150f64cd6a3e002d68 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Fri, 19 Jan 2024 08:43:09 -0500 Subject: [PATCH 7/9] Version bump --- packages/pigeon/CHANGELOG.md | 4 ++++ packages/pigeon/lib/generator_tools.dart | 2 +- packages/pigeon/pubspec.yaml | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/pigeon/CHANGELOG.md b/packages/pigeon/CHANGELOG.md index 6a901e11287..6c26d0287fd 100644 --- a/packages/pigeon/CHANGELOG.md +++ b/packages/pigeon/CHANGELOG.md @@ -1,3 +1,7 @@ +## 16.0.4 + +* [swift] Improve style of Swift output. + ## 16.0.3 * [kotlin] Separates message call code generation into separate methods. diff --git a/packages/pigeon/lib/generator_tools.dart b/packages/pigeon/lib/generator_tools.dart index 0325c16b976..a399c62f1be 100644 --- a/packages/pigeon/lib/generator_tools.dart +++ b/packages/pigeon/lib/generator_tools.dart @@ -13,7 +13,7 @@ import 'ast.dart'; /// The current version of pigeon. /// /// This must match the version in pubspec.yaml. -const String pigeonVersion = '16.0.3'; +const String pigeonVersion = '16.0.4'; /// Read all the content from [stdin] to a String. String readStdin() { diff --git a/packages/pigeon/pubspec.yaml b/packages/pigeon/pubspec.yaml index c6029d4ed30..6ac3bb29449 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: 16.0.3 # This must match the version in lib/generator_tools.dart +version: 16.0.4 # This must match the version in lib/generator_tools.dart environment: sdk: ">=3.0.0 <4.0.0" From 5a99908c5bf49c20ecd9e83810bc32d9fb4a98b6 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Sat, 20 Jan 2024 09:53:31 -0500 Subject: [PATCH 8/9] Analyzer fixes --- packages/pigeon/test/swift_generator_test.dart | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/pigeon/test/swift_generator_test.dart b/packages/pigeon/test/swift_generator_test.dart index c4404af08fc..f691c7a041b 100644 --- a/packages/pigeon/test/swift_generator_test.dart +++ b/packages/pigeon/test/swift_generator_test.dart @@ -4,7 +4,6 @@ import 'package:pigeon/ast.dart'; import 'package:pigeon/swift_generator.dart'; -import 'package:test/expect.dart'; import 'package:test/test.dart'; import 'dart_generator_test.dart'; @@ -726,15 +725,11 @@ void main() { expect(code, isNot(contains('if ('))); }); - Iterable makeIterable(String string) sync* { - yield string; - } - test('header', () { final Root root = Root(apis: [], classes: [], enums: []); final StringBuffer sink = StringBuffer(); const SwiftOptions swiftOptions = SwiftOptions( - copyrightHeader: ['hello world', ''], + copyrightHeader: ['hello world', ''], ); const SwiftGenerator generator = SwiftGenerator(); generator.generate( From 0d9f663485f50d0419da4b06abdda62a4a5c947c Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Sat, 20 Jan 2024 10:17:39 -0500 Subject: [PATCH 9/9] Fix test --- packages/pigeon/test/swift_generator_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pigeon/test/swift_generator_test.dart b/packages/pigeon/test/swift_generator_test.dart index f691c7a041b..b39909be32b 100644 --- a/packages/pigeon/test/swift_generator_test.dart +++ b/packages/pigeon/test/swift_generator_test.dart @@ -1538,7 +1538,7 @@ void main() { expect( code, contains( - 'completion(.failure(createConnectionError(withChannelName:channelName)))')); + 'completion(.failure(createConnectionError(withChannelName: channelName)))')); expect( code, contains(