blob: e8b25be864012d6b90f01ab862f6676af3ac58a0 [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
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import
import 'dart:async';
import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List;
import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer;
import 'package:flutter/services.dart';
enum AnEnum {
one,
two,
three,
}
class AllTypes {
AllTypes({
required this.aBool,
required this.anInt,
required this.aDouble,
required this.aByteArray,
required this.a4ByteArray,
required this.a8ByteArray,
required this.aFloatArray,
required this.aList,
required this.aMap,
required this.anEnum,
required this.aString,
});
bool aBool;
int anInt;
double aDouble;
Uint8List aByteArray;
Int32List a4ByteArray;
Int64List a8ByteArray;
Float64List aFloatArray;
List<Object?> aList;
Map<Object?, Object?> aMap;
AnEnum anEnum;
String aString;
Object encode() {
return <Object?>[
aBool,
anInt,
aDouble,
aByteArray,
a4ByteArray,
a8ByteArray,
aFloatArray,
aList,
aMap,
anEnum.index,
aString,
];
}
static AllTypes decode(Object result) {
result as List<Object?>;
return AllTypes(
aBool: result[0]! as bool,
anInt: result[1]! as int,
aDouble: result[2]! as double,
aByteArray: result[3]! as Uint8List,
a4ByteArray: result[4]! as Int32List,
a8ByteArray: result[5]! as Int64List,
aFloatArray: result[6]! as Float64List,
aList: result[7]! as List<Object?>,
aMap: result[8]! as Map<Object?, Object?>,
anEnum: AnEnum.values[result[9]! as int],
aString: result[10]! as String,
);
}
}
class AllNullableTypes {
AllNullableTypes({
this.aNullableBool,
this.aNullableInt,
this.aNullableDouble,
this.aNullableByteArray,
this.aNullable4ByteArray,
this.aNullable8ByteArray,
this.aNullableFloatArray,
this.aNullableList,
this.aNullableMap,
this.nullableNestedList,
this.nullableMapWithAnnotations,
this.nullableMapWithObject,
this.aNullableEnum,
this.aNullableString,
});
bool? aNullableBool;
int? aNullableInt;
double? aNullableDouble;
Uint8List? aNullableByteArray;
Int32List? aNullable4ByteArray;
Int64List? aNullable8ByteArray;
Float64List? aNullableFloatArray;
List<Object?>? aNullableList;
Map<Object?, Object?>? aNullableMap;
List<List<bool?>?>? nullableNestedList;
Map<String?, String?>? nullableMapWithAnnotations;
Map<String?, Object?>? nullableMapWithObject;
AnEnum? aNullableEnum;
String? aNullableString;
Object encode() {
return <Object?>[
aNullableBool,
aNullableInt,
aNullableDouble,
aNullableByteArray,
aNullable4ByteArray,
aNullable8ByteArray,
aNullableFloatArray,
aNullableList,
aNullableMap,
nullableNestedList,
nullableMapWithAnnotations,
nullableMapWithObject,
aNullableEnum?.index,
aNullableString,
];
}
static AllNullableTypes decode(Object result) {
result as List<Object?>;
return AllNullableTypes(
aNullableBool: result[0] as bool?,
aNullableInt: result[1] as int?,
aNullableDouble: result[2] as double?,
aNullableByteArray: result[3] as Uint8List?,
aNullable4ByteArray: result[4] as Int32List?,
aNullable8ByteArray: result[5] as Int64List?,
aNullableFloatArray: result[6] as Float64List?,
aNullableList: result[7] as List<Object?>?,
aNullableMap: result[8] as Map<Object?, Object?>?,
nullableNestedList: (result[9] as List<Object?>?)?.cast<List<bool?>?>(),
nullableMapWithAnnotations:
(result[10] as Map<Object?, Object?>?)?.cast<String?, String?>(),
nullableMapWithObject:
(result[11] as Map<Object?, Object?>?)?.cast<String?, Object?>(),
aNullableEnum:
result[12] != null ? AnEnum.values[result[12]! as int] : null,
aNullableString: result[13] as String?,
);
}
}
class AllNullableTypesWrapper {
AllNullableTypesWrapper({
required this.values,
});
AllNullableTypes values;
Object encode() {
return <Object?>[
values.encode(),
];
}
static AllNullableTypesWrapper decode(Object result) {
result as List<Object?>;
return AllNullableTypesWrapper(
values: AllNullableTypes.decode(result[0]! as List<Object?>),
);
}
}
/// A data class containing a List, used in unit tests.
class TestMessage {
TestMessage({
this.testList,
});
List<Object?>? testList;
Object encode() {
return <Object?>[
testList,
];
}
static TestMessage decode(Object result) {
result as List<Object?>;
return TestMessage(
testList: result[0] as List<Object?>?,
);
}
}
class _HostIntegrationCoreApiCodec extends StandardMessageCodec {
const _HostIntegrationCoreApiCodec();
@override
void writeValue(WriteBuffer buffer, Object? value) {
if (value is AllNullableTypes) {
buffer.putUint8(128);
writeValue(buffer, value.encode());
} else if (value is AllNullableTypesWrapper) {
buffer.putUint8(129);
writeValue(buffer, value.encode());
} else if (value is AllTypes) {
buffer.putUint8(130);
writeValue(buffer, value.encode());
} else if (value is TestMessage) {
buffer.putUint8(131);
writeValue(buffer, value.encode());
} else {
super.writeValue(buffer, value);
}
}
@override
Object? readValueOfType(int type, ReadBuffer buffer) {
switch (type) {
case 128:
return AllNullableTypes.decode(readValue(buffer)!);
case 129:
return AllNullableTypesWrapper.decode(readValue(buffer)!);
case 130:
return AllTypes.decode(readValue(buffer)!);
case 131:
return TestMessage.decode(readValue(buffer)!);
default:
return super.readValueOfType(type, buffer);
}
}
}
/// The core interface that each host language plugin must implement in
/// platform_test integration tests.
class HostIntegrationCoreApi {
/// Constructor for [HostIntegrationCoreApi]. The [binaryMessenger] named argument is
/// available for dependency injection. If it is left null, the default
/// BinaryMessenger will be used which routes to the host platform.
HostIntegrationCoreApi({BinaryMessenger? binaryMessenger})
: _binaryMessenger = binaryMessenger;
final BinaryMessenger? _binaryMessenger;
static const MessageCodec<Object?> codec = _HostIntegrationCoreApiCodec();
/// A no-op function taking no arguments and returning no value, to sanity
/// test basic calling.
Future<void> noop() async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.noop', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return;
}
}
/// Returns the passed object, to test serialization and deserialization.
Future<AllTypes> echoAllTypes(AllTypes arg_everything) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoAllTypes', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_everything]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else if (replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
);
} else {
return (replyList[0] as AllTypes?)!;
}
}
/// Returns an error, to test error handling.
Future<Object?> throwError() async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.throwError', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return replyList[0];
}
}
/// Responds with an error from an async void function.
Future<void> throwErrorFromVoid() async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.throwErrorFromVoid', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return;
}
}
/// Returns passed in int.
Future<int> echoInt(int arg_anInt) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoInt', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_anInt]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else if (replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
);
} else {
return (replyList[0] as int?)!;
}
}
/// Returns passed in double.
Future<double> echoDouble(double arg_aDouble) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoDouble', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aDouble]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else if (replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
);
} else {
return (replyList[0] as double?)!;
}
}
/// Returns the passed in boolean.
Future<bool> echoBool(bool arg_aBool) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoBool', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aBool]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else if (replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
);
} else {
return (replyList[0] as bool?)!;
}
}
/// Returns the passed in string.
Future<String> echoString(String arg_aString) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoString', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aString]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else if (replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
);
} else {
return (replyList[0] as String?)!;
}
}
/// Returns the passed in Uint8List.
Future<Uint8List> echoUint8List(Uint8List arg_aUint8List) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoUint8List', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aUint8List]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else if (replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
);
} else {
return (replyList[0] as Uint8List?)!;
}
}
/// Returns the passed in generic Object.
Future<Object> echoObject(Object arg_anObject) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoObject', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_anObject]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else if (replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
);
} else {
return replyList[0]!;
}
}
/// Returns the passed list, to test serialization and deserialization.
Future<List<Object?>> echoList(List<Object?> arg_aList) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoList', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aList]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else if (replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
);
} else {
return (replyList[0] as List<Object?>?)!.cast<Object?>();
}
}
/// Returns the passed map, to test serialization and deserialization.
Future<Map<String?, Object?>> echoMap(Map<String?, Object?> arg_aMap) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoMap', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aMap]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else if (replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
);
} else {
return (replyList[0] as Map<Object?, Object?>?)!.cast<String?, Object?>();
}
}
/// Returns the passed object, to test serialization and deserialization.
Future<AllNullableTypes?> echoAllNullableTypes(
AllNullableTypes? arg_everything) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoAllNullableTypes', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_everything]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return (replyList[0] as AllNullableTypes?);
}
}
/// Returns the inner `aString` value from the wrapped object, to test
/// sending of nested objects.
Future<String?> extractNestedNullableString(
AllNullableTypesWrapper arg_wrapper) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.extractNestedNullableString',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_wrapper]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return (replyList[0] as String?);
}
}
/// Returns the inner `aString` value from the wrapped object, to test
/// sending of nested objects.
Future<AllNullableTypesWrapper> createNestedNullableString(
String? arg_nullableString) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.createNestedNullableString',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_nullableString]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else if (replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
);
} else {
return (replyList[0] as AllNullableTypesWrapper?)!;
}
}
/// Returns passed in arguments of multiple types.
Future<AllNullableTypes> sendMultipleNullableTypes(bool? arg_aNullableBool,
int? arg_aNullableInt, String? arg_aNullableString) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.sendMultipleNullableTypes',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList = await channel.send(
<Object?>[arg_aNullableBool, arg_aNullableInt, arg_aNullableString])
as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else if (replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
);
} else {
return (replyList[0] as AllNullableTypes?)!;
}
}
/// Returns passed in int.
Future<int?> echoNullableInt(int? arg_aNullableInt) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableInt', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aNullableInt]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return (replyList[0] as int?);
}
}
/// Returns passed in double.
Future<double?> echoNullableDouble(double? arg_aNullableDouble) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableDouble', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aNullableDouble]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return (replyList[0] as double?);
}
}
/// Returns the passed in boolean.
Future<bool?> echoNullableBool(bool? arg_aNullableBool) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableBool', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aNullableBool]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return (replyList[0] as bool?);
}
}
/// Returns the passed in string.
Future<String?> echoNullableString(String? arg_aNullableString) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableString', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aNullableString]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return (replyList[0] as String?);
}
}
/// Returns the passed in Uint8List.
Future<Uint8List?> echoNullableUint8List(
Uint8List? arg_aNullableUint8List) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableUint8List',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aNullableUint8List]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return (replyList[0] as Uint8List?);
}
}
/// Returns the passed in generic Object.
Future<Object?> echoNullableObject(Object? arg_aNullableObject) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableObject', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aNullableObject]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return replyList[0];
}
}
/// Returns the passed list, to test serialization and deserialization.
Future<List<Object?>?> echoNullableList(
List<Object?>? arg_aNullableList) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableList', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aNullableList]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return (replyList[0] as List<Object?>?)?.cast<Object?>();
}
}
/// Returns the passed map, to test serialization and deserialization.
Future<Map<String?, Object?>?> echoNullableMap(
Map<String?, Object?>? arg_aNullableMap) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableMap', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aNullableMap]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return (replyList[0] as Map<Object?, Object?>?)?.cast<String?, Object?>();
}
}
/// A no-op function taking no arguments and returning no value, to sanity
/// test basic asynchronous calling.
Future<void> noopAsync() async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.noopAsync', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return;
}
}
/// Returns passed in int asynchronously.
Future<int> echoAsyncInt(int arg_anInt) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncInt', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_anInt]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else if (replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
);
} else {
return (replyList[0] as int?)!;
}
}
/// Returns passed in double asynchronously.
Future<double> echoAsyncDouble(double arg_aDouble) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncDouble', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aDouble]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else if (replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
);
} else {
return (replyList[0] as double?)!;
}
}
/// Returns the passed in boolean asynchronously.
Future<bool> echoAsyncBool(bool arg_aBool) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncBool', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aBool]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else if (replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
);
} else {
return (replyList[0] as bool?)!;
}
}
/// Returns the passed string asynchronously.
Future<String> echoAsyncString(String arg_aString) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncString', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aString]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else if (replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
);
} else {
return (replyList[0] as String?)!;
}
}
/// Returns the passed in Uint8List asynchronously.
Future<Uint8List> echoAsyncUint8List(Uint8List arg_aUint8List) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncUint8List', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aUint8List]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else if (replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
);
} else {
return (replyList[0] as Uint8List?)!;
}
}
/// Returns the passed in generic Object asynchronously.
Future<Object> echoAsyncObject(Object arg_anObject) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncObject', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_anObject]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else if (replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
);
} else {
return replyList[0]!;
}
}
/// Returns the passed list, to test serialization and deserialization asynchronously.
Future<List<Object?>> echoAsyncList(List<Object?> arg_aList) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncList', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aList]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else if (replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
);
} else {
return (replyList[0] as List<Object?>?)!.cast<Object?>();
}
}
/// Returns the passed map, to test serialization and deserialization asynchronously.
Future<Map<String?, Object?>> echoAsyncMap(
Map<String?, Object?> arg_aMap) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncMap', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aMap]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else if (replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
);
} else {
return (replyList[0] as Map<Object?, Object?>?)!.cast<String?, Object?>();
}
}
/// Responds with an error from an async function returning a value.
Future<Object?> throwAsyncError() async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.throwAsyncError', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return replyList[0];
}
}
/// Responds with an error from an async void function.
Future<void> throwAsyncErrorFromVoid() async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.throwAsyncErrorFromVoid',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return;
}
}
/// Returns the passed object, to test async serialization and deserialization.
Future<AllTypes> echoAsyncAllTypes(AllTypes arg_everything) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncAllTypes', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_everything]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else if (replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
);
} else {
return (replyList[0] as AllTypes?)!;
}
}
/// Returns the passed object, to test serialization and deserialization.
Future<AllNullableTypes?> echoAsyncNullableAllNullableTypes(
AllNullableTypes? arg_everything) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableAllNullableTypes',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_everything]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return (replyList[0] as AllNullableTypes?);
}
}
/// Returns passed in int asynchronously.
Future<int?> echoAsyncNullableInt(int? arg_anInt) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableInt', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_anInt]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return (replyList[0] as int?);
}
}
/// Returns passed in double asynchronously.
Future<double?> echoAsyncNullableDouble(double? arg_aDouble) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableDouble',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aDouble]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return (replyList[0] as double?);
}
}
/// Returns the passed in boolean asynchronously.
Future<bool?> echoAsyncNullableBool(bool? arg_aBool) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableBool',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aBool]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return (replyList[0] as bool?);
}
}
/// Returns the passed string asynchronously.
Future<String?> echoAsyncNullableString(String? arg_aString) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableString',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aString]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return (replyList[0] as String?);
}
}
/// Returns the passed in Uint8List asynchronously.
Future<Uint8List?> echoAsyncNullableUint8List(
Uint8List? arg_aUint8List) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableUint8List',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aUint8List]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return (replyList[0] as Uint8List?);
}
}
/// Returns the passed in generic Object asynchronously.
Future<Object?> echoAsyncNullableObject(Object? arg_anObject) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableObject',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_anObject]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return replyList[0];
}
}
/// Returns the passed list, to test serialization and deserialization asynchronously.
Future<List<Object?>?> echoAsyncNullableList(List<Object?>? arg_aList) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableList',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aList]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return (replyList[0] as List<Object?>?)?.cast<Object?>();
}
}
/// Returns the passed map, to test serialization and deserialization asynchronously.
Future<Map<String?, Object?>?> echoAsyncNullableMap(
Map<String?, Object?>? arg_aMap) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableMap', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aMap]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return (replyList[0] as Map<Object?, Object?>?)?.cast<String?, Object?>();
}
}
Future<void> callFlutterNoop() async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterNoop', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return;
}
}
Future<Object?> callFlutterThrowError() async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterThrowError',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return replyList[0];
}
}
Future<void> callFlutterThrowErrorFromVoid() async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterThrowErrorFromVoid',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return;
}
}
Future<AllTypes> callFlutterEchoAllTypes(AllTypes arg_everything) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoAllTypes',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_everything]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else if (replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
);
} else {
return (replyList[0] as AllTypes?)!;
}
}
Future<AllNullableTypes> callFlutterSendMultipleNullableTypes(
bool? arg_aNullableBool,
int? arg_aNullableInt,
String? arg_aNullableString) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterSendMultipleNullableTypes',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList = await channel.send(
<Object?>[arg_aNullableBool, arg_aNullableInt, arg_aNullableString])
as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else if (replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
);
} else {
return (replyList[0] as AllNullableTypes?)!;
}
}
Future<bool> callFlutterEchoBool(bool arg_aBool) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoBool', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aBool]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else if (replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
);
} else {
return (replyList[0] as bool?)!;
}
}
Future<int> callFlutterEchoInt(int arg_anInt) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoInt', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_anInt]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else if (replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
);
} else {
return (replyList[0] as int?)!;
}
}
Future<double> callFlutterEchoDouble(double arg_aDouble) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoDouble',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aDouble]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else if (replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
);
} else {
return (replyList[0] as double?)!;
}
}
Future<String> callFlutterEchoString(String arg_aString) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoString',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aString]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else if (replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
);
} else {
return (replyList[0] as String?)!;
}
}
Future<Uint8List> callFlutterEchoUint8List(Uint8List arg_aList) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoUint8List',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aList]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else if (replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
);
} else {
return (replyList[0] as Uint8List?)!;
}
}
Future<List<Object?>> callFlutterEchoList(List<Object?> arg_aList) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoList', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aList]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else if (replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
);
} else {
return (replyList[0] as List<Object?>?)!.cast<Object?>();
}
}
Future<Map<String?, Object?>> callFlutterEchoMap(
Map<String?, Object?> arg_aMap) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoMap', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aMap]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else if (replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
);
} else {
return (replyList[0] as Map<Object?, Object?>?)!.cast<String?, Object?>();
}
}
Future<bool?> callFlutterEchoNullableBool(bool? arg_aBool) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableBool',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aBool]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return (replyList[0] as bool?);
}
}
Future<int?> callFlutterEchoNullableInt(int? arg_anInt) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableInt',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_anInt]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return (replyList[0] as int?);
}
}
Future<double?> callFlutterEchoNullableDouble(double? arg_aDouble) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableDouble',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aDouble]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return (replyList[0] as double?);
}
}
Future<String?> callFlutterEchoNullableString(String? arg_aString) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableString',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aString]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return (replyList[0] as String?);
}
}
Future<Uint8List?> callFlutterEchoNullableUint8List(
Uint8List? arg_aList) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableUint8List',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aList]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return (replyList[0] as Uint8List?);
}
}
Future<List<Object?>?> callFlutterEchoNullableList(
List<Object?>? arg_aList) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableList',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aList]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return (replyList[0] as List<Object?>?)?.cast<Object?>();
}
}
Future<Map<String?, Object?>?> callFlutterEchoNullableMap(
Map<String?, Object?>? arg_aMap) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableMap',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aMap]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return (replyList[0] as Map<Object?, Object?>?)?.cast<String?, Object?>();
}
}
}
class _FlutterIntegrationCoreApiCodec extends StandardMessageCodec {
const _FlutterIntegrationCoreApiCodec();
@override
void writeValue(WriteBuffer buffer, Object? value) {
if (value is AllNullableTypes) {
buffer.putUint8(128);
writeValue(buffer, value.encode());
} else if (value is AllNullableTypesWrapper) {
buffer.putUint8(129);
writeValue(buffer, value.encode());
} else if (value is AllTypes) {
buffer.putUint8(130);
writeValue(buffer, value.encode());
} else if (value is TestMessage) {
buffer.putUint8(131);
writeValue(buffer, value.encode());
} else {
super.writeValue(buffer, value);
}
}
@override
Object? readValueOfType(int type, ReadBuffer buffer) {
switch (type) {
case 128:
return AllNullableTypes.decode(readValue(buffer)!);
case 129:
return AllNullableTypesWrapper.decode(readValue(buffer)!);
case 130:
return AllTypes.decode(readValue(buffer)!);
case 131:
return TestMessage.decode(readValue(buffer)!);
default:
return super.readValueOfType(type, buffer);
}
}
}
/// The core interface that the Dart platform_test code implements for host
/// integration tests to call into.
abstract class FlutterIntegrationCoreApi {
static const MessageCodec<Object?> codec = _FlutterIntegrationCoreApiCodec();
/// A no-op function taking no arguments and returning no value, to sanity
/// test basic calling.
void noop();
/// Responds with an error from an async function returning a value.
Object? throwError();
/// Responds with an error from an async void function.
void throwErrorFromVoid();
/// Returns the passed object, to test serialization and deserialization.
AllTypes echoAllTypes(AllTypes everything);
/// Returns the passed object, to test serialization and deserialization.
AllNullableTypes echoAllNullableTypes(AllNullableTypes everything);
/// Returns passed in arguments of multiple types.
///
/// Tests multiple-arity FlutterApi handling.
AllNullableTypes sendMultipleNullableTypes(
bool? aNullableBool, int? aNullableInt, String? aNullableString);
/// Returns the passed boolean, to test serialization and deserialization.
bool echoBool(bool aBool);
/// Returns the passed int, to test serialization and deserialization.
int echoInt(int anInt);
/// Returns the passed double, to test serialization and deserialization.
double echoDouble(double aDouble);
/// Returns the passed string, to test serialization and deserialization.
String echoString(String aString);
/// Returns the passed byte list, to test serialization and deserialization.
Uint8List echoUint8List(Uint8List aList);
/// Returns the passed list, to test serialization and deserialization.
List<Object?> echoList(List<Object?> aList);
/// Returns the passed map, to test serialization and deserialization.
Map<String?, Object?> echoMap(Map<String?, Object?> aMap);
/// Returns the passed boolean, to test serialization and deserialization.
bool? echoNullableBool(bool? aBool);
/// Returns the passed int, to test serialization and deserialization.
int? echoNullableInt(int? anInt);
/// Returns the passed double, to test serialization and deserialization.
double? echoNullableDouble(double? aDouble);
/// Returns the passed string, to test serialization and deserialization.
String? echoNullableString(String? aString);
/// Returns the passed byte list, to test serialization and deserialization.
Uint8List? echoNullableUint8List(Uint8List? aList);
/// Returns the passed list, to test serialization and deserialization.
List<Object?>? echoNullableList(List<Object?>? aList);
/// Returns the passed map, to test serialization and deserialization.
Map<String?, Object?>? echoNullableMap(Map<String?, Object?>? aMap);
/// A no-op function taking no arguments and returning no value, to sanity
/// test basic asynchronous calling.
Future<void> noopAsync();
/// Returns the passed in generic Object asynchronously.
Future<String> echoAsyncString(String aString);
static void setup(FlutterIntegrationCoreApi? api,
{BinaryMessenger? binaryMessenger}) {
{
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.FlutterIntegrationCoreApi.noop', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
channel.setMessageHandler(null);
} else {
channel.setMessageHandler((Object? message) async {
// ignore message
api.noop();
return;
});
}
}
{
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.FlutterIntegrationCoreApi.throwError', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
channel.setMessageHandler(null);
} else {
channel.setMessageHandler((Object? message) async {
// ignore message
final Object? output = api.throwError();
return output;
});
}
}
{
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.FlutterIntegrationCoreApi.throwErrorFromVoid',
codec,
binaryMessenger: binaryMessenger);
if (api == null) {
channel.setMessageHandler(null);
} else {
channel.setMessageHandler((Object? message) async {
// ignore message
api.throwErrorFromVoid();
return;
});
}
}
{
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllTypes', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
channel.setMessageHandler(null);
} else {
channel.setMessageHandler((Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllTypes was null.');
final List<Object?> args = (message as List<Object?>?)!;
final AllTypes? arg_everything = (args[0] as AllTypes?);
assert(arg_everything != null,
'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllTypes was null, expected non-null AllTypes.');
final AllTypes output = api.echoAllTypes(arg_everything!);
return output;
});
}
}
{
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes',
codec,
binaryMessenger: binaryMessenger);
if (api == null) {
channel.setMessageHandler(null);
} else {
channel.setMessageHandler((Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes was null.');
final List<Object?> args = (message as List<Object?>?)!;
final AllNullableTypes? arg_everything =
(args[0] as AllNullableTypes?);
assert(arg_everything != null,
'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes was null, expected non-null AllNullableTypes.');
final AllNullableTypes output =
api.echoAllNullableTypes(arg_everything!);
return output;
});
}
}
{
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.FlutterIntegrationCoreApi.sendMultipleNullableTypes',
codec,
binaryMessenger: binaryMessenger);
if (api == null) {
channel.setMessageHandler(null);
} else {
channel.setMessageHandler((Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.sendMultipleNullableTypes was null.');
final List<Object?> args = (message as List<Object?>?)!;
final bool? arg_aNullableBool = (args[0] as bool?);
final int? arg_aNullableInt = (args[1] as int?);
final String? arg_aNullableString = (args[2] as String?);
final AllNullableTypes output = api.sendMultipleNullableTypes(
arg_aNullableBool, arg_aNullableInt, arg_aNullableString);
return output;
});
}
}
{
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoBool', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
channel.setMessageHandler(null);
} else {
channel.setMessageHandler((Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoBool was null.');
final List<Object?> args = (message as List<Object?>?)!;
final bool? arg_aBool = (args[0] as bool?);
assert(arg_aBool != null,
'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoBool was null, expected non-null bool.');
final bool output = api.echoBool(arg_aBool!);
return output;
});
}
}
{
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoInt', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
channel.setMessageHandler(null);
} else {
channel.setMessageHandler((Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoInt was null.');
final List<Object?> args = (message as List<Object?>?)!;
final int? arg_anInt = (args[0] as int?);
assert(arg_anInt != null,
'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoInt was null, expected non-null int.');
final int output = api.echoInt(arg_anInt!);
return output;
});
}
}
{
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoDouble', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
channel.setMessageHandler(null);
} else {
channel.setMessageHandler((Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoDouble was null.');
final List<Object?> args = (message as List<Object?>?)!;
final double? arg_aDouble = (args[0] as double?);
assert(arg_aDouble != null,
'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoDouble was null, expected non-null double.');
final double output = api.echoDouble(arg_aDouble!);
return output;
});
}
}
{
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoString', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
channel.setMessageHandler(null);
} else {
channel.setMessageHandler((Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoString was null.');
final List<Object?> args = (message as List<Object?>?)!;
final String? arg_aString = (args[0] as String?);
assert(arg_aString != null,
'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoString was null, expected non-null String.');
final String output = api.echoString(arg_aString!);
return output;
});
}
}
{
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoUint8List', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
channel.setMessageHandler(null);
} else {
channel.setMessageHandler((Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoUint8List was null.');
final List<Object?> args = (message as List<Object?>?)!;
final Uint8List? arg_aList = (args[0] as Uint8List?);
assert(arg_aList != null,
'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoUint8List was null, expected non-null Uint8List.');
final Uint8List output = api.echoUint8List(arg_aList!);
return output;
});
}
}
{
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoList', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
channel.setMessageHandler(null);
} else {
channel.setMessageHandler((Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoList was null.');
final List<Object?> args = (message as List<Object?>?)!;
final List<Object?>? arg_aList =
(args[0] as List<Object?>?)?.cast<Object?>();
assert(arg_aList != null,
'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoList was null, expected non-null List<Object?>.');
final List<Object?> output = api.echoList(arg_aList!);
return output;
});
}
}
{
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoMap', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
channel.setMessageHandler(null);
} else {
channel.setMessageHandler((Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoMap was null.');
final List<Object?> args = (message as List<Object?>?)!;
final Map<String?, Object?>? arg_aMap =
(args[0] as Map<Object?, Object?>?)?.cast<String?, Object?>();
assert(arg_aMap != null,
'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoMap was null, expected non-null Map<String?, Object?>.');
final Map<String?, Object?> output = api.echoMap(arg_aMap!);
return output;
});
}
}
{
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableBool',
codec,
binaryMessenger: binaryMessenger);
if (api == null) {
channel.setMessageHandler(null);
} else {
channel.setMessageHandler((Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableBool was null.');
final List<Object?> args = (message as List<Object?>?)!;
final bool? arg_aBool = (args[0] as bool?);
final bool? output = api.echoNullableBool(arg_aBool);
return output;
});
}
}
{
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableInt', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
channel.setMessageHandler(null);
} else {
channel.setMessageHandler((Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableInt was null.');
final List<Object?> args = (message as List<Object?>?)!;
final int? arg_anInt = (args[0] as int?);
final int? output = api.echoNullableInt(arg_anInt);
return output;
});
}
}
{
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableDouble',
codec,
binaryMessenger: binaryMessenger);
if (api == null) {
channel.setMessageHandler(null);
} else {
channel.setMessageHandler((Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableDouble was null.');
final List<Object?> args = (message as List<Object?>?)!;
final double? arg_aDouble = (args[0] as double?);
final double? output = api.echoNullableDouble(arg_aDouble);
return output;
});
}
}
{
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableString',
codec,
binaryMessenger: binaryMessenger);
if (api == null) {
channel.setMessageHandler(null);
} else {
channel.setMessageHandler((Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableString was null.');
final List<Object?> args = (message as List<Object?>?)!;
final String? arg_aString = (args[0] as String?);
final String? output = api.echoNullableString(arg_aString);
return output;
});
}
}
{
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableUint8List',
codec,
binaryMessenger: binaryMessenger);
if (api == null) {
channel.setMessageHandler(null);
} else {
channel.setMessageHandler((Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableUint8List was null.');
final List<Object?> args = (message as List<Object?>?)!;
final Uint8List? arg_aList = (args[0] as Uint8List?);
final Uint8List? output = api.echoNullableUint8List(arg_aList);
return output;
});
}
}
{
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList',
codec,
binaryMessenger: binaryMessenger);
if (api == null) {
channel.setMessageHandler(null);
} else {
channel.setMessageHandler((Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList was null.');
final List<Object?> args = (message as List<Object?>?)!;
final List<Object?>? arg_aList =
(args[0] as List<Object?>?)?.cast<Object?>();
final List<Object?>? output = api.echoNullableList(arg_aList);
return output;
});
}
}
{
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
channel.setMessageHandler(null);
} else {
channel.setMessageHandler((Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap was null.');
final List<Object?> args = (message as List<Object?>?)!;
final Map<String?, Object?>? arg_aMap =
(args[0] as Map<Object?, Object?>?)?.cast<String?, Object?>();
final Map<String?, Object?>? output = api.echoNullableMap(arg_aMap);
return output;
});
}
}
{
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.FlutterIntegrationCoreApi.noopAsync', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
channel.setMessageHandler(null);
} else {
channel.setMessageHandler((Object? message) async {
// ignore message
await api.noopAsync();
return;
});
}
}
{
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAsyncString', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
channel.setMessageHandler(null);
} else {
channel.setMessageHandler((Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAsyncString was null.');
final List<Object?> args = (message as List<Object?>?)!;
final String? arg_aString = (args[0] as String?);
assert(arg_aString != null,
'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAsyncString was null, expected non-null String.');
final String output = await api.echoAsyncString(arg_aString!);
return output;
});
}
}
}
}
/// An API that can be implemented for minimal, compile-only tests.
class HostTrivialApi {
/// Constructor for [HostTrivialApi]. The [binaryMessenger] named argument is
/// available for dependency injection. If it is left null, the default
/// BinaryMessenger will be used which routes to the host platform.
HostTrivialApi({BinaryMessenger? binaryMessenger})
: _binaryMessenger = binaryMessenger;
final BinaryMessenger? _binaryMessenger;
static const MessageCodec<Object?> codec = StandardMessageCodec();
Future<void> noop() async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostTrivialApi.noop', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return;
}
}
}
/// A simple API implemented in some unit tests.
class HostSmallApi {
/// Constructor for [HostSmallApi]. The [binaryMessenger] named argument is
/// available for dependency injection. If it is left null, the default
/// BinaryMessenger will be used which routes to the host platform.
HostSmallApi({BinaryMessenger? binaryMessenger})
: _binaryMessenger = binaryMessenger;
final BinaryMessenger? _binaryMessenger;
static const MessageCodec<Object?> codec = StandardMessageCodec();
Future<String> echo(String arg_aString) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostSmallApi.echo', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_aString]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else if (replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
);
} else {
return (replyList[0] as String?)!;
}
}
Future<void> voidVoid() async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostSmallApi.voidVoid', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return;
}
}
}
class _FlutterSmallApiCodec extends StandardMessageCodec {
const _FlutterSmallApiCodec();
@override
void writeValue(WriteBuffer buffer, Object? value) {
if (value is TestMessage) {
buffer.putUint8(128);
writeValue(buffer, value.encode());
} else {
super.writeValue(buffer, value);
}
}
@override
Object? readValueOfType(int type, ReadBuffer buffer) {
switch (type) {
case 128:
return TestMessage.decode(readValue(buffer)!);
default:
return super.readValueOfType(type, buffer);
}
}
}
/// A simple API called in some unit tests.
abstract class FlutterSmallApi {
static const MessageCodec<Object?> codec = _FlutterSmallApiCodec();
TestMessage echoWrappedList(TestMessage msg);
static void setup(FlutterSmallApi? api, {BinaryMessenger? binaryMessenger}) {
{
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.FlutterSmallApi.echoWrappedList', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
channel.setMessageHandler(null);
} else {
channel.setMessageHandler((Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.FlutterSmallApi.echoWrappedList was null.');
final List<Object?> args = (message as List<Object?>?)!;
final TestMessage? arg_msg = (args[0] as TestMessage?);
assert(arg_msg != null,
'Argument for dev.flutter.pigeon.FlutterSmallApi.echoWrappedList was null, expected non-null TestMessage.');
final TestMessage output = api.echoWrappedList(arg_msg!);
return output;
});
}
}
}
}