blob: 3f4f25a0edaf1d73d962a7f40a225ccfdb08751e [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.3), do not edit directly.
// See also: https://pub.dev/packages/pigeon
package com.example.test_plugin
import android.util.Log
import io.flutter.plugin.common.BasicMessageChannel
import io.flutter.plugin.common.BinaryMessenger
import io.flutter.plugin.common.MessageCodec
import io.flutter.plugin.common.StandardMessageCodec
import java.io.ByteArrayOutputStream
import java.nio.ByteBuffer
private fun wrapResult(result: Any?): List<Any?> {
return listOf(result)
}
private fun wrapError(exception: Throwable): List<Any> {
return listOf<Any>(
exception.javaClass.simpleName,
exception.toString(),
"Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception)
)
}
enum class AnEnum(val raw: Int) {
ONE(0),
TWO(1),
THREE(2);
companion object {
fun ofRaw(raw: Int): AnEnum? {
return values().firstOrNull { it.raw == raw }
}
}
}
/** Generated class from Pigeon that represents data sent in messages. */
data class AllTypes (
val aBool: Boolean,
val anInt: Long,
val aDouble: Double,
val aByteArray: ByteArray,
val a4ByteArray: IntArray,
val a8ByteArray: LongArray,
val aFloatArray: DoubleArray,
val aList: List<Any?>,
val aMap: Map<Any, Any?>,
val anEnum: AnEnum,
val aString: String
) {
companion object {
@Suppress("UNCHECKED_CAST")
fun fromList(list: List<Any?>): AllTypes {
val aBool = list[0] as Boolean
val anInt = list[1].let { if (it is Int) it.toLong() else it as Long }
val aDouble = list[2] as Double
val aByteArray = list[3] as ByteArray
val a4ByteArray = list[4] as IntArray
val a8ByteArray = list[5] as LongArray
val aFloatArray = list[6] as DoubleArray
val aList = list[7] as List<Any?>
val aMap = list[8] as Map<Any, Any?>
val anEnum = AnEnum.ofRaw(list[9] as Int)!!
val aString = list[10] as String
return AllTypes(aBool, anInt, aDouble, aByteArray, a4ByteArray, a8ByteArray, aFloatArray, aList, aMap, anEnum, aString)
}
}
fun toList(): List<Any?> {
return listOf<Any?>(
aBool,
anInt,
aDouble,
aByteArray,
a4ByteArray,
a8ByteArray,
aFloatArray,
aList,
aMap,
anEnum.raw,
aString,
)
}
}
/** Generated class from Pigeon that represents data sent in messages. */
data class AllNullableTypes (
val aNullableBool: Boolean? = null,
val aNullableInt: Long? = null,
val aNullableDouble: Double? = null,
val aNullableByteArray: ByteArray? = null,
val aNullable4ByteArray: IntArray? = null,
val aNullable8ByteArray: LongArray? = null,
val aNullableFloatArray: DoubleArray? = null,
val aNullableList: List<Any?>? = null,
val aNullableMap: Map<Any, Any?>? = null,
val nullableNestedList: List<List<Boolean?>?>? = null,
val nullableMapWithAnnotations: Map<String?, String?>? = null,
val nullableMapWithObject: Map<String?, Any?>? = null,
val aNullableEnum: AnEnum? = null,
val aNullableString: String? = null
) {
companion object {
@Suppress("UNCHECKED_CAST")
fun fromList(list: List<Any?>): AllNullableTypes {
val aNullableBool = list[0] as Boolean?
val aNullableInt = list[1].let { if (it is Int) it.toLong() else it as Long? }
val aNullableDouble = list[2] as Double?
val aNullableByteArray = list[3] as ByteArray?
val aNullable4ByteArray = list[4] as IntArray?
val aNullable8ByteArray = list[5] as LongArray?
val aNullableFloatArray = list[6] as DoubleArray?
val aNullableList = list[7] as List<Any?>?
val aNullableMap = list[8] as Map<Any, Any?>?
val nullableNestedList = list[9] as List<List<Boolean?>?>?
val nullableMapWithAnnotations = list[10] as Map<String?, String?>?
val nullableMapWithObject = list[11] as Map<String?, Any?>?
val aNullableEnum: AnEnum? = (list[12] as Int?)?.let {
AnEnum.ofRaw(it)
}
val aNullableString = list[13] as String?
return AllNullableTypes(aNullableBool, aNullableInt, aNullableDouble, aNullableByteArray, aNullable4ByteArray, aNullable8ByteArray, aNullableFloatArray, aNullableList, aNullableMap, nullableNestedList, nullableMapWithAnnotations, nullableMapWithObject, aNullableEnum, aNullableString)
}
}
fun toList(): List<Any?> {
return listOf<Any?>(
aNullableBool,
aNullableInt,
aNullableDouble,
aNullableByteArray,
aNullable4ByteArray,
aNullable8ByteArray,
aNullableFloatArray,
aNullableList,
aNullableMap,
nullableNestedList,
nullableMapWithAnnotations,
nullableMapWithObject,
aNullableEnum?.raw,
aNullableString,
)
}
}
/** Generated class from Pigeon that represents data sent in messages. */
data class AllNullableTypesWrapper (
val values: AllNullableTypes
) {
companion object {
@Suppress("UNCHECKED_CAST")
fun fromList(list: List<Any?>): AllNullableTypesWrapper {
val values = AllNullableTypes.fromList(list[0] as List<Any?>)
return AllNullableTypesWrapper(values)
}
}
fun toList(): List<Any?> {
return listOf<Any?>(
values.toList(),
)
}
}
/**
* A data class containing a List, used in unit tests.
*
* Generated class from Pigeon that represents data sent in messages.
*/
data class TestMessage (
val testList: List<Any?>? = null
) {
companion object {
@Suppress("UNCHECKED_CAST")
fun fromList(list: List<Any?>): TestMessage {
val testList = list[0] as List<Any?>?
return TestMessage(testList)
}
}
fun toList(): List<Any?> {
return listOf<Any?>(
testList,
)
}
}
@Suppress("UNCHECKED_CAST")
private object HostIntegrationCoreApiCodec : StandardMessageCodec() {
override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? {
return when (type) {
128.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
AllNullableTypes.fromList(it)
}
}
129.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
AllNullableTypesWrapper.fromList(it)
}
}
130.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
AllTypes.fromList(it)
}
}
131.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
TestMessage.fromList(it)
}
}
else -> super.readValueOfType(type, buffer)
}
}
override fun writeValue(stream: ByteArrayOutputStream, value: Any?) {
when (value) {
is AllNullableTypes -> {
stream.write(128)
writeValue(stream, value.toList())
}
is AllNullableTypesWrapper -> {
stream.write(129)
writeValue(stream, value.toList())
}
is AllTypes -> {
stream.write(130)
writeValue(stream, value.toList())
}
is TestMessage -> {
stream.write(131)
writeValue(stream, value.toList())
}
else -> super.writeValue(stream, value)
}
}
}
/**
* The core interface that each host language plugin must implement in
* platform_test integration tests.
*
* Generated interface from Pigeon that represents a handler of messages from Flutter.
*/
interface HostIntegrationCoreApi {
/**
* A no-op function taking no arguments and returning no value, to sanity
* test basic calling.
*/
fun noop()
/** Returns the passed object, to test serialization and deserialization. */
fun echoAllTypes(everything: AllTypes): AllTypes
/** Returns an error, to test error handling. */
fun throwError(): Any?
/** Responds with an error from an async void function. */
fun throwErrorFromVoid()
/** Returns passed in int. */
fun echoInt(anInt: Long): Long
/** Returns passed in double. */
fun echoDouble(aDouble: Double): Double
/** Returns the passed in boolean. */
fun echoBool(aBool: Boolean): Boolean
/** Returns the passed in string. */
fun echoString(aString: String): String
/** Returns the passed in Uint8List. */
fun echoUint8List(aUint8List: ByteArray): ByteArray
/** Returns the passed in generic Object. */
fun echoObject(anObject: Any): Any
/** Returns the passed list, to test serialization and deserialization. */
fun echoList(aList: List<Any?>): List<Any?>
/** Returns the passed map, to test serialization and deserialization. */
fun echoMap(aMap: Map<String?, Any?>): Map<String?, Any?>
/** Returns the passed object, to test serialization and deserialization. */
fun echoAllNullableTypes(everything: AllNullableTypes?): AllNullableTypes?
/**
* Returns the inner `aString` value from the wrapped object, to test
* sending of nested objects.
*/
fun extractNestedNullableString(wrapper: AllNullableTypesWrapper): String?
/**
* Returns the inner `aString` value from the wrapped object, to test
* sending of nested objects.
*/
fun createNestedNullableString(nullableString: String?): AllNullableTypesWrapper
/** Returns passed in arguments of multiple types. */
fun sendMultipleNullableTypes(aNullableBool: Boolean?, aNullableInt: Long?, aNullableString: String?): AllNullableTypes
/** Returns passed in int. */
fun echoNullableInt(aNullableInt: Long?): Long?
/** Returns passed in double. */
fun echoNullableDouble(aNullableDouble: Double?): Double?
/** Returns the passed in boolean. */
fun echoNullableBool(aNullableBool: Boolean?): Boolean?
/** Returns the passed in string. */
fun echoNullableString(aNullableString: String?): String?
/** Returns the passed in Uint8List. */
fun echoNullableUint8List(aNullableUint8List: ByteArray?): ByteArray?
/** Returns the passed in generic Object. */
fun echoNullableObject(aNullableObject: Any?): Any?
/** Returns the passed list, to test serialization and deserialization. */
fun echoNullableList(aNullableList: List<Any?>?): List<Any?>?
/** Returns the passed map, to test serialization and deserialization. */
fun echoNullableMap(aNullableMap: Map<String?, Any?>?): Map<String?, Any?>?
/**
* A no-op function taking no arguments and returning no value, to sanity
* test basic asynchronous calling.
*/
fun noopAsync(callback: (Result<Unit>) -> Unit)
/** Returns passed in int asynchronously. */
fun echoAsyncInt(anInt: Long, callback: (Result<Long>) -> Unit)
/** Returns passed in double asynchronously. */
fun echoAsyncDouble(aDouble: Double, callback: (Result<Double>) -> Unit)
/** Returns the passed in boolean asynchronously. */
fun echoAsyncBool(aBool: Boolean, callback: (Result<Boolean>) -> Unit)
/** Returns the passed string asynchronously. */
fun echoAsyncString(aString: String, callback: (Result<String>) -> Unit)
/** Returns the passed in Uint8List asynchronously. */
fun echoAsyncUint8List(aUint8List: ByteArray, callback: (Result<ByteArray>) -> Unit)
/** Returns the passed in generic Object asynchronously. */
fun echoAsyncObject(anObject: Any, callback: (Result<Any>) -> Unit)
/** Returns the passed list, to test serialization and deserialization asynchronously. */
fun echoAsyncList(aList: List<Any?>, callback: (Result<List<Any?>>) -> Unit)
/** Returns the passed map, to test serialization and deserialization asynchronously. */
fun echoAsyncMap(aMap: Map<String?, Any?>, callback: (Result<Map<String?, Any?>>) -> Unit)
/** Responds with an error from an async function returning a value. */
fun throwAsyncError(callback: (Result<Any?>) -> Unit)
/** Responds with an error from an async void function. */
fun throwAsyncErrorFromVoid(callback: (Result<Unit>) -> Unit)
/** Returns the passed object, to test async serialization and deserialization. */
fun echoAsyncAllTypes(everything: AllTypes, callback: (Result<AllTypes>) -> Unit)
/** Returns the passed object, to test serialization and deserialization. */
fun echoAsyncNullableAllNullableTypes(everything: AllNullableTypes?, callback: (Result<AllNullableTypes?>) -> Unit)
/** Returns passed in int asynchronously. */
fun echoAsyncNullableInt(anInt: Long?, callback: (Result<Long?>) -> Unit)
/** Returns passed in double asynchronously. */
fun echoAsyncNullableDouble(aDouble: Double?, callback: (Result<Double?>) -> Unit)
/** Returns the passed in boolean asynchronously. */
fun echoAsyncNullableBool(aBool: Boolean?, callback: (Result<Boolean?>) -> Unit)
/** Returns the passed string asynchronously. */
fun echoAsyncNullableString(aString: String?, callback: (Result<String?>) -> Unit)
/** Returns the passed in Uint8List asynchronously. */
fun echoAsyncNullableUint8List(aUint8List: ByteArray?, callback: (Result<ByteArray?>) -> Unit)
/** Returns the passed in generic Object asynchronously. */
fun echoAsyncNullableObject(anObject: Any?, callback: (Result<Any?>) -> Unit)
/** Returns the passed list, to test serialization and deserialization asynchronously. */
fun echoAsyncNullableList(aList: List<Any?>?, callback: (Result<List<Any?>?>) -> Unit)
/** Returns the passed map, to test serialization and deserialization asynchronously. */
fun echoAsyncNullableMap(aMap: Map<String?, Any?>?, callback: (Result<Map<String?, Any?>?>) -> Unit)
fun callFlutterNoop(callback: (Result<Unit>) -> Unit)
fun callFlutterThrowError(callback: (Result<Any?>) -> Unit)
fun callFlutterThrowErrorFromVoid(callback: (Result<Unit>) -> Unit)
fun callFlutterEchoAllTypes(everything: AllTypes, callback: (Result<AllTypes>) -> Unit)
fun callFlutterSendMultipleNullableTypes(aNullableBool: Boolean?, aNullableInt: Long?, aNullableString: String?, callback: (Result<AllNullableTypes>) -> Unit)
fun callFlutterEchoBool(aBool: Boolean, callback: (Result<Boolean>) -> Unit)
fun callFlutterEchoInt(anInt: Long, callback: (Result<Long>) -> Unit)
fun callFlutterEchoDouble(aDouble: Double, callback: (Result<Double>) -> Unit)
fun callFlutterEchoString(aString: String, callback: (Result<String>) -> Unit)
fun callFlutterEchoUint8List(aList: ByteArray, callback: (Result<ByteArray>) -> Unit)
fun callFlutterEchoList(aList: List<Any?>, callback: (Result<List<Any?>>) -> Unit)
fun callFlutterEchoMap(aMap: Map<String?, Any?>, callback: (Result<Map<String?, Any?>>) -> Unit)
fun callFlutterEchoNullableBool(aBool: Boolean?, callback: (Result<Boolean?>) -> Unit)
fun callFlutterEchoNullableInt(anInt: Long?, callback: (Result<Long?>) -> Unit)
fun callFlutterEchoNullableDouble(aDouble: Double?, callback: (Result<Double?>) -> Unit)
fun callFlutterEchoNullableString(aString: String?, callback: (Result<String?>) -> Unit)
fun callFlutterEchoNullableUint8List(aList: ByteArray?, callback: (Result<ByteArray?>) -> Unit)
fun callFlutterEchoNullableList(aList: List<Any?>?, callback: (Result<List<Any?>?>) -> Unit)
fun callFlutterEchoNullableMap(aMap: Map<String?, Any?>?, callback: (Result<Map<String?, Any?>?>) -> Unit)
companion object {
/** The codec used by HostIntegrationCoreApi. */
val codec: MessageCodec<Any?> by lazy {
HostIntegrationCoreApiCodec
}
/** Sets up an instance of `HostIntegrationCoreApi` to handle messages through the `binaryMessenger`. */
@Suppress("UNCHECKED_CAST")
fun setUp(binaryMessenger: BinaryMessenger, api: HostIntegrationCoreApi?) {
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.noop", codec)
if (api != null) {
channel.setMessageHandler { _, reply ->
var wrapped: List<Any?>
try {
api.noop()
wrapped = listOf<Any?>(null)
} catch (exception: Error) {
wrapped = wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAllTypes", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val everythingArg = args[0] as AllTypes
var wrapped: List<Any?>
try {
wrapped = listOf<Any?>(api.echoAllTypes(everythingArg))
} catch (exception: Error) {
wrapped = wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.throwError", codec)
if (api != null) {
channel.setMessageHandler { _, reply ->
var wrapped: List<Any?>
try {
wrapped = listOf<Any?>(api.throwError())
} catch (exception: Error) {
wrapped = wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.throwErrorFromVoid", codec)
if (api != null) {
channel.setMessageHandler { _, reply ->
var wrapped: List<Any?>
try {
api.throwErrorFromVoid()
wrapped = listOf<Any?>(null)
} catch (exception: Error) {
wrapped = wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoInt", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val anIntArg = args[0].let { if (it is Int) it.toLong() else it as Long }
var wrapped: List<Any?>
try {
wrapped = listOf<Any?>(api.echoInt(anIntArg))
} catch (exception: Error) {
wrapped = wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoDouble", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aDoubleArg = args[0] as Double
var wrapped: List<Any?>
try {
wrapped = listOf<Any?>(api.echoDouble(aDoubleArg))
} catch (exception: Error) {
wrapped = wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoBool", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aBoolArg = args[0] as Boolean
var wrapped: List<Any?>
try {
wrapped = listOf<Any?>(api.echoBool(aBoolArg))
} catch (exception: Error) {
wrapped = wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoString", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aStringArg = args[0] as String
var wrapped: List<Any?>
try {
wrapped = listOf<Any?>(api.echoString(aStringArg))
} catch (exception: Error) {
wrapped = wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoUint8List", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aUint8ListArg = args[0] as ByteArray
var wrapped: List<Any?>
try {
wrapped = listOf<Any?>(api.echoUint8List(aUint8ListArg))
} catch (exception: Error) {
wrapped = wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoObject", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val anObjectArg = args[0] as Any
var wrapped: List<Any?>
try {
wrapped = listOf<Any?>(api.echoObject(anObjectArg))
} catch (exception: Error) {
wrapped = wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoList", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aListArg = args[0] as List<Any?>
var wrapped: List<Any?>
try {
wrapped = listOf<Any?>(api.echoList(aListArg))
} catch (exception: Error) {
wrapped = wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoMap", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aMapArg = args[0] as Map<String?, Any?>
var wrapped: List<Any?>
try {
wrapped = listOf<Any?>(api.echoMap(aMapArg))
} catch (exception: Error) {
wrapped = wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAllNullableTypes", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val everythingArg = args[0] as? AllNullableTypes
var wrapped: List<Any?>
try {
wrapped = listOf<Any?>(api.echoAllNullableTypes(everythingArg))
} catch (exception: Error) {
wrapped = wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.extractNestedNullableString", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val wrapperArg = args[0] as AllNullableTypesWrapper
var wrapped: List<Any?>
try {
wrapped = listOf<Any?>(api.extractNestedNullableString(wrapperArg))
} catch (exception: Error) {
wrapped = wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.createNestedNullableString", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val nullableStringArg = args[0] as? String
var wrapped: List<Any?>
try {
wrapped = listOf<Any?>(api.createNestedNullableString(nullableStringArg))
} catch (exception: Error) {
wrapped = wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.sendMultipleNullableTypes", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aNullableBoolArg = args[0] as? Boolean
val aNullableIntArg = args[1].let { if (it is Int) it.toLong() else it as? Long }
val aNullableStringArg = args[2] as? String
var wrapped: List<Any?>
try {
wrapped = listOf<Any?>(api.sendMultipleNullableTypes(aNullableBoolArg, aNullableIntArg, aNullableStringArg))
} catch (exception: Error) {
wrapped = wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableInt", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aNullableIntArg = args[0].let { if (it is Int) it.toLong() else it as? Long }
var wrapped: List<Any?>
try {
wrapped = listOf<Any?>(api.echoNullableInt(aNullableIntArg))
} catch (exception: Error) {
wrapped = wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableDouble", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aNullableDoubleArg = args[0] as? Double
var wrapped: List<Any?>
try {
wrapped = listOf<Any?>(api.echoNullableDouble(aNullableDoubleArg))
} catch (exception: Error) {
wrapped = wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableBool", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aNullableBoolArg = args[0] as? Boolean
var wrapped: List<Any?>
try {
wrapped = listOf<Any?>(api.echoNullableBool(aNullableBoolArg))
} catch (exception: Error) {
wrapped = wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableString", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aNullableStringArg = args[0] as? String
var wrapped: List<Any?>
try {
wrapped = listOf<Any?>(api.echoNullableString(aNullableStringArg))
} catch (exception: Error) {
wrapped = wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableUint8List", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aNullableUint8ListArg = args[0] as? ByteArray
var wrapped: List<Any?>
try {
wrapped = listOf<Any?>(api.echoNullableUint8List(aNullableUint8ListArg))
} catch (exception: Error) {
wrapped = wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableObject", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aNullableObjectArg = args[0]
var wrapped: List<Any?>
try {
wrapped = listOf<Any?>(api.echoNullableObject(aNullableObjectArg))
} catch (exception: Error) {
wrapped = wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableList", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aNullableListArg = args[0] as? List<Any?>
var wrapped: List<Any?>
try {
wrapped = listOf<Any?>(api.echoNullableList(aNullableListArg))
} catch (exception: Error) {
wrapped = wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableMap", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aNullableMapArg = args[0] as? Map<String?, Any?>
var wrapped: List<Any?>
try {
wrapped = listOf<Any?>(api.echoNullableMap(aNullableMapArg))
} catch (exception: Error) {
wrapped = wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.noopAsync", codec)
if (api != null) {
channel.setMessageHandler { _, reply ->
api.noopAsync() { result: Result<Unit> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
reply.reply(wrapResult(null))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncInt", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val anIntArg = args[0].let { if (it is Int) it.toLong() else it as Long }
api.echoAsyncInt(anIntArg) { result: Result<Long> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncDouble", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aDoubleArg = args[0] as Double
api.echoAsyncDouble(aDoubleArg) { result: Result<Double> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncBool", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aBoolArg = args[0] as Boolean
api.echoAsyncBool(aBoolArg) { result: Result<Boolean> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncString", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aStringArg = args[0] as String
api.echoAsyncString(aStringArg) { result: Result<String> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncUint8List", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aUint8ListArg = args[0] as ByteArray
api.echoAsyncUint8List(aUint8ListArg) { result: Result<ByteArray> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncObject", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val anObjectArg = args[0] as Any
api.echoAsyncObject(anObjectArg) { result: Result<Any> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncList", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aListArg = args[0] as List<Any?>
api.echoAsyncList(aListArg) { result: Result<List<Any?>> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncMap", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aMapArg = args[0] as Map<String?, Any?>
api.echoAsyncMap(aMapArg) { result: Result<Map<String?, Any?>> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.throwAsyncError", codec)
if (api != null) {
channel.setMessageHandler { _, reply ->
api.throwAsyncError() { result: Result<Any?> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.throwAsyncErrorFromVoid", codec)
if (api != null) {
channel.setMessageHandler { _, reply ->
api.throwAsyncErrorFromVoid() { result: Result<Unit> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
reply.reply(wrapResult(null))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncAllTypes", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val everythingArg = args[0] as AllTypes
api.echoAsyncAllTypes(everythingArg) { result: Result<AllTypes> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableAllNullableTypes", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val everythingArg = args[0] as? AllNullableTypes
api.echoAsyncNullableAllNullableTypes(everythingArg) { result: Result<AllNullableTypes?> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableInt", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val anIntArg = args[0].let { if (it is Int) it.toLong() else it as? Long }
api.echoAsyncNullableInt(anIntArg) { result: Result<Long?> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableDouble", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aDoubleArg = args[0] as? Double
api.echoAsyncNullableDouble(aDoubleArg) { result: Result<Double?> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableBool", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aBoolArg = args[0] as? Boolean
api.echoAsyncNullableBool(aBoolArg) { result: Result<Boolean?> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableString", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aStringArg = args[0] as? String
api.echoAsyncNullableString(aStringArg) { result: Result<String?> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableUint8List", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aUint8ListArg = args[0] as? ByteArray
api.echoAsyncNullableUint8List(aUint8ListArg) { result: Result<ByteArray?> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableObject", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val anObjectArg = args[0]
api.echoAsyncNullableObject(anObjectArg) { result: Result<Any?> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableList", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aListArg = args[0] as? List<Any?>
api.echoAsyncNullableList(aListArg) { result: Result<List<Any?>?> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableMap", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aMapArg = args[0] as? Map<String?, Any?>
api.echoAsyncNullableMap(aMapArg) { result: Result<Map<String?, Any?>?> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterNoop", codec)
if (api != null) {
channel.setMessageHandler { _, reply ->
api.callFlutterNoop() { result: Result<Unit> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
reply.reply(wrapResult(null))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterThrowError", codec)
if (api != null) {
channel.setMessageHandler { _, reply ->
api.callFlutterThrowError() { result: Result<Any?> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterThrowErrorFromVoid", codec)
if (api != null) {
channel.setMessageHandler { _, reply ->
api.callFlutterThrowErrorFromVoid() { result: Result<Unit> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
reply.reply(wrapResult(null))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoAllTypes", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val everythingArg = args[0] as AllTypes
api.callFlutterEchoAllTypes(everythingArg) { result: Result<AllTypes> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterSendMultipleNullableTypes", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aNullableBoolArg = args[0] as? Boolean
val aNullableIntArg = args[1].let { if (it is Int) it.toLong() else it as? Long }
val aNullableStringArg = args[2] as? String
api.callFlutterSendMultipleNullableTypes(aNullableBoolArg, aNullableIntArg, aNullableStringArg) { result: Result<AllNullableTypes> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoBool", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aBoolArg = args[0] as Boolean
api.callFlutterEchoBool(aBoolArg) { result: Result<Boolean> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoInt", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val anIntArg = args[0].let { if (it is Int) it.toLong() else it as Long }
api.callFlutterEchoInt(anIntArg) { result: Result<Long> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoDouble", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aDoubleArg = args[0] as Double
api.callFlutterEchoDouble(aDoubleArg) { result: Result<Double> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoString", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aStringArg = args[0] as String
api.callFlutterEchoString(aStringArg) { result: Result<String> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoUint8List", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aListArg = args[0] as ByteArray
api.callFlutterEchoUint8List(aListArg) { result: Result<ByteArray> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoList", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aListArg = args[0] as List<Any?>
api.callFlutterEchoList(aListArg) { result: Result<List<Any?>> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoMap", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aMapArg = args[0] as Map<String?, Any?>
api.callFlutterEchoMap(aMapArg) { result: Result<Map<String?, Any?>> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableBool", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aBoolArg = args[0] as? Boolean
api.callFlutterEchoNullableBool(aBoolArg) { result: Result<Boolean?> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableInt", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val anIntArg = args[0].let { if (it is Int) it.toLong() else it as? Long }
api.callFlutterEchoNullableInt(anIntArg) { result: Result<Long?> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableDouble", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aDoubleArg = args[0] as? Double
api.callFlutterEchoNullableDouble(aDoubleArg) { result: Result<Double?> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableString", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aStringArg = args[0] as? String
api.callFlutterEchoNullableString(aStringArg) { result: Result<String?> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableUint8List", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aListArg = args[0] as? ByteArray
api.callFlutterEchoNullableUint8List(aListArg) { result: Result<ByteArray?> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableList", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aListArg = args[0] as? List<Any?>
api.callFlutterEchoNullableList(aListArg) { result: Result<List<Any?>?> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableMap", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aMapArg = args[0] as? Map<String?, Any?>
api.callFlutterEchoNullableMap(aMapArg) { result: Result<Map<String?, Any?>?> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
}
}
}
@Suppress("UNCHECKED_CAST")
private object FlutterIntegrationCoreApiCodec : StandardMessageCodec() {
override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? {
return when (type) {
128.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
AllNullableTypes.fromList(it)
}
}
129.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
AllNullableTypesWrapper.fromList(it)
}
}
130.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
AllTypes.fromList(it)
}
}
131.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
TestMessage.fromList(it)
}
}
else -> super.readValueOfType(type, buffer)
}
}
override fun writeValue(stream: ByteArrayOutputStream, value: Any?) {
when (value) {
is AllNullableTypes -> {
stream.write(128)
writeValue(stream, value.toList())
}
is AllNullableTypesWrapper -> {
stream.write(129)
writeValue(stream, value.toList())
}
is AllTypes -> {
stream.write(130)
writeValue(stream, value.toList())
}
is TestMessage -> {
stream.write(131)
writeValue(stream, value.toList())
}
else -> super.writeValue(stream, value)
}
}
}
/**
* 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 Kotlin.
*/
@Suppress("UNCHECKED_CAST")
class FlutterIntegrationCoreApi(private val binaryMessenger: BinaryMessenger) {
companion object {
/** The codec used by FlutterIntegrationCoreApi. */
val codec: MessageCodec<Any?> by lazy {
FlutterIntegrationCoreApiCodec
}
}
/**
* A no-op function taking no arguments and returning no value, to sanity
* test basic calling.
*/
fun noop(callback: () -> Unit) {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.noop", codec)
channel.send(null) {
callback()
}
}
/** Responds with an error from an async function returning a value. */
fun throwError(callback: (Any?) -> Unit) {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.throwError", codec)
channel.send(null) {
val result = it
callback(result)
}
}
/** Responds with an error from an async void function. */
fun throwErrorFromVoid(callback: () -> Unit) {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.throwErrorFromVoid", codec)
channel.send(null) {
callback()
}
}
/** Returns the passed object, to test serialization and deserialization. */
fun echoAllTypes(everythingArg: AllTypes, callback: (AllTypes) -> Unit) {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllTypes", codec)
channel.send(listOf(everythingArg)) {
val result = it as AllTypes
callback(result)
}
}
/** Returns the passed object, to test serialization and deserialization. */
fun echoAllNullableTypes(everythingArg: AllNullableTypes, callback: (AllNullableTypes) -> Unit) {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes", codec)
channel.send(listOf(everythingArg)) {
val result = it as AllNullableTypes
callback(result)
}
}
/**
* Returns passed in arguments of multiple types.
*
* Tests multiple-arity FlutterApi handling.
*/
fun sendMultipleNullableTypes(aNullableBoolArg: Boolean?, aNullableIntArg: Long?, aNullableStringArg: String?, callback: (AllNullableTypes) -> Unit) {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.sendMultipleNullableTypes", codec)
channel.send(listOf(aNullableBoolArg, aNullableIntArg, aNullableStringArg)) {
val result = it as AllNullableTypes
callback(result)
}
}
/** Returns the passed boolean, to test serialization and deserialization. */
fun echoBool(aBoolArg: Boolean, callback: (Boolean) -> Unit) {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoBool", codec)
channel.send(listOf(aBoolArg)) {
val result = it as Boolean
callback(result)
}
}
/** Returns the passed int, to test serialization and deserialization. */
fun echoInt(anIntArg: Long, callback: (Long) -> Unit) {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoInt", codec)
channel.send(listOf(anIntArg)) {
val result = if (it is Int) it.toLong() else it as Long
callback(result)
}
}
/** Returns the passed double, to test serialization and deserialization. */
fun echoDouble(aDoubleArg: Double, callback: (Double) -> Unit) {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoDouble", codec)
channel.send(listOf(aDoubleArg)) {
val result = it as Double
callback(result)
}
}
/** Returns the passed string, to test serialization and deserialization. */
fun echoString(aStringArg: String, callback: (String) -> Unit) {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoString", codec)
channel.send(listOf(aStringArg)) {
val result = it as String
callback(result)
}
}
/** Returns the passed byte list, to test serialization and deserialization. */
fun echoUint8List(aListArg: ByteArray, callback: (ByteArray) -> Unit) {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoUint8List", codec)
channel.send(listOf(aListArg)) {
val result = it as ByteArray
callback(result)
}
}
/** Returns the passed list, to test serialization and deserialization. */
fun echoList(aListArg: List<Any?>, callback: (List<Any?>) -> Unit) {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoList", codec)
channel.send(listOf(aListArg)) {
val result = it as List<Any?>
callback(result)
}
}
/** Returns the passed map, to test serialization and deserialization. */
fun echoMap(aMapArg: Map<String?, Any?>, callback: (Map<String?, Any?>) -> Unit) {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoMap", codec)
channel.send(listOf(aMapArg)) {
val result = it as Map<String?, Any?>
callback(result)
}
}
/** Returns the passed boolean, to test serialization and deserialization. */
fun echoNullableBool(aBoolArg: Boolean?, callback: (Boolean?) -> Unit) {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableBool", codec)
channel.send(listOf(aBoolArg)) {
val result = it as? Boolean?
callback(result)
}
}
/** Returns the passed int, to test serialization and deserialization. */
fun echoNullableInt(anIntArg: Long?, callback: (Long?) -> Unit) {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableInt", codec)
channel.send(listOf(anIntArg)) {
val result = if (it is Int) it.toLong() else it as? Long
callback(result)
}
}
/** Returns the passed double, to test serialization and deserialization. */
fun echoNullableDouble(aDoubleArg: Double?, callback: (Double?) -> Unit) {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableDouble", codec)
channel.send(listOf(aDoubleArg)) {
val result = it as? Double?
callback(result)
}
}
/** Returns the passed string, to test serialization and deserialization. */
fun echoNullableString(aStringArg: String?, callback: (String?) -> Unit) {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableString", codec)
channel.send(listOf(aStringArg)) {
val result = it as? String?
callback(result)
}
}
/** Returns the passed byte list, to test serialization and deserialization. */
fun echoNullableUint8List(aListArg: ByteArray?, callback: (ByteArray?) -> Unit) {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableUint8List", codec)
channel.send(listOf(aListArg)) {
val result = it as? ByteArray?
callback(result)
}
}
/** Returns the passed list, to test serialization and deserialization. */
fun echoNullableList(aListArg: List<Any?>?, callback: (List<Any?>?) -> Unit) {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList", codec)
channel.send(listOf(aListArg)) {
val result = it as? List<Any?>?
callback(result)
}
}
/** Returns the passed map, to test serialization and deserialization. */
fun echoNullableMap(aMapArg: Map<String?, Any?>?, callback: (Map<String?, Any?>?) -> Unit) {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap", codec)
channel.send(listOf(aMapArg)) {
val result = it as? Map<String?, Any?>?
callback(result)
}
}
/**
* A no-op function taking no arguments and returning no value, to sanity
* test basic asynchronous calling.
*/
fun noopAsync(callback: () -> Unit) {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.noopAsync", codec)
channel.send(null) {
callback()
}
}
/** Returns the passed in generic Object asynchronously. */
fun echoAsyncString(aStringArg: String, callback: (String) -> Unit) {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAsyncString", codec)
channel.send(listOf(aStringArg)) {
val result = it as String
callback(result)
}
}
}
/**
* An API that can be implemented for minimal, compile-only tests.
*
* Generated interface from Pigeon that represents a handler of messages from Flutter.
*/
interface HostTrivialApi {
fun noop()
companion object {
/** The codec used by HostTrivialApi. */
val codec: MessageCodec<Any?> by lazy {
StandardMessageCodec()
}
/** Sets up an instance of `HostTrivialApi` to handle messages through the `binaryMessenger`. */
@Suppress("UNCHECKED_CAST")
fun setUp(binaryMessenger: BinaryMessenger, api: HostTrivialApi?) {
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostTrivialApi.noop", codec)
if (api != null) {
channel.setMessageHandler { _, reply ->
var wrapped: List<Any?>
try {
api.noop()
wrapped = listOf<Any?>(null)
} catch (exception: Error) {
wrapped = wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
}
}
}
/**
* A simple API implemented in some unit tests.
*
* Generated interface from Pigeon that represents a handler of messages from Flutter.
*/
interface HostSmallApi {
fun echo(aString: String, callback: (Result<String>) -> Unit)
fun voidVoid(callback: (Result<Unit>) -> Unit)
companion object {
/** The codec used by HostSmallApi. */
val codec: MessageCodec<Any?> by lazy {
StandardMessageCodec()
}
/** Sets up an instance of `HostSmallApi` to handle messages through the `binaryMessenger`. */
@Suppress("UNCHECKED_CAST")
fun setUp(binaryMessenger: BinaryMessenger, api: HostSmallApi?) {
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostSmallApi.echo", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val aStringArg = args[0] as String
api.echo(aStringArg) { result: Result<String> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostSmallApi.voidVoid", codec)
if (api != null) {
channel.setMessageHandler { _, reply ->
api.voidVoid() { result: Result<Unit> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(wrapError(error))
} else {
reply.reply(wrapResult(null))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
}
}
}
@Suppress("UNCHECKED_CAST")
private object FlutterSmallApiCodec : StandardMessageCodec() {
override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? {
return when (type) {
128.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
TestMessage.fromList(it)
}
}
else -> super.readValueOfType(type, buffer)
}
}
override fun writeValue(stream: ByteArrayOutputStream, value: Any?) {
when (value) {
is TestMessage -> {
stream.write(128)
writeValue(stream, value.toList())
}
else -> super.writeValue(stream, value)
}
}
}
/**
* A simple API called in some unit tests.
*
* Generated class from Pigeon that represents Flutter messages that can be called from Kotlin.
*/
@Suppress("UNCHECKED_CAST")
class FlutterSmallApi(private val binaryMessenger: BinaryMessenger) {
companion object {
/** The codec used by FlutterSmallApi. */
val codec: MessageCodec<Any?> by lazy {
FlutterSmallApiCodec
}
}
fun echoWrappedList(msgArg: TestMessage, callback: (TestMessage) -> Unit) {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.FlutterSmallApi.echoWrappedList", codec)
channel.send(listOf(msgArg)) {
val result = it as TestMessage
callback(result)
}
}
}