blob: 8b0381f5ed1ff074d7b62f6deffb996b5a75207b [file] [log] [blame]
// 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 (v9.0.1), do not edit directly.
// See also: https://pub.dev/packages/pigeon
import Foundation
#if os(iOS)
import Flutter
#elseif os(macOS)
import FlutterMacOS
#else
#error("Unsupported platform.")
#endif
private func wrapResult(_ result: Any?) -> [Any?] {
return [result]
}
private func wrapError(_ error: Any) -> [Any?] {
if let flutterError = error as? FlutterError {
return [
flutterError.code,
flutterError.message,
flutterError.details
]
}
return [
"\(error)",
"\(type(of: error))",
"Stacktrace: \(Thread.callStackSymbols)"
]
}
enum AnEnum: Int {
case one = 0
case two = 1
case three = 2
}
/// Generated class from Pigeon that represents data sent in messages.
struct AllTypes {
var aBool: Bool
var anInt: Int32
var aDouble: Double
var aByteArray: FlutterStandardTypedData
var a4ByteArray: FlutterStandardTypedData
var a8ByteArray: FlutterStandardTypedData
var aFloatArray: FlutterStandardTypedData
var aList: [Any?]
var aMap: [AnyHashable: Any?]
var anEnum: AnEnum
var aString: String
static func fromList(_ list: [Any?]) -> AllTypes? {
let aBool = list[0] as! Bool
let anInt = list[1] as! Int32
let aDouble = list[2] as! Double
let aByteArray = list[3] as! FlutterStandardTypedData
let a4ByteArray = list[4] as! FlutterStandardTypedData
let a8ByteArray = list[5] as! FlutterStandardTypedData
let aFloatArray = list[6] as! FlutterStandardTypedData
let aList = list[7] as! [Any?]
let aMap = list[8] as! [AnyHashable: Any?]
let anEnum = AnEnum(rawValue: list[9] as! Int)!
let aString = list[10] as! String
return AllTypes(
aBool: aBool,
anInt: anInt,
aDouble: aDouble,
aByteArray: aByteArray,
a4ByteArray: a4ByteArray,
a8ByteArray: a8ByteArray,
aFloatArray: aFloatArray,
aList: aList,
aMap: aMap,
anEnum: anEnum,
aString: aString
)
}
func toList() -> [Any?] {
return [
aBool,
anInt,
aDouble,
aByteArray,
a4ByteArray,
a8ByteArray,
aFloatArray,
aList,
aMap,
anEnum.rawValue,
aString,
]
}
}
/// Generated class from Pigeon that represents data sent in messages.
struct AllNullableTypes {
var aNullableBool: Bool? = nil
var aNullableInt: Int32? = nil
var aNullableDouble: Double? = nil
var aNullableByteArray: FlutterStandardTypedData? = nil
var aNullable4ByteArray: FlutterStandardTypedData? = nil
var aNullable8ByteArray: FlutterStandardTypedData? = nil
var aNullableFloatArray: FlutterStandardTypedData? = nil
var aNullableList: [Any?]? = nil
var aNullableMap: [AnyHashable: Any?]? = nil
var nullableNestedList: [[Bool?]?]? = nil
var nullableMapWithAnnotations: [String?: String?]? = nil
var nullableMapWithObject: [String?: Any?]? = nil
var aNullableEnum: AnEnum? = nil
var aNullableString: String? = nil
static func fromList(_ list: [Any?]) -> AllNullableTypes? {
let aNullableBool = list[0] as? Bool
let aNullableInt = list[1] as? Int32
let aNullableDouble = list[2] as? Double
let aNullableByteArray = list[3] as? FlutterStandardTypedData
let aNullable4ByteArray = list[4] as? FlutterStandardTypedData
let aNullable8ByteArray = list[5] as? FlutterStandardTypedData
let aNullableFloatArray = list[6] as? FlutterStandardTypedData
let aNullableList = list[7] as? [Any?]
let aNullableMap = list[8] as? [AnyHashable: Any?]
let nullableNestedList = list[9] as? [[Bool?]?]
let nullableMapWithAnnotations = list[10] as? [String?: String?]
let nullableMapWithObject = list[11] as? [String?: Any?]
var aNullableEnum: AnEnum? = nil
if let aNullableEnumRawValue = list[12] as? Int {
aNullableEnum = AnEnum(rawValue: aNullableEnumRawValue)
}
let aNullableString = list[13] as? String
return AllNullableTypes(
aNullableBool: aNullableBool,
aNullableInt: aNullableInt,
aNullableDouble: aNullableDouble,
aNullableByteArray: aNullableByteArray,
aNullable4ByteArray: aNullable4ByteArray,
aNullable8ByteArray: aNullable8ByteArray,
aNullableFloatArray: aNullableFloatArray,
aNullableList: aNullableList,
aNullableMap: aNullableMap,
nullableNestedList: nullableNestedList,
nullableMapWithAnnotations: nullableMapWithAnnotations,
nullableMapWithObject: nullableMapWithObject,
aNullableEnum: aNullableEnum,
aNullableString: aNullableString
)
}
func toList() -> [Any?] {
return [
aNullableBool,
aNullableInt,
aNullableDouble,
aNullableByteArray,
aNullable4ByteArray,
aNullable8ByteArray,
aNullableFloatArray,
aNullableList,
aNullableMap,
nullableNestedList,
nullableMapWithAnnotations,
nullableMapWithObject,
aNullableEnum?.rawValue,
aNullableString,
]
}
}
/// Generated class from Pigeon that represents data sent in messages.
struct AllNullableTypesWrapper {
var values: AllNullableTypes
static func fromList(_ list: [Any?]) -> AllNullableTypesWrapper? {
let values = AllNullableTypes.fromList(list[0] as! [Any?])!
return AllNullableTypesWrapper(
values: values
)
}
func toList() -> [Any?] {
return [
values.toList(),
]
}
}
/// A data class containing a List, used in unit tests.
///
/// Generated class from Pigeon that represents data sent in messages.
struct TestMessage {
var testList: [Any?]? = nil
static func fromList(_ list: [Any?]) -> TestMessage? {
let testList = list[0] as? [Any?]
return TestMessage(
testList: testList
)
}
func toList() -> [Any?] {
return [
testList,
]
}
}
private class HostIntegrationCoreApiCodecReader: FlutterStandardReader {
override func readValue(ofType type: UInt8) -> Any? {
switch type {
case 128:
return AllNullableTypes.fromList(self.readValue() as! [Any])
case 129:
return AllNullableTypesWrapper.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)
}
}
}
private class HostIntegrationCoreApiCodecWriter: FlutterStandardWriter {
override func writeValue(_ value: Any) {
if let value = value as? AllNullableTypes {
super.writeByte(128)
super.writeValue(value.toList())
} else if let value = value as? AllNullableTypesWrapper {
super.writeByte(129)
super.writeValue(value.toList())
} else if let value = value as? AllTypes {
super.writeByte(130)
super.writeValue(value.toList())
} else if let value = value as? TestMessage {
super.writeByte(131)
super.writeValue(value.toList())
} else {
super.writeValue(value)
}
}
}
private class HostIntegrationCoreApiCodecReaderWriter: FlutterStandardReaderWriter {
override func reader(with data: Data) -> FlutterStandardReader {
return HostIntegrationCoreApiCodecReader(data: data)
}
override func writer(with data: NSMutableData) -> FlutterStandardWriter {
return HostIntegrationCoreApiCodecWriter(data: data)
}
}
class HostIntegrationCoreApiCodec: FlutterStandardMessageCodec {
static let shared = HostIntegrationCoreApiCodec(readerWriter: HostIntegrationCoreApiCodecReaderWriter())
}
/// The core interface that each host language plugin must implement in
/// platform_test integration tests.
///
/// Generated protocol from Pigeon that represents a handler of messages from Flutter.
protocol HostIntegrationCoreApi {
/// A no-op function taking no arguments and returning no value, to sanity
/// test basic calling.
func noop() throws
/// Returns the passed object, to test serialization and deserialization.
func echo(_ everything: AllTypes) throws -> AllTypes
/// Returns an error, to test error handling.
func throwError() throws -> Any?
/// Responds with an error from an async void function.
func throwErrorFromVoid() throws
/// Returns passed in int.
func echo(_ anInt: Int32) throws -> Int32
/// Returns passed in double.
func echo(_ aDouble: Double) throws -> Double
/// Returns the passed in boolean.
func echo(_ aBool: Bool) throws -> Bool
/// Returns the passed in string.
func echo(_ aString: String) throws -> String
/// Returns the passed in Uint8List.
func echo(_ aUint8List: FlutterStandardTypedData) throws -> FlutterStandardTypedData
/// Returns the passed in generic Object.
func echo(_ anObject: Any) throws -> Any
/// Returns the passed list, to test serialization and deserialization.
func echo(_ aList: [Any?]) throws -> [Any?]
/// Returns the passed map, to test serialization and deserialization.
func echo(_ aMap: [String?: Any?]) throws -> [String?: Any?]
/// Returns the passed object, to test serialization and deserialization.
func echo(_ everything: AllNullableTypes?) throws -> AllNullableTypes?
/// Returns the inner `aString` value from the wrapped object, to test
/// sending of nested objects.
func extractNestedNullableString(from wrapper: AllNullableTypesWrapper) throws -> String?
/// Returns the inner `aString` value from the wrapped object, to test
/// sending of nested objects.
func createNestedObject(with nullableString: String?) throws -> AllNullableTypesWrapper
/// Returns passed in arguments of multiple types.
func sendMultipleNullableTypes(aBool aNullableBool: Bool?, anInt aNullableInt: Int32?, aString aNullableString: String?) throws -> AllNullableTypes
/// Returns passed in int.
func echo(_ aNullableInt: Int32?) throws -> Int32?
/// Returns passed in double.
func echo(_ aNullableDouble: Double?) throws -> Double?
/// Returns the passed in boolean.
func echo(_ aNullableBool: Bool?) throws -> Bool?
/// Returns the passed in string.
func echo(_ aNullableString: String?) throws -> String?
/// Returns the passed in Uint8List.
func echo(_ aNullableUint8List: FlutterStandardTypedData?) throws -> FlutterStandardTypedData?
/// Returns the passed in generic Object.
func echo(_ aNullableObject: Any?) throws -> Any?
/// Returns the passed list, to test serialization and deserialization.
func echoNullable(_ aNullableList: [Any?]?) throws -> [Any?]?
/// Returns the passed map, to test serialization and deserialization.
func echoNullable(_ aNullableMap: [String?: Any?]?) throws -> [String?: Any?]?
/// A no-op function taking no arguments and returning no value, to sanity
/// test basic asynchronous calling.
func noopAsync(completion: @escaping (Result<Void, Error>) -> Void)
/// Returns passed in int asynchronously.
func echoAsync(_ anInt: Int32, completion: @escaping (Result<Int32, Error>) -> Void)
/// Returns passed in double asynchronously.
func echoAsync(_ aDouble: Double, completion: @escaping (Result<Double, Error>) -> Void)
/// Returns the passed in boolean asynchronously.
func echoAsync(_ aBool: Bool, completion: @escaping (Result<Bool, Error>) -> Void)
/// Returns the passed string asynchronously.
func echoAsync(_ aString: String, completion: @escaping (Result<String, Error>) -> Void)
/// Returns the passed in Uint8List asynchronously.
func echoAsync(_ aUint8List: FlutterStandardTypedData, completion: @escaping (Result<FlutterStandardTypedData, Error>) -> Void)
/// Returns the passed in generic Object asynchronously.
func echoAsync(_ anObject: Any, completion: @escaping (Result<Any, Error>) -> Void)
/// Returns the passed list, to test serialization and deserialization asynchronously.
func echoAsync(_ aList: [Any?], completion: @escaping (Result<[Any?], Error>) -> Void)
/// Returns the passed map, to test serialization and deserialization asynchronously.
func echoAsync(_ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void)
/// Responds with an error from an async function returning a value.
func throwAsyncError(completion: @escaping (Result<Any?, Error>) -> Void)
/// Responds with an error from an async void function.
func throwAsyncErrorFromVoid(completion: @escaping (Result<Void, Error>) -> Void)
/// Returns the passed object, to test async serialization and deserialization.
func echoAsync(_ everything: AllTypes, completion: @escaping (Result<AllTypes, Error>) -> Void)
/// Returns the passed object, to test serialization and deserialization.
func echoAsync(_ everything: AllNullableTypes?, completion: @escaping (Result<AllNullableTypes?, Error>) -> Void)
/// Returns passed in int asynchronously.
func echoAsyncNullable(_ anInt: Int32?, completion: @escaping (Result<Int32?, Error>) -> Void)
/// Returns passed in double asynchronously.
func echoAsyncNullable(_ aDouble: Double?, completion: @escaping (Result<Double?, Error>) -> Void)
/// Returns the passed in boolean asynchronously.
func echoAsyncNullable(_ aBool: Bool?, completion: @escaping (Result<Bool?, Error>) -> Void)
/// Returns the passed string asynchronously.
func echoAsyncNullable(_ aString: String?, completion: @escaping (Result<String?, Error>) -> Void)
/// Returns the passed in Uint8List asynchronously.
func echoAsyncNullable(_ aUint8List: FlutterStandardTypedData?, completion: @escaping (Result<FlutterStandardTypedData?, Error>) -> Void)
/// Returns the passed in generic Object asynchronously.
func echoAsyncNullable(_ anObject: Any?, completion: @escaping (Result<Any?, Error>) -> Void)
/// Returns the passed list, to test serialization and deserialization asynchronously.
func echoAsyncNullable(_ aList: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void)
/// Returns the passed map, to test serialization and deserialization asynchronously.
func echAsyncoNullable(_ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void)
func callFlutterNoop(completion: @escaping (Result<Void, Error>) -> Void)
func callFlutterThrowError(completion: @escaping (Result<Any?, Error>) -> Void)
func callFlutterThrowErrorFromVoid(completion: @escaping (Result<Void, Error>) -> Void)
func callFlutterEcho(_ everything: AllTypes, completion: @escaping (Result<AllTypes, Error>) -> Void)
func callFlutterSendMultipleNullableTypes(aBool aNullableBool: Bool?, anInt aNullableInt: Int32?, aString aNullableString: String?, completion: @escaping (Result<AllNullableTypes, Error>) -> Void)
func callFlutterEcho(_ aBool: Bool, completion: @escaping (Result<Bool, Error>) -> Void)
func callFlutterEcho(_ anInt: Int32, completion: @escaping (Result<Int32, Error>) -> Void)
func callFlutterEcho(_ aDouble: Double, completion: @escaping (Result<Double, Error>) -> Void)
func callFlutterEcho(_ aString: String, completion: @escaping (Result<String, Error>) -> Void)
func callFlutterEcho(_ aList: FlutterStandardTypedData, completion: @escaping (Result<FlutterStandardTypedData, Error>) -> Void)
func callFlutterEcho(_ aList: [Any?], completion: @escaping (Result<[Any?], Error>) -> Void)
func callFlutterEcho(_ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void)
func callFlutterEchoNullable(_ aBool: Bool?, completion: @escaping (Result<Bool?, Error>) -> Void)
func callFlutterEchoNullable(_ anInt: Int32?, completion: @escaping (Result<Int32?, Error>) -> Void)
func callFlutterEchoNullable(_ aDouble: Double?, completion: @escaping (Result<Double?, Error>) -> Void)
func callFlutterEchoNullable(_ aString: String?, completion: @escaping (Result<String?, Error>) -> Void)
func callFlutterEchoNullable(_ aList: FlutterStandardTypedData?, completion: @escaping (Result<FlutterStandardTypedData?, Error>) -> Void)
func callFlutterEchoNullable(_ aList: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void)
func callFlutterEchoNullable(_ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void)
}
/// Generated setup class from Pigeon to handle messages through the `binaryMessenger`.
class HostIntegrationCoreApiSetup {
/// The codec used by HostIntegrationCoreApi.
static var codec: FlutterStandardMessageCodec { HostIntegrationCoreApiCodec.shared }
/// Sets up an instance of `HostIntegrationCoreApi` to handle messages through the `binaryMessenger`.
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.HostIntegrationCoreApi.noop", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
noopChannel.setMessageHandler { _, reply in
do {
try api.noop()
reply(wrapResult(nil))
} catch {
reply(wrapError(error))
}
}
} else {
noopChannel.setMessageHandler(nil)
}
/// Returns the passed object, to test serialization and deserialization.
let echoAllTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.echoAllTypes", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
echoAllTypesChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let everythingArg = args[0] as! AllTypes
do {
let result = try api.echo(everythingArg)
reply(wrapResult(result))
} catch {
reply(wrapError(error))
}
}
} else {
echoAllTypesChannel.setMessageHandler(nil)
}
/// Returns an error, to test error handling.
let throwErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.throwError", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
throwErrorChannel.setMessageHandler { _, reply in
do {
let result = try api.throwError()
reply(wrapResult(result))
} catch {
reply(wrapError(error))
}
}
} else {
throwErrorChannel.setMessageHandler(nil)
}
/// Responds with an error from an async void function.
let throwErrorFromVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.throwErrorFromVoid", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
throwErrorFromVoidChannel.setMessageHandler { _, reply in
do {
try api.throwErrorFromVoid()
reply(wrapResult(nil))
} catch {
reply(wrapError(error))
}
}
} else {
throwErrorFromVoidChannel.setMessageHandler(nil)
}
/// Returns passed in int.
let echoIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.echoInt", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
echoIntChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let anIntArg = args[0] as! Int32
do {
let result = try api.echo(anIntArg)
reply(wrapResult(result))
} catch {
reply(wrapError(error))
}
}
} else {
echoIntChannel.setMessageHandler(nil)
}
/// Returns passed in double.
let echoDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.echoDouble", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
echoDoubleChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let aDoubleArg = args[0] as! Double
do {
let result = try api.echo(aDoubleArg)
reply(wrapResult(result))
} catch {
reply(wrapError(error))
}
}
} else {
echoDoubleChannel.setMessageHandler(nil)
}
/// Returns the passed in boolean.
let echoBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.echoBool", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
echoBoolChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let aBoolArg = args[0] as! Bool
do {
let result = try api.echo(aBoolArg)
reply(wrapResult(result))
} catch {
reply(wrapError(error))
}
}
} else {
echoBoolChannel.setMessageHandler(nil)
}
/// Returns the passed in string.
let echoStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.echoString", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
echoStringChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let aStringArg = args[0] as! String
do {
let result = try api.echo(aStringArg)
reply(wrapResult(result))
} catch {
reply(wrapError(error))
}
}
} else {
echoStringChannel.setMessageHandler(nil)
}
/// Returns the passed in Uint8List.
let echoUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.echoUint8List", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
echoUint8ListChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let aUint8ListArg = args[0] as! FlutterStandardTypedData
do {
let result = try api.echo(aUint8ListArg)
reply(wrapResult(result))
} catch {
reply(wrapError(error))
}
}
} else {
echoUint8ListChannel.setMessageHandler(nil)
}
/// Returns the passed in generic Object.
let echoObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.echoObject", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
echoObjectChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let anObjectArg = args[0]!
do {
let result = try api.echo(anObjectArg)
reply(wrapResult(result))
} catch {
reply(wrapError(error))
}
}
} else {
echoObjectChannel.setMessageHandler(nil)
}
/// Returns the passed list, to test serialization and deserialization.
let echoListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.echoList", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
echoListChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let aListArg = args[0] as! [Any?]
do {
let result = try api.echo(aListArg)
reply(wrapResult(result))
} catch {
reply(wrapError(error))
}
}
} else {
echoListChannel.setMessageHandler(nil)
}
/// Returns the passed map, to test serialization and deserialization.
let echoMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.echoMap", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
echoMapChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let aMapArg = args[0] as! [String?: Any?]
do {
let result = try api.echo(aMapArg)
reply(wrapResult(result))
} catch {
reply(wrapError(error))
}
}
} else {
echoMapChannel.setMessageHandler(nil)
}
/// Returns the passed object, to test serialization and deserialization.
let echoAllNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.echoAllNullableTypes", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
echoAllNullableTypesChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let everythingArg = args[0] as? AllNullableTypes
do {
let result = try api.echo(everythingArg)
reply(wrapResult(result))
} catch {
reply(wrapError(error))
}
}
} else {
echoAllNullableTypesChannel.setMessageHandler(nil)
}
/// Returns the inner `aString` value from the wrapped object, to test
/// sending of nested objects.
let extractNestedNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.extractNestedNullableString", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
extractNestedNullableStringChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let wrapperArg = args[0] as! AllNullableTypesWrapper
do {
let result = try api.extractNestedNullableString(from: wrapperArg)
reply(wrapResult(result))
} catch {
reply(wrapError(error))
}
}
} else {
extractNestedNullableStringChannel.setMessageHandler(nil)
}
/// Returns the inner `aString` value from the wrapped object, to test
/// sending of nested objects.
let createNestedNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.createNestedNullableString", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
createNestedNullableStringChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let nullableStringArg = args[0] as? String
do {
let result = try api.createNestedObject(with: nullableStringArg)
reply(wrapResult(result))
} catch {
reply(wrapError(error))
}
}
} else {
createNestedNullableStringChannel.setMessageHandler(nil)
}
/// Returns passed in arguments of multiple types.
let sendMultipleNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.sendMultipleNullableTypes", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
sendMultipleNullableTypesChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let aNullableBoolArg = args[0] as? Bool
let aNullableIntArg = args[1] as? Int32
let aNullableStringArg = args[2] as? String
do {
let result = try api.sendMultipleNullableTypes(aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg)
reply(wrapResult(result))
} catch {
reply(wrapError(error))
}
}
} else {
sendMultipleNullableTypesChannel.setMessageHandler(nil)
}
/// Returns passed in int.
let echoNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableInt", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
echoNullableIntChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let aNullableIntArg = args[0] as? Int32
do {
let result = try api.echo(aNullableIntArg)
reply(wrapResult(result))
} catch {
reply(wrapError(error))
}
}
} else {
echoNullableIntChannel.setMessageHandler(nil)
}
/// Returns passed in double.
let echoNullableDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableDouble", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
echoNullableDoubleChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let aNullableDoubleArg = args[0] as? Double
do {
let result = try api.echo(aNullableDoubleArg)
reply(wrapResult(result))
} catch {
reply(wrapError(error))
}
}
} else {
echoNullableDoubleChannel.setMessageHandler(nil)
}
/// Returns the passed in boolean.
let echoNullableBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableBool", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
echoNullableBoolChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let aNullableBoolArg = args[0] as? Bool
do {
let result = try api.echo(aNullableBoolArg)
reply(wrapResult(result))
} catch {
reply(wrapError(error))
}
}
} else {
echoNullableBoolChannel.setMessageHandler(nil)
}
/// Returns the passed in string.
let echoNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableString", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
echoNullableStringChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let aNullableStringArg = args[0] as? String
do {
let result = try api.echo(aNullableStringArg)
reply(wrapResult(result))
} catch {
reply(wrapError(error))
}
}
} else {
echoNullableStringChannel.setMessageHandler(nil)
}
/// Returns the passed in Uint8List.
let echoNullableUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableUint8List", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
echoNullableUint8ListChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let aNullableUint8ListArg = args[0] as? FlutterStandardTypedData
do {
let result = try api.echo(aNullableUint8ListArg)
reply(wrapResult(result))
} catch {
reply(wrapError(error))
}
}
} else {
echoNullableUint8ListChannel.setMessageHandler(nil)
}
/// Returns the passed in generic Object.
let echoNullableObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableObject", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
echoNullableObjectChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let aNullableObjectArg = args[0]
do {
let result = try api.echo(aNullableObjectArg)
reply(wrapResult(result))
} catch {
reply(wrapError(error))
}
}
} else {
echoNullableObjectChannel.setMessageHandler(nil)
}
/// Returns the passed list, to test serialization and deserialization.
let echoNullableListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableList", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
echoNullableListChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let aNullableListArg = args[0] as? [Any?]
do {
let result = try api.echoNullable(aNullableListArg)
reply(wrapResult(result))
} catch {
reply(wrapError(error))
}
}
} else {
echoNullableListChannel.setMessageHandler(nil)
}
/// Returns the passed map, to test serialization and deserialization.
let echoNullableMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableMap", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
echoNullableMapChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let aNullableMapArg = args[0] as? [String?: Any?]
do {
let result = try api.echoNullable(aNullableMapArg)
reply(wrapResult(result))
} catch {
reply(wrapError(error))
}
}
} else {
echoNullableMapChannel.setMessageHandler(nil)
}
/// A no-op function taking no arguments and returning no value, to sanity
/// test basic asynchronous calling.
let noopAsyncChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.noopAsync", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
noopAsyncChannel.setMessageHandler { _, reply in
api.noopAsync() { result in
switch result {
case .success:
reply(wrapResult(nil))
case .failure(let error):
reply(wrapError(error))
}
}
}
} else {
noopAsyncChannel.setMessageHandler(nil)
}
/// Returns passed in int asynchronously.
let echoAsyncIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncInt", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
echoAsyncIntChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let anIntArg = 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))
}
}
}
} else {
echoAsyncIntChannel.setMessageHandler(nil)
}
/// Returns passed in double asynchronously.
let echoAsyncDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.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))
}
}
}
} else {
echoAsyncDoubleChannel.setMessageHandler(nil)
}
/// Returns the passed in boolean asynchronously.
let echoAsyncBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.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))
}
}
}
} else {
echoAsyncBoolChannel.setMessageHandler(nil)
}
/// Returns the passed string asynchronously.
let echoAsyncStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.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))
}
}
}
} else {
echoAsyncStringChannel.setMessageHandler(nil)
}
/// Returns the passed in Uint8List asynchronously.
let echoAsyncUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.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))
}
}
}
} else {
echoAsyncUint8ListChannel.setMessageHandler(nil)
}
/// Returns the passed in generic Object asynchronously.
let echoAsyncObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.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))
}
}
}
} else {
echoAsyncObjectChannel.setMessageHandler(nil)
}
/// Returns the passed list, to test serialization and deserialization asynchronously.
let echoAsyncListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.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))
}
}
}
} else {
echoAsyncListChannel.setMessageHandler(nil)
}
/// Returns the passed map, to test serialization and deserialization asynchronously.
let echoAsyncMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.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))
}
}
}
} else {
echoAsyncMapChannel.setMessageHandler(nil)
}
/// Responds with an error from an async function returning a value.
let throwAsyncErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.throwAsyncError", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
throwAsyncErrorChannel.setMessageHandler { _, reply in
api.throwAsyncError() { result in
switch result {
case .success(let res):
reply(wrapResult(res))
case .failure(let error):
reply(wrapError(error))
}
}
}
} else {
throwAsyncErrorChannel.setMessageHandler(nil)
}
/// Responds with an error from an async void function.
let throwAsyncErrorFromVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.throwAsyncErrorFromVoid", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
throwAsyncErrorFromVoidChannel.setMessageHandler { _, reply in
api.throwAsyncErrorFromVoid() { result in
switch result {
case .success:
reply(wrapResult(nil))
case .failure(let error):
reply(wrapError(error))
}
}
}
} else {
throwAsyncErrorFromVoidChannel.setMessageHandler(nil)
}
/// Returns the passed object, to test async serialization and deserialization.
let echoAsyncAllTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.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))
}
}
}
} else {
echoAsyncAllTypesChannel.setMessageHandler(nil)
}
/// Returns the passed object, to test serialization and deserialization.
let echoAsyncNullableAllNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableAllNullableTypes", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
echoAsyncNullableAllNullableTypesChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let everythingArg = args[0] as? AllNullableTypes
api.echoAsync(everythingArg) { result in
switch result {
case .success(let res):
reply(wrapResult(res))
case .failure(let error):
reply(wrapError(error))
}
}
}
} else {
echoAsyncNullableAllNullableTypesChannel.setMessageHandler(nil)
}
/// Returns passed in int asynchronously.
let echoAsyncNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableInt", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
echoAsyncNullableIntChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let anIntArg = 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))
}
}
}
} else {
echoAsyncNullableIntChannel.setMessageHandler(nil)
}
/// Returns passed in double asynchronously.
let echoAsyncNullableDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableDouble", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
echoAsyncNullableDoubleChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let aDoubleArg = args[0] as? Double
api.echoAsyncNullable(aDoubleArg) { result in
switch result {
case .success(let res):
reply(wrapResult(res))
case .failure(let error):
reply(wrapError(error))
}
}
}
} else {
echoAsyncNullableDoubleChannel.setMessageHandler(nil)
}
/// Returns the passed in boolean asynchronously.
let echoAsyncNullableBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableBool", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
echoAsyncNullableBoolChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let aBoolArg = args[0] as? Bool
api.echoAsyncNullable(aBoolArg) { result in
switch result {
case .success(let res):
reply(wrapResult(res))
case .failure(let error):
reply(wrapError(error))
}
}
}
} else {
echoAsyncNullableBoolChannel.setMessageHandler(nil)
}
/// Returns the passed string asynchronously.
let echoAsyncNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableString", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
echoAsyncNullableStringChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let aStringArg = args[0] as? String
api.echoAsyncNullable(aStringArg) { result in
switch result {
case .success(let res):
reply(wrapResult(res))
case .failure(let error):
reply(wrapError(error))
}
}
}
} else {
echoAsyncNullableStringChannel.setMessageHandler(nil)
}
/// Returns the passed in Uint8List asynchronously.
let echoAsyncNullableUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableUint8List", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
echoAsyncNullableUint8ListChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let aUint8ListArg = args[0] as? FlutterStandardTypedData
api.echoAsyncNullable(aUint8ListArg) { result in
switch result {
case .success(let res):
reply(wrapResult(res))
case .failure(let error):
reply(wrapError(error))
}
}
}
} else {
echoAsyncNullableUint8ListChannel.setMessageHandler(nil)
}
/// Returns the passed in generic Object asynchronously.
let echoAsyncNullableObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableObject", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
echoAsyncNullableObjectChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let anObjectArg = args[0]
api.echoAsyncNullable(anObjectArg) { result in
switch result {
case .success(let res):
reply(wrapResult(res))
case .failure(let error):
reply(wrapError(error))
}
}
}
} else {
echoAsyncNullableObjectChannel.setMessageHandler(nil)
}
/// Returns the passed list, to test serialization and deserialization asynchronously.
let echoAsyncNullableListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableList", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
echoAsyncNullableListChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let aListArg = args[0] as? [Any?]
api.echoAsyncNullable(aListArg) { result in
switch result {
case .success(let res):
reply(wrapResult(res))
case .failure(let error):
reply(wrapError(error))
}
}
}
} else {
echoAsyncNullableListChannel.setMessageHandler(nil)
}
/// Returns the passed map, to test serialization and deserialization asynchronously.
let echoAsyncNullableMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableMap", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
echoAsyncNullableMapChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let aMapArg = args[0] as? [String?: Any?]
api.echAsyncoNullable(aMapArg) { result in
switch result {
case .success(let res):
reply(wrapResult(res))
case .failure(let error):
reply(wrapError(error))
}
}
}
} else {
echoAsyncNullableMapChannel.setMessageHandler(nil)
}
let callFlutterNoopChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterNoop", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
callFlutterNoopChannel.setMessageHandler { _, reply in
api.callFlutterNoop() { result in
switch result {
case .success:
reply(wrapResult(nil))
case .failure(let error):
reply(wrapError(error))
}
}
}
} else {
callFlutterNoopChannel.setMessageHandler(nil)
}
let callFlutterThrowErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterThrowError", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
callFlutterThrowErrorChannel.setMessageHandler { _, reply in
api.callFlutterThrowError() { result in
switch result {
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.HostIntegrationCoreApi.callFlutterThrowErrorFromVoid", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
callFlutterThrowErrorFromVoidChannel.setMessageHandler { _, reply in
api.callFlutterThrowErrorFromVoid() { result in
switch result {
case .success:
reply(wrapResult(nil))
case .failure(let error):
reply(wrapError(error))
}
}
}
} else {
callFlutterThrowErrorFromVoidChannel.setMessageHandler(nil)
}
let callFlutterEchoAllTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.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))
}
}
}
} else {
callFlutterEchoAllTypesChannel.setMessageHandler(nil)
}
let callFlutterSendMultipleNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterSendMultipleNullableTypes", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
callFlutterSendMultipleNullableTypesChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let aNullableBoolArg = args[0] as? Bool
let aNullableIntArg = args[1] as? Int32
let aNullableStringArg = args[2] as? String
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))
}
}
}
} else {
callFlutterSendMultipleNullableTypesChannel.setMessageHandler(nil)
}
let callFlutterEchoBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.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))
}
}
}
} else {
callFlutterEchoBoolChannel.setMessageHandler(nil)
}
let callFlutterEchoIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoInt", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
callFlutterEchoIntChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let anIntArg = 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))
}
}
}
} else {
callFlutterEchoIntChannel.setMessageHandler(nil)
}
let callFlutterEchoDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.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))
}
}
}
} else {
callFlutterEchoDoubleChannel.setMessageHandler(nil)
}
let callFlutterEchoStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.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))
}
}
}
} else {
callFlutterEchoStringChannel.setMessageHandler(nil)
}
let callFlutterEchoUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.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))
}
}
}
} else {
callFlutterEchoUint8ListChannel.setMessageHandler(nil)
}
let callFlutterEchoListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.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))
}
}
}
} else {
callFlutterEchoListChannel.setMessageHandler(nil)
}
let callFlutterEchoMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.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))
}
}
}
} else {
callFlutterEchoMapChannel.setMessageHandler(nil)
}
let callFlutterEchoNullableBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableBool", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
callFlutterEchoNullableBoolChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let aBoolArg = args[0] as? Bool
api.callFlutterEchoNullable(aBoolArg) { result in
switch result {
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.HostIntegrationCoreApi.callFlutterEchoNullableInt", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
callFlutterEchoNullableIntChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let anIntArg = 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))
}
}
}
} else {
callFlutterEchoNullableIntChannel.setMessageHandler(nil)
}
let callFlutterEchoNullableDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableDouble", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
callFlutterEchoNullableDoubleChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let aDoubleArg = args[0] as? Double
api.callFlutterEchoNullable(aDoubleArg) { result in
switch result {
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.HostIntegrationCoreApi.callFlutterEchoNullableString", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
callFlutterEchoNullableStringChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let aStringArg = args[0] as? String
api.callFlutterEchoNullable(aStringArg) { result in
switch result {
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.HostIntegrationCoreApi.callFlutterEchoNullableUint8List", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
callFlutterEchoNullableUint8ListChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let aListArg = args[0] as? FlutterStandardTypedData
api.callFlutterEchoNullable(aListArg) { result in
switch result {
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.HostIntegrationCoreApi.callFlutterEchoNullableList", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
callFlutterEchoNullableListChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let aListArg = args[0] as? [Any?]
api.callFlutterEchoNullable(aListArg) { result in
switch result {
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.HostIntegrationCoreApi.callFlutterEchoNullableMap", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
callFlutterEchoNullableMapChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let aMapArg = args[0] as? [String?: Any?]
api.callFlutterEchoNullable(aMapArg) { result in
switch result {
case .success(let res):
reply(wrapResult(res))
case .failure(let error):
reply(wrapError(error))
}
}
}
} else {
callFlutterEchoNullableMapChannel.setMessageHandler(nil)
}
}
}
private class FlutterIntegrationCoreApiCodecReader: FlutterStandardReader {
override func readValue(ofType type: UInt8) -> Any? {
switch type {
case 128:
return AllNullableTypes.fromList(self.readValue() as! [Any])
case 129:
return AllNullableTypesWrapper.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)
}
}
}
private class FlutterIntegrationCoreApiCodecWriter: FlutterStandardWriter {
override func writeValue(_ value: Any) {
if let value = value as? AllNullableTypes {
super.writeByte(128)
super.writeValue(value.toList())
} else if let value = value as? AllNullableTypesWrapper {
super.writeByte(129)
super.writeValue(value.toList())
} else if let value = value as? AllTypes {
super.writeByte(130)
super.writeValue(value.toList())
} else if let value = value as? TestMessage {
super.writeByte(131)
super.writeValue(value.toList())
} else {
super.writeValue(value)
}
}
}
private class FlutterIntegrationCoreApiCodecReaderWriter: FlutterStandardReaderWriter {
override func reader(with data: Data) -> FlutterStandardReader {
return FlutterIntegrationCoreApiCodecReader(data: data)
}
override func writer(with data: NSMutableData) -> FlutterStandardWriter {
return FlutterIntegrationCoreApiCodecWriter(data: data)
}
}
class FlutterIntegrationCoreApiCodec: FlutterStandardMessageCodec {
static let shared = FlutterIntegrationCoreApiCodec(readerWriter: FlutterIntegrationCoreApiCodecReaderWriter())
}
/// The core interface that the Dart platform_test code implements for host
/// integration tests to call into.
///
/// Generated class from Pigeon that represents Flutter messages that can be called from Swift.
class FlutterIntegrationCoreApi {
private let binaryMessenger: FlutterBinaryMessenger
init(binaryMessenger: FlutterBinaryMessenger){
self.binaryMessenger = binaryMessenger
}
var codec: FlutterStandardMessageCodec {
return FlutterIntegrationCoreApiCodec.shared
}
/// A no-op function taking no arguments and returning no value, to sanity
/// test basic calling.
func noop(completion: @escaping () -> Void) {
let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.noop", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage(nil) { _ in
completion()
}
}
/// Responds with an error from an async function returning a value.
func throwError(completion: @escaping (Any?) -> Void) {
let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.throwError", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage(nil) { response in
let result = response
completion(result)
}
}
/// Responds with an error from an async void function.
func throwErrorFromVoid(completion: @escaping () -> Void) {
let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.throwErrorFromVoid", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage(nil) { _ in
completion()
}
}
/// Returns the passed object, to test serialization and deserialization.
func echo(_ everythingArg: AllTypes, completion: @escaping (AllTypes) -> Void) {
let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllTypes", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([everythingArg] as [Any?]) { response in
let result = response as! AllTypes
completion(result)
}
}
/// Returns the passed object, to test serialization and deserialization.
func echoNullable(_ everythingArg: AllNullableTypes, completion: @escaping (AllNullableTypes) -> Void) {
let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([everythingArg] as [Any?]) { response in
let result = response as! AllNullableTypes
completion(result)
}
}
/// Returns passed in arguments of multiple types.
///
/// Tests multiple-arity FlutterApi handling.
func sendMultipleNullableTypes(aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int32?, aString aNullableStringArg: String?, completion: @escaping (AllNullableTypes) -> Void) {
let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.sendMultipleNullableTypes", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aNullableBoolArg, aNullableIntArg, aNullableStringArg] as [Any?]) { response in
let result = response as! AllNullableTypes
completion(result)
}
}
/// Returns the passed boolean, to test serialization and deserialization.
func echo(_ aBoolArg: Bool, completion: @escaping (Bool) -> Void) {
let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoBool", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aBoolArg] as [Any?]) { response in
let result = response as! Bool
completion(result)
}
}
/// Returns the passed int, to test serialization and deserialization.
func echo(_ anIntArg: Int32, completion: @escaping (Int32) -> Void) {
let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoInt", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([anIntArg] as [Any?]) { response in
let result = response as! Int32
completion(result)
}
}
/// Returns the passed double, to test serialization and deserialization.
func echo(_ aDoubleArg: Double, completion: @escaping (Double) -> Void) {
let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoDouble", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aDoubleArg] as [Any?]) { response in
let result = response as! Double
completion(result)
}
}
/// Returns the passed string, to test serialization and deserialization.
func echo(_ aStringArg: String, completion: @escaping (String) -> Void) {
let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoString", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aStringArg] as [Any?]) { response in
let result = response as! String
completion(result)
}
}
/// Returns the passed byte list, to test serialization and deserialization.
func echo(_ aListArg: FlutterStandardTypedData, completion: @escaping (FlutterStandardTypedData) -> Void) {
let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoUint8List", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aListArg] as [Any?]) { response in
let result = response as! FlutterStandardTypedData
completion(result)
}
}
/// Returns the passed list, to test serialization and deserialization.
func echo(_ aListArg: [Any?], completion: @escaping ([Any?]) -> Void) {
let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoList", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aListArg] as [Any?]) { response in
let result = response as! [Any?]
completion(result)
}
}
/// Returns the passed map, to test serialization and deserialization.
func echo(_ aMapArg: [String?: Any?], completion: @escaping ([String?: Any?]) -> Void) {
let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoMap", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aMapArg] as [Any?]) { response in
let result = response as! [String?: Any?]
completion(result)
}
}
/// Returns the passed boolean, to test serialization and deserialization.
func echoNullable(_ aBoolArg: Bool?, completion: @escaping (Bool?) -> Void) {
let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableBool", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aBoolArg] as [Any?]) { response in
let result = response as? Bool
completion(result)
}
}
/// Returns the passed int, to test serialization and deserialization.
func echoNullable(_ anIntArg: Int32?, completion: @escaping (Int32?) -> Void) {
let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableInt", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([anIntArg] as [Any?]) { response in
let result = response as? Int32
completion(result)
}
}
/// Returns the passed double, to test serialization and deserialization.
func echoNullable(_ aDoubleArg: Double?, completion: @escaping (Double?) -> Void) {
let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableDouble", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aDoubleArg] as [Any?]) { response in
let result = response as? Double
completion(result)
}
}
/// Returns the passed string, to test serialization and deserialization.
func echoNullable(_ aStringArg: String?, completion: @escaping (String?) -> Void) {
let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableString", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aStringArg] as [Any?]) { response in
let result = response as? String
completion(result)
}
}
/// Returns the passed byte list, to test serialization and deserialization.
func echoNullable(_ aListArg: FlutterStandardTypedData?, completion: @escaping (FlutterStandardTypedData?) -> Void) {
let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableUint8List", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aListArg] as [Any?]) { response in
let result = response as? FlutterStandardTypedData
completion(result)
}
}
/// Returns the passed list, to test serialization and deserialization.
func echoNullable(_ aListArg: [Any?]?, completion: @escaping ([Any?]?) -> Void) {
let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aListArg] as [Any?]) { response in
let result = response as? [Any?]
completion(result)
}
}
/// Returns the passed map, to test serialization and deserialization.
func echoNullable(_ aMapArg: [String?: Any?]?, completion: @escaping ([String?: Any?]?) -> Void) {
let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aMapArg] as [Any?]) { response in
let result = response as? [String?: Any?]
completion(result)
}
}
/// A no-op function taking no arguments and returning no value, to sanity
/// test basic asynchronous calling.
func noopAsync(completion: @escaping () -> Void) {
let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.noopAsync", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage(nil) { _ in
completion()
}
}
/// Returns the passed in generic Object asynchronously.
func echoAsync(_ aStringArg: String, completion: @escaping (String) -> Void) {
let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAsyncString", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aStringArg] as [Any?]) { response in
let result = response as! String
completion(result)
}
}
}
/// An API that can be implemented for minimal, compile-only tests.
///
/// Generated protocol from Pigeon that represents a handler of messages from Flutter.
protocol HostTrivialApi {
func noop() throws
}
/// Generated setup class from Pigeon to handle messages through the `binaryMessenger`.
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.HostTrivialApi.noop", binaryMessenger: binaryMessenger)
if let api = api {
noopChannel.setMessageHandler { _, reply in
do {
try api.noop()
reply(wrapResult(nil))
} catch {
reply(wrapError(error))
}
}
} else {
noopChannel.setMessageHandler(nil)
}
}
}
/// A simple API implemented in some unit tests.
///
/// Generated protocol from Pigeon that represents a handler of messages from Flutter.
protocol HostSmallApi {
func echo(aString: String, completion: @escaping (Result<String, Error>) -> Void)
func voidVoid(completion: @escaping (Result<Void, Error>) -> Void)
}
/// Generated setup class from Pigeon to handle messages through the `binaryMessenger`.
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.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))
}
}
}
} else {
echoChannel.setMessageHandler(nil)
}
let voidVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostSmallApi.voidVoid", binaryMessenger: binaryMessenger)
if let api = api {
voidVoidChannel.setMessageHandler { _, reply in
api.voidVoid() { result in
switch result {
case .success:
reply(wrapResult(nil))
case .failure(let error):
reply(wrapError(error))
}
}
}
} else {
voidVoidChannel.setMessageHandler(nil)
}
}
}
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)
}
}
}
private class FlutterSmallApiCodecWriter: FlutterStandardWriter {
override func writeValue(_ value: Any) {
if let value = value as? TestMessage {
super.writeByte(128)
super.writeValue(value.toList())
} else {
super.writeValue(value)
}
}
}
private class FlutterSmallApiCodecReaderWriter: FlutterStandardReaderWriter {
override func reader(with data: Data) -> FlutterStandardReader {
return FlutterSmallApiCodecReader(data: data)
}
override func writer(with data: NSMutableData) -> FlutterStandardWriter {
return FlutterSmallApiCodecWriter(data: data)
}
}
class FlutterSmallApiCodec: FlutterStandardMessageCodec {
static let shared = FlutterSmallApiCodec(readerWriter: FlutterSmallApiCodecReaderWriter())
}
/// A simple API called in some unit tests.
///
/// Generated class from Pigeon that represents Flutter messages that can be called from Swift.
class FlutterSmallApi {
private let binaryMessenger: FlutterBinaryMessenger
init(binaryMessenger: FlutterBinaryMessenger){
self.binaryMessenger = binaryMessenger
}
var codec: FlutterStandardMessageCodec {
return FlutterSmallApiCodec.shared
}
func echo(_ msgArg: TestMessage, completion: @escaping (TestMessage) -> Void) {
let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterSmallApi.echoWrappedList", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([msgArg] as [Any?]) { response in
let result = response as! TestMessage
completion(result)
}
}
}