[pigeon] Add Flutter API integration tests (#3066)
* Add the new wrapper APIs
* Regenerate files
* Add the new integration tests
* macOS Swift implementation
* iOS Swift implementation
* Android Kotlin implementation; some tests disabled
* Android Java implementation
* iOS Obj-C implementation
* Windows C++ implementation
diff --git a/packages/pigeon/pigeons/core_tests.dart b/packages/pigeon/pigeons/core_tests.dart
index dd3be1d..890e7d6 100644
--- a/packages/pigeon/pigeons/core_tests.dart
+++ b/packages/pigeon/pigeons/core_tests.dart
@@ -188,15 +188,75 @@
void callFlutterNoop();
@async
+ @ObjCSelector('callFlutterEchoAllTypes:')
+ AllTypes callFlutterEchoAllTypes(AllTypes everything);
+
+ // TODO(stuartmorgan): Add callFlutterEchoAllNullableTypes and the associated
+ // test once either https://github.com/flutter/flutter/issues/116117 is fixed,
+ // or the problematic type is moved out of AllNullableTypes and into its own
+ // test, since the type mismatch breaks the second `encode` round.
+
+ @async
+ @ObjCSelector('callFlutterSendMultipleNullableTypesABool:anInt:aString:')
+ AllNullableTypes callFlutterSendMultipleNullableTypes(
+ bool? aNullableBool, int? aNullableInt, String? aNullableString);
+
+ @async
+ @ObjCSelector('callFlutterEchoBool:')
+ bool callFlutterEchoBool(bool aBool);
+
+ @async
+ @ObjCSelector('callFlutterEchoInt:')
+ int callFlutterEchoInt(int anInt);
+
+ @async
+ @ObjCSelector('callFlutterEchoDouble:')
+ double callFlutterEchoDouble(double aDouble);
+
+ @async
@ObjCSelector('callFlutterEchoString:')
String callFlutterEchoString(String aString);
- // TODO(stuartmorgan): Add callFlutterEchoAllTypes and the associated test
- // once either https://github.com/flutter/flutter/issues/116117 is fixed, or
- // the problematic type is moved out of AllTypes and into its own test, since
- // the type mismatch breaks the second `encode` round.
+ @async
+ @ObjCSelector('callFlutterEchoUint8List:')
+ Uint8List callFlutterEchoUint8List(Uint8List aList);
- // TODO(stuartmorgan): Fill in the rest of the callFlutterEcho* tests.
+ @async
+ @ObjCSelector('callFlutterEchoList:')
+ List<Object?> callFlutterEchoList(List<Object?> aList);
+
+ @async
+ @ObjCSelector('callFlutterEchoMap:')
+ Map<String?, Object?> callFlutterEchoMap(Map<String?, Object?> aMap);
+
+ @async
+ @ObjCSelector('callFlutterEchoNullableBool:')
+ bool? callFlutterEchoNullableBool(bool? aBool);
+
+ @async
+ @ObjCSelector('callFlutterEchoNullableInt:')
+ int? callFlutterEchoNullableInt(int? anInt);
+
+ @async
+ @ObjCSelector('callFlutterEchoNullableDouble:')
+ double? callFlutterEchoNullableDouble(double? aDouble);
+
+ @async
+ @ObjCSelector('callFlutterEchoNullableString:')
+ String? callFlutterEchoNullableString(String? aString);
+
+ @async
+ @ObjCSelector('callFlutterEchoNullableUint8List:')
+ Uint8List? callFlutterEchoNullableUint8List(Uint8List? aList);
+
+ @async
+ @ObjCSelector('callFlutterEchoNullableList:')
+ List<Object?>? callFlutterEchoNullableList(List<Object?>? aList);
+
+ @async
+ @ObjCSelector('callFlutterEchoNullableMap:')
+ Map<String?, Object?>? callFlutterEchoNullableMap(
+ Map<String?, Object?>? aMap);
}
/// The core interface that the Dart platform_test code implements for host
@@ -280,7 +340,7 @@
/// Returns the passed map, to test serialization and deserialization.
@ObjCSelector('echoNullableMap:')
- Map<String?, Object?> echoNullableMap(Map<String?, Object?> aMap);
+ Map<String?, Object?>? echoNullableMap(Map<String?, Object?>? aMap);
}
/// An API that can be implemented for minimal, compile-only tests.
diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/AlternateLanguageTestPlugin.java b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/AlternateLanguageTestPlugin.java
index f0b1911..8adeaba 100644
--- a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/AlternateLanguageTestPlugin.java
+++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/AlternateLanguageTestPlugin.java
@@ -13,6 +13,8 @@
import com.example.alternate_language_test_plugin.CoreTests.HostIntegrationCoreApi;
import com.example.alternate_language_test_plugin.CoreTests.Result;
import io.flutter.embedding.engine.plugins.FlutterPlugin;
+import java.util.List;
+import java.util.Map;
/** This plugin handles the native side of the integration tests in example/integration_test/. */
public class AlternateLanguageTestPlugin implements FlutterPlugin, HostIntegrationCoreApi {
@@ -155,6 +157,67 @@
}
@Override
+ public void callFlutterEchoAllTypes(@NonNull AllTypes everything, Result<AllTypes> result) {
+ flutterApi.echoAllTypes(
+ everything,
+ new FlutterIntegrationCoreApi.Reply<AllTypes>() {
+ public void reply(AllTypes value) {
+ result.success(value);
+ }
+ });
+ }
+
+ @Override
+ public void callFlutterSendMultipleNullableTypes(
+ @Nullable Boolean aNullableBool,
+ @Nullable Long aNullableInt,
+ @Nullable String aNullableString,
+ Result<AllNullableTypes> result) {
+ flutterApi.sendMultipleNullableTypes(
+ aNullableBool,
+ aNullableInt,
+ aNullableString,
+ new FlutterIntegrationCoreApi.Reply<AllNullableTypes>() {
+ public void reply(AllNullableTypes value) {
+ result.success(value);
+ }
+ });
+ }
+
+ @Override
+ public void callFlutterEchoBool(@NonNull Boolean aBool, Result<Boolean> result) {
+ flutterApi.echoBool(
+ aBool,
+ new FlutterIntegrationCoreApi.Reply<Boolean>() {
+ public void reply(Boolean value) {
+ result.success(value);
+ }
+ });
+ }
+
+ @Override
+ public void callFlutterEchoInt(@NonNull Long anInt, Result<Long> result) {
+ flutterApi.echoInt(
+ anInt,
+ new FlutterIntegrationCoreApi.Reply<Long>() {
+ public void reply(Long value) {
+ result.success(value);
+ }
+ });
+ }
+
+ @Override
+ public void callFlutterEchoDouble(@NonNull Double aDouble, Result<Double> result) {
+ flutterApi.echoDouble(
+ aDouble,
+ new FlutterIntegrationCoreApi.Reply<Double>() {
+ public void reply(Double value) {
+ result.success(value);
+ }
+ });
+ }
+
+ @Override
public void callFlutterEchoString(@NonNull String aString, Result<String> result) {
flutterApi.echoString(
aString,
@@ -164,4 +227,117 @@
}
});
}
+
+ @Override
+ public void callFlutterEchoUint8List(@NonNull byte[] aList, Result<byte[]> result) {
+ flutterApi.echoUint8List(
+ aList,
+ new FlutterIntegrationCoreApi.Reply<byte[]>() {
+ public void reply(byte[] value) {
+ result.success(value);
+ }
+ });
+ }
+
+ @Override
+ public void callFlutterEchoList(@NonNull List<Object> aList, Result<List<Object>> result) {
+ flutterApi.echoList(
+ aList,
+ new FlutterIntegrationCoreApi.Reply<List<Object>>() {
+ public void reply(List<Object> value) {
+ result.success(value);
+ }
+ });
+ }
+
+ @Override
+ public void callFlutterEchoMap(
+ @NonNull Map<String, Object> aMap, Result<Map<String, Object>> result) {
+ flutterApi.echoMap(
+ aMap,
+ new FlutterIntegrationCoreApi.Reply<Map<String, Object>>() {
+ public void reply(Map<String, Object> value) {
+ result.success(value);
+ }
+ });
+ }
+
+ @Override
+ public void callFlutterEchoNullableBool(@Nullable Boolean aBool, Result<Boolean> result) {
+ flutterApi.echoNullableBool(
+ aBool,
+ new FlutterIntegrationCoreApi.Reply<Boolean>() {
+ public void reply(Boolean value) {
+ result.success(value);
+ }
+ });
+ }
+
+ @Override
+ public void callFlutterEchoNullableInt(@Nullable Long anInt, Result<Long> result) {
+ flutterApi.echoNullableInt(
+ anInt,
+ new FlutterIntegrationCoreApi.Reply<Long>() {
+ public void reply(Long value) {
+ result.success(value);
+ }
+ });
+ }
+
+ @Override
+ public void callFlutterEchoNullableDouble(@Nullable Double aDouble, Result<Double> result) {
+ flutterApi.echoNullableDouble(
+ aDouble,
+ new FlutterIntegrationCoreApi.Reply<Double>() {
+ public void reply(Double value) {
+ result.success(value);
+ }
+ });
+ }
+
+ @Override
+ public void callFlutterEchoNullableString(@Nullable String aString, Result<String> result) {
+ flutterApi.echoNullableString(
+ aString,
+ new FlutterIntegrationCoreApi.Reply<String>() {
+ public void reply(String value) {
+ result.success(value);
+ }
+ });
+ }
+
+ @Override
+ public void callFlutterEchoNullableUint8List(@Nullable byte[] aList, Result<byte[]> result) {
+ flutterApi.echoNullableUint8List(
+ aList,
+ new FlutterIntegrationCoreApi.Reply<byte[]>() {
+ public void reply(byte[] value) {
+ result.success(value);
+ }
+ });
+ }
+
+ @Override
+ public void callFlutterEchoNullableList(
+ @Nullable List<Object> aList, Result<List<Object>> result) {
+ flutterApi.echoNullableList(
+ aList,
+ new FlutterIntegrationCoreApi.Reply<List<Object>>() {
+ public void reply(List<Object> value) {
+ result.success(value);
+ }
+ });
+ }
+
+ @Override
+ public void callFlutterEchoNullableMap(
+ @Nullable Map<String, Object> aMap, Result<Map<String, Object>> result) {
+ flutterApi.echoNullableMap(
+ aMap,
+ new FlutterIntegrationCoreApi.Reply<Map<String, Object>>() {
+ public void reply(Map<String, Object> value) {
+ result.success(value);
+ }
+ });
+ }
}
diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java
index 9c0ef12..487a2b6 100644
--- a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java
+++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java
@@ -831,8 +831,43 @@
void callFlutterNoop(Result<Void> result);
+ void callFlutterEchoAllTypes(@NonNull AllTypes everything, Result<AllTypes> result);
+
+ void callFlutterSendMultipleNullableTypes(
+ @Nullable Boolean aNullableBool,
+ @Nullable Long aNullableInt,
+ @Nullable String aNullableString,
+ Result<AllNullableTypes> result);
+
+ void callFlutterEchoBool(@NonNull Boolean aBool, Result<Boolean> result);
+
+ void callFlutterEchoInt(@NonNull Long anInt, Result<Long> result);
+
+ void callFlutterEchoDouble(@NonNull Double aDouble, Result<Double> result);
+
void callFlutterEchoString(@NonNull String aString, Result<String> result);
+ void callFlutterEchoUint8List(@NonNull byte[] aList, Result<byte[]> result);
+
+ void callFlutterEchoList(@NonNull List<Object> aList, Result<List<Object>> result);
+
+ void callFlutterEchoMap(@NonNull Map<String, Object> aMap, Result<Map<String, Object>> result);
+
+ void callFlutterEchoNullableBool(@Nullable Boolean aBool, Result<Boolean> result);
+
+ void callFlutterEchoNullableInt(@Nullable Long anInt, Result<Long> result);
+
+ void callFlutterEchoNullableDouble(@Nullable Double aDouble, Result<Double> result);
+
+ void callFlutterEchoNullableString(@Nullable String aString, Result<String> result);
+
+ void callFlutterEchoNullableUint8List(@Nullable byte[] aList, Result<byte[]> result);
+
+ void callFlutterEchoNullableList(@Nullable List<Object> aList, Result<List<Object>> result);
+
+ void callFlutterEchoNullableMap(
+ @Nullable Map<String, Object> aMap, Result<Map<String, Object>> result);
+
/** The codec used by HostIntegrationCoreApi. */
static MessageCodec<Object> getCodec() {
return HostIntegrationCoreApiCodec.INSTANCE;
@@ -1467,6 +1502,210 @@
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
binaryMessenger,
+ "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoAllTypes",
+ getCodec());
+ if (api != null) {
+ channel.setMessageHandler(
+ (message, reply) -> {
+ ArrayList wrapped = new ArrayList<>();
+ try {
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ assert args != null;
+ AllTypes everythingArg = (AllTypes) args.get(0);
+ if (everythingArg == null) {
+ throw new NullPointerException("everythingArg unexpectedly null.");
+ }
+ Result<AllTypes> resultCallback =
+ new Result<AllTypes>() {
+ public void success(AllTypes result) {
+ wrapped.add(0, result);
+ reply.reply(wrapped);
+ }
+
+ public void error(Throwable error) {
+ ArrayList<Object> wrappedError = wrapError(error);
+ reply.reply(wrappedError);
+ }
+ };
+
+ api.callFlutterEchoAllTypes(everythingArg, resultCallback);
+ } catch (Error | RuntimeException exception) {
+ ArrayList<Object> wrappedError = wrapError(exception);
+ reply.reply(wrappedError);
+ }
+ });
+ } else {
+ channel.setMessageHandler(null);
+ }
+ }
+ {
+ BasicMessageChannel<Object> channel =
+ new BasicMessageChannel<>(
+ binaryMessenger,
+ "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterSendMultipleNullableTypes",
+ getCodec());
+ if (api != null) {
+ channel.setMessageHandler(
+ (message, reply) -> {
+ ArrayList wrapped = new ArrayList<>();
+ try {
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ assert args != null;
+ Boolean aNullableBoolArg = (Boolean) args.get(0);
+ Number aNullableIntArg = (Number) args.get(1);
+ String aNullableStringArg = (String) args.get(2);
+ Result<AllNullableTypes> resultCallback =
+ new Result<AllNullableTypes>() {
+ public void success(AllNullableTypes result) {
+ wrapped.add(0, result);
+ reply.reply(wrapped);
+ }
+
+ public void error(Throwable error) {
+ ArrayList<Object> wrappedError = wrapError(error);
+ reply.reply(wrappedError);
+ }
+ };
+
+ api.callFlutterSendMultipleNullableTypes(
+ aNullableBoolArg,
+ (aNullableIntArg == null) ? null : aNullableIntArg.longValue(),
+ aNullableStringArg,
+ resultCallback);
+ } catch (Error | RuntimeException exception) {
+ ArrayList<Object> wrappedError = wrapError(exception);
+ reply.reply(wrappedError);
+ }
+ });
+ } else {
+ channel.setMessageHandler(null);
+ }
+ }
+ {
+ BasicMessageChannel<Object> channel =
+ new BasicMessageChannel<>(
+ binaryMessenger,
+ "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoBool",
+ getCodec());
+ if (api != null) {
+ channel.setMessageHandler(
+ (message, reply) -> {
+ ArrayList wrapped = new ArrayList<>();
+ try {
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ assert args != null;
+ Boolean aBoolArg = (Boolean) args.get(0);
+ if (aBoolArg == null) {
+ throw new NullPointerException("aBoolArg unexpectedly null.");
+ }
+ Result<Boolean> resultCallback =
+ new Result<Boolean>() {
+ public void success(Boolean result) {
+ wrapped.add(0, result);
+ reply.reply(wrapped);
+ }
+
+ public void error(Throwable error) {
+ ArrayList<Object> wrappedError = wrapError(error);
+ reply.reply(wrappedError);
+ }
+ };
+
+ api.callFlutterEchoBool(aBoolArg, resultCallback);
+ } catch (Error | RuntimeException exception) {
+ ArrayList<Object> wrappedError = wrapError(exception);
+ reply.reply(wrappedError);
+ }
+ });
+ } else {
+ channel.setMessageHandler(null);
+ }
+ }
+ {
+ BasicMessageChannel<Object> channel =
+ new BasicMessageChannel<>(
+ binaryMessenger,
+ "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoInt",
+ getCodec());
+ if (api != null) {
+ channel.setMessageHandler(
+ (message, reply) -> {
+ ArrayList wrapped = new ArrayList<>();
+ try {
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ assert args != null;
+ Number anIntArg = (Number) args.get(0);
+ if (anIntArg == null) {
+ throw new NullPointerException("anIntArg unexpectedly null.");
+ }
+ Result<Long> resultCallback =
+ new Result<Long>() {
+ public void success(Long result) {
+ wrapped.add(0, result);
+ reply.reply(wrapped);
+ }
+
+ public void error(Throwable error) {
+ ArrayList<Object> wrappedError = wrapError(error);
+ reply.reply(wrappedError);
+ }
+ };
+
+ api.callFlutterEchoInt(
+ (anIntArg == null) ? null : anIntArg.longValue(), resultCallback);
+ } catch (Error | RuntimeException exception) {
+ ArrayList<Object> wrappedError = wrapError(exception);
+ reply.reply(wrappedError);
+ }
+ });
+ } else {
+ channel.setMessageHandler(null);
+ }
+ }
+ {
+ BasicMessageChannel<Object> channel =
+ new BasicMessageChannel<>(
+ binaryMessenger,
+ "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoDouble",
+ getCodec());
+ if (api != null) {
+ channel.setMessageHandler(
+ (message, reply) -> {
+ ArrayList wrapped = new ArrayList<>();
+ try {
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ assert args != null;
+ Double aDoubleArg = (Double) args.get(0);
+ if (aDoubleArg == null) {
+ throw new NullPointerException("aDoubleArg unexpectedly null.");
+ }
+ Result<Double> resultCallback =
+ new Result<Double>() {
+ public void success(Double result) {
+ wrapped.add(0, result);
+ reply.reply(wrapped);
+ }
+
+ public void error(Throwable error) {
+ ArrayList<Object> wrappedError = wrapError(error);
+ reply.reply(wrappedError);
+ }
+ };
+
+ api.callFlutterEchoDouble(aDoubleArg, resultCallback);
+ } catch (Error | RuntimeException exception) {
+ ArrayList<Object> wrappedError = wrapError(exception);
+ reply.reply(wrappedError);
+ }
+ });
+ } else {
+ channel.setMessageHandler(null);
+ }
+ }
+ {
+ BasicMessageChannel<Object> channel =
+ new BasicMessageChannel<>(
+ binaryMessenger,
"dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoString",
getCodec());
if (api != null) {
@@ -1503,6 +1742,386 @@
channel.setMessageHandler(null);
}
}
+ {
+ BasicMessageChannel<Object> channel =
+ new BasicMessageChannel<>(
+ binaryMessenger,
+ "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoUint8List",
+ getCodec());
+ if (api != null) {
+ channel.setMessageHandler(
+ (message, reply) -> {
+ ArrayList wrapped = new ArrayList<>();
+ try {
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ assert args != null;
+ byte[] aListArg = (byte[]) args.get(0);
+ if (aListArg == null) {
+ throw new NullPointerException("aListArg unexpectedly null.");
+ }
+ Result<byte[]> resultCallback =
+ new Result<byte[]>() {
+ public void success(byte[] result) {
+ wrapped.add(0, result);
+ reply.reply(wrapped);
+ }
+
+ public void error(Throwable error) {
+ ArrayList<Object> wrappedError = wrapError(error);
+ reply.reply(wrappedError);
+ }
+ };
+
+ api.callFlutterEchoUint8List(aListArg, resultCallback);
+ } catch (Error | RuntimeException exception) {
+ ArrayList<Object> wrappedError = wrapError(exception);
+ reply.reply(wrappedError);
+ }
+ });
+ } else {
+ channel.setMessageHandler(null);
+ }
+ }
+ {
+ BasicMessageChannel<Object> channel =
+ new BasicMessageChannel<>(
+ binaryMessenger,
+ "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoList",
+ getCodec());
+ if (api != null) {
+ channel.setMessageHandler(
+ (message, reply) -> {
+ ArrayList wrapped = new ArrayList<>();
+ try {
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ assert args != null;
+ List<Object> aListArg = (List<Object>) args.get(0);
+ if (aListArg == null) {
+ throw new NullPointerException("aListArg unexpectedly null.");
+ }
+ Result<List<Object>> resultCallback =
+ new Result<List<Object>>() {
+ public void success(List<Object> result) {
+ wrapped.add(0, result);
+ reply.reply(wrapped);
+ }
+
+ public void error(Throwable error) {
+ ArrayList<Object> wrappedError = wrapError(error);
+ reply.reply(wrappedError);
+ }
+ };
+
+ api.callFlutterEchoList(aListArg, resultCallback);
+ } catch (Error | RuntimeException exception) {
+ ArrayList<Object> wrappedError = wrapError(exception);
+ reply.reply(wrappedError);
+ }
+ });
+ } else {
+ channel.setMessageHandler(null);
+ }
+ }
+ {
+ BasicMessageChannel<Object> channel =
+ new BasicMessageChannel<>(
+ binaryMessenger,
+ "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoMap",
+ getCodec());
+ if (api != null) {
+ channel.setMessageHandler(
+ (message, reply) -> {
+ ArrayList wrapped = new ArrayList<>();
+ try {
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ assert args != null;
+ Map<String, Object> aMapArg = (Map<String, Object>) args.get(0);
+ if (aMapArg == null) {
+ throw new NullPointerException("aMapArg unexpectedly null.");
+ }
+ Result<Map<String, Object>> resultCallback =
+ new Result<Map<String, Object>>() {
+ public void success(Map<String, Object> result) {
+ wrapped.add(0, result);
+ reply.reply(wrapped);
+ }
+
+ public void error(Throwable error) {
+ ArrayList<Object> wrappedError = wrapError(error);
+ reply.reply(wrappedError);
+ }
+ };
+
+ api.callFlutterEchoMap(aMapArg, resultCallback);
+ } catch (Error | RuntimeException exception) {
+ ArrayList<Object> wrappedError = wrapError(exception);
+ reply.reply(wrappedError);
+ }
+ });
+ } else {
+ channel.setMessageHandler(null);
+ }
+ }
+ {
+ BasicMessageChannel<Object> channel =
+ new BasicMessageChannel<>(
+ binaryMessenger,
+ "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableBool",
+ getCodec());
+ if (api != null) {
+ channel.setMessageHandler(
+ (message, reply) -> {
+ ArrayList wrapped = new ArrayList<>();
+ try {
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ assert args != null;
+ Boolean aBoolArg = (Boolean) args.get(0);
+ Result<Boolean> resultCallback =
+ new Result<Boolean>() {
+ public void success(Boolean result) {
+ wrapped.add(0, result);
+ reply.reply(wrapped);
+ }
+
+ public void error(Throwable error) {
+ ArrayList<Object> wrappedError = wrapError(error);
+ reply.reply(wrappedError);
+ }
+ };
+
+ api.callFlutterEchoNullableBool(aBoolArg, resultCallback);
+ } catch (Error | RuntimeException exception) {
+ ArrayList<Object> wrappedError = wrapError(exception);
+ reply.reply(wrappedError);
+ }
+ });
+ } else {
+ channel.setMessageHandler(null);
+ }
+ }
+ {
+ BasicMessageChannel<Object> channel =
+ new BasicMessageChannel<>(
+ binaryMessenger,
+ "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableInt",
+ getCodec());
+ if (api != null) {
+ channel.setMessageHandler(
+ (message, reply) -> {
+ ArrayList wrapped = new ArrayList<>();
+ try {
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ assert args != null;
+ Number anIntArg = (Number) args.get(0);
+ Result<Long> resultCallback =
+ new Result<Long>() {
+ public void success(Long result) {
+ wrapped.add(0, result);
+ reply.reply(wrapped);
+ }
+
+ public void error(Throwable error) {
+ ArrayList<Object> wrappedError = wrapError(error);
+ reply.reply(wrappedError);
+ }
+ };
+
+ api.callFlutterEchoNullableInt(
+ (anIntArg == null) ? null : anIntArg.longValue(), resultCallback);
+ } catch (Error | RuntimeException exception) {
+ ArrayList<Object> wrappedError = wrapError(exception);
+ reply.reply(wrappedError);
+ }
+ });
+ } else {
+ channel.setMessageHandler(null);
+ }
+ }
+ {
+ BasicMessageChannel<Object> channel =
+ new BasicMessageChannel<>(
+ binaryMessenger,
+ "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableDouble",
+ getCodec());
+ if (api != null) {
+ channel.setMessageHandler(
+ (message, reply) -> {
+ ArrayList wrapped = new ArrayList<>();
+ try {
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ assert args != null;
+ Double aDoubleArg = (Double) args.get(0);
+ Result<Double> resultCallback =
+ new Result<Double>() {
+ public void success(Double result) {
+ wrapped.add(0, result);
+ reply.reply(wrapped);
+ }
+
+ public void error(Throwable error) {
+ ArrayList<Object> wrappedError = wrapError(error);
+ reply.reply(wrappedError);
+ }
+ };
+
+ api.callFlutterEchoNullableDouble(aDoubleArg, resultCallback);
+ } catch (Error | RuntimeException exception) {
+ ArrayList<Object> wrappedError = wrapError(exception);
+ reply.reply(wrappedError);
+ }
+ });
+ } else {
+ channel.setMessageHandler(null);
+ }
+ }
+ {
+ BasicMessageChannel<Object> channel =
+ new BasicMessageChannel<>(
+ binaryMessenger,
+ "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableString",
+ getCodec());
+ if (api != null) {
+ channel.setMessageHandler(
+ (message, reply) -> {
+ ArrayList wrapped = new ArrayList<>();
+ try {
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ assert args != null;
+ String aStringArg = (String) args.get(0);
+ Result<String> resultCallback =
+ new Result<String>() {
+ public void success(String result) {
+ wrapped.add(0, result);
+ reply.reply(wrapped);
+ }
+
+ public void error(Throwable error) {
+ ArrayList<Object> wrappedError = wrapError(error);
+ reply.reply(wrappedError);
+ }
+ };
+
+ api.callFlutterEchoNullableString(aStringArg, resultCallback);
+ } catch (Error | RuntimeException exception) {
+ ArrayList<Object> wrappedError = wrapError(exception);
+ reply.reply(wrappedError);
+ }
+ });
+ } else {
+ channel.setMessageHandler(null);
+ }
+ }
+ {
+ BasicMessageChannel<Object> channel =
+ new BasicMessageChannel<>(
+ binaryMessenger,
+ "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableUint8List",
+ getCodec());
+ if (api != null) {
+ channel.setMessageHandler(
+ (message, reply) -> {
+ ArrayList wrapped = new ArrayList<>();
+ try {
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ assert args != null;
+ byte[] aListArg = (byte[]) args.get(0);
+ Result<byte[]> resultCallback =
+ new Result<byte[]>() {
+ public void success(byte[] result) {
+ wrapped.add(0, result);
+ reply.reply(wrapped);
+ }
+
+ public void error(Throwable error) {
+ ArrayList<Object> wrappedError = wrapError(error);
+ reply.reply(wrappedError);
+ }
+ };
+
+ api.callFlutterEchoNullableUint8List(aListArg, resultCallback);
+ } catch (Error | RuntimeException exception) {
+ ArrayList<Object> wrappedError = wrapError(exception);
+ reply.reply(wrappedError);
+ }
+ });
+ } else {
+ channel.setMessageHandler(null);
+ }
+ }
+ {
+ BasicMessageChannel<Object> channel =
+ new BasicMessageChannel<>(
+ binaryMessenger,
+ "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableList",
+ getCodec());
+ if (api != null) {
+ channel.setMessageHandler(
+ (message, reply) -> {
+ ArrayList wrapped = new ArrayList<>();
+ try {
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ assert args != null;
+ List<Object> aListArg = (List<Object>) args.get(0);
+ Result<List<Object>> resultCallback =
+ new Result<List<Object>>() {
+ public void success(List<Object> result) {
+ wrapped.add(0, result);
+ reply.reply(wrapped);
+ }
+
+ public void error(Throwable error) {
+ ArrayList<Object> wrappedError = wrapError(error);
+ reply.reply(wrappedError);
+ }
+ };
+
+ api.callFlutterEchoNullableList(aListArg, resultCallback);
+ } catch (Error | RuntimeException exception) {
+ ArrayList<Object> wrappedError = wrapError(exception);
+ reply.reply(wrappedError);
+ }
+ });
+ } else {
+ channel.setMessageHandler(null);
+ }
+ }
+ {
+ BasicMessageChannel<Object> channel =
+ new BasicMessageChannel<>(
+ binaryMessenger,
+ "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableMap",
+ getCodec());
+ if (api != null) {
+ channel.setMessageHandler(
+ (message, reply) -> {
+ ArrayList wrapped = new ArrayList<>();
+ try {
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ assert args != null;
+ Map<String, Object> aMapArg = (Map<String, Object>) args.get(0);
+ Result<Map<String, Object>> resultCallback =
+ new Result<Map<String, Object>>() {
+ public void success(Map<String, Object> result) {
+ wrapped.add(0, result);
+ reply.reply(wrapped);
+ }
+
+ public void error(Throwable error) {
+ ArrayList<Object> wrappedError = wrapError(error);
+ reply.reply(wrappedError);
+ }
+ };
+
+ api.callFlutterEchoNullableMap(aMapArg, resultCallback);
+ } catch (Error | RuntimeException exception) {
+ ArrayList<Object> wrappedError = wrapError(exception);
+ reply.reply(wrappedError);
+ }
+ });
+ } else {
+ channel.setMessageHandler(null);
+ }
+ }
}
}
@@ -1823,7 +2442,7 @@
}
/** Returns the passed map, to test serialization and deserialization. */
public void echoNullableMap(
- @NonNull Map<String, Object> aMapArg, Reply<Map<String, Object>> callback) {
+ @Nullable Map<String, Object> aMapArg, Reply<Map<String, Object>> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
binaryMessenger,
diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/AlternateLanguageTestPlugin.m b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/AlternateLanguageTestPlugin.m
index e81590f..22cfcc1 100644
--- a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/AlternateLanguageTestPlugin.m
+++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/AlternateLanguageTestPlugin.m
@@ -138,6 +138,51 @@
}];
}
+- (void)callFlutterEchoAllTypes:(AllTypes *)everything
+ completion:(void (^)(AllTypes *_Nullable, FlutterError *_Nullable))completion {
+ [self.flutterAPI echoAllTypes:everything
+ completion:^(AllTypes *value, NSError *error) {
+ completion(value, error);
+ }];
+}
+
+- (void)callFlutterSendMultipleNullableTypesABool:(nullable NSNumber *)aNullableBool
+ anInt:(nullable NSNumber *)aNullableInt
+ aString:(nullable NSString *)aNullableString
+ completion:(void (^)(AllNullableTypes *_Nullable,
+ FlutterError *_Nullable))completion {
+ [self.flutterAPI sendMultipleNullableTypesABool:aNullableBool
+ anInt:aNullableInt
+ aString:aNullableString
+ completion:^(AllNullableTypes *value, NSError *error) {
+ completion(value, error);
+ }];
+}
+
+- (void)callFlutterEchoBool:(NSNumber *)aBool
+ completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion {
+ [self.flutterAPI echoBool:aBool
+ completion:^(NSNumber *value, NSError *error) {
+ completion(value, error);
+ }];
+}
+
+- (void)callFlutterEchoInt:(NSNumber *)anInt
+ completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion {
+ [self.flutterAPI echoInt:anInt
+ completion:^(NSNumber *value, NSError *error) {
+ completion(value, error);
+ }];
+}
+
+- (void)callFlutterEchoDouble:(NSNumber *)aDouble
+ completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion {
+ [self.flutterAPI echoDouble:aDouble
+ completion:^(NSNumber *value, NSError *error) {
+ completion(value, error);
+ }];
+}
+
- (void)callFlutterEchoString:(NSString *)aString
completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion {
[self.flutterAPI echoString:aString
@@ -146,4 +191,93 @@
}];
}
+- (void)callFlutterEchoUint8List:(FlutterStandardTypedData *)aList
+ completion:(void (^)(FlutterStandardTypedData *_Nullable,
+ FlutterError *_Nullable))completion {
+ [self.flutterAPI echoUint8List:aList
+ completion:^(FlutterStandardTypedData *value, NSError *error) {
+ completion(value, error);
+ }];
+}
+
+- (void)callFlutterEchoList:(NSArray<id> *)aList
+ completion:(void (^)(NSArray<id> *_Nullable, FlutterError *_Nullable))completion {
+ [self.flutterAPI echoList:aList
+ completion:^(NSArray<id> *value, NSError *error) {
+ completion(value, error);
+ }];
+}
+
+- (void)callFlutterEchoMap:(NSDictionary<NSString *, id> *)aMap
+ completion:(void (^)(NSDictionary<NSString *, id> *_Nullable,
+ FlutterError *_Nullable))completion {
+ [self.flutterAPI echoMap:aMap
+ completion:^(NSDictionary<NSString *, id> *value, NSError *error) {
+ completion(value, error);
+ }];
+}
+
+- (void)callFlutterEchoNullableBool:(nullable NSNumber *)aBool
+ completion:
+ (void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion {
+ [self.flutterAPI echoNullableBool:aBool
+ completion:^(NSNumber *value, NSError *error) {
+ completion(value, error);
+ }];
+}
+
+- (void)callFlutterEchoNullableInt:(nullable NSNumber *)anInt
+ completion:
+ (void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion {
+ [self.flutterAPI echoNullableInt:anInt
+ completion:^(NSNumber *value, NSError *error) {
+ completion(value, error);
+ }];
+}
+
+- (void)callFlutterEchoNullableDouble:(nullable NSNumber *)aDouble
+ completion:
+ (void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion {
+ [self.flutterAPI echoNullableDouble:aDouble
+ completion:^(NSNumber *value, NSError *error) {
+ completion(value, error);
+ }];
+}
+
+- (void)callFlutterEchoNullableString:(nullable NSString *)aString
+ completion:
+ (void (^)(NSString *_Nullable, FlutterError *_Nullable))completion {
+ [self.flutterAPI echoNullableString:aString
+ completion:^(NSString *value, NSError *error) {
+ completion(value, error);
+ }];
+}
+
+- (void)callFlutterEchoNullableUint8List:(nullable FlutterStandardTypedData *)aList
+ completion:(void (^)(FlutterStandardTypedData *_Nullable,
+ FlutterError *_Nullable))completion {
+ [self.flutterAPI echoNullableUint8List:aList
+ completion:^(FlutterStandardTypedData *value, NSError *error) {
+ completion(value, error);
+ }];
+}
+
+- (void)callFlutterEchoNullableList:(nullable NSArray<id> *)aList
+ completion:
+ (void (^)(NSArray<id> *_Nullable, FlutterError *_Nullable))completion {
+ [self.flutterAPI echoNullableList:aList
+ completion:^(NSArray<id> *value, NSError *error) {
+ completion(value, error);
+ }];
+}
+
+- (void)callFlutterEchoNullableMap:(nullable NSDictionary<NSString *, id> *)aMap
+ completion:(void (^)(NSDictionary<NSString *, id> *_Nullable,
+ FlutterError *_Nullable))completion {
+ [self.flutterAPI echoNullableMap:aMap
+ completion:^(NSDictionary<NSString *, id> *value, NSError *error) {
+ completion(value, error);
+ }];
+}
+
@end
diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h
index 84b7e3c..2dee9bc 100644
--- a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h
+++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h
@@ -182,8 +182,50 @@
- (void)echoAsyncString:(NSString *)aString
completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion;
- (void)callFlutterNoopWithCompletion:(void (^)(FlutterError *_Nullable))completion;
+- (void)callFlutterEchoAllTypes:(AllTypes *)everything
+ completion:(void (^)(AllTypes *_Nullable, FlutterError *_Nullable))completion;
+- (void)callFlutterSendMultipleNullableTypesABool:(nullable NSNumber *)aNullableBool
+ anInt:(nullable NSNumber *)aNullableInt
+ aString:(nullable NSString *)aNullableString
+ completion:(void (^)(AllNullableTypes *_Nullable,
+ FlutterError *_Nullable))completion;
+- (void)callFlutterEchoBool:(NSNumber *)aBool
+ completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion;
+- (void)callFlutterEchoInt:(NSNumber *)anInt
+ completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion;
+- (void)callFlutterEchoDouble:(NSNumber *)aDouble
+ completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion;
- (void)callFlutterEchoString:(NSString *)aString
completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion;
+- (void)callFlutterEchoUint8List:(FlutterStandardTypedData *)aList
+ completion:(void (^)(FlutterStandardTypedData *_Nullable,
+ FlutterError *_Nullable))completion;
+- (void)callFlutterEchoList:(NSArray<id> *)aList
+ completion:(void (^)(NSArray<id> *_Nullable, FlutterError *_Nullable))completion;
+- (void)callFlutterEchoMap:(NSDictionary<NSString *, id> *)aMap
+ completion:(void (^)(NSDictionary<NSString *, id> *_Nullable,
+ FlutterError *_Nullable))completion;
+- (void)callFlutterEchoNullableBool:(nullable NSNumber *)aBool
+ completion:
+ (void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion;
+- (void)callFlutterEchoNullableInt:(nullable NSNumber *)anInt
+ completion:
+ (void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion;
+- (void)callFlutterEchoNullableDouble:(nullable NSNumber *)aDouble
+ completion:
+ (void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion;
+- (void)callFlutterEchoNullableString:(nullable NSString *)aString
+ completion:
+ (void (^)(NSString *_Nullable, FlutterError *_Nullable))completion;
+- (void)callFlutterEchoNullableUint8List:(nullable FlutterStandardTypedData *)aList
+ completion:(void (^)(FlutterStandardTypedData *_Nullable,
+ FlutterError *_Nullable))completion;
+- (void)callFlutterEchoNullableList:(nullable NSArray<id> *)aList
+ completion:
+ (void (^)(NSArray<id> *_Nullable, FlutterError *_Nullable))completion;
+- (void)callFlutterEchoNullableMap:(nullable NSDictionary<NSString *, id> *)aMap
+ completion:(void (^)(NSDictionary<NSString *, id> *_Nullable,
+ FlutterError *_Nullable))completion;
@end
extern void HostIntegrationCoreApiSetup(id<FlutterBinaryMessenger> binaryMessenger,
@@ -254,7 +296,7 @@
- (void)echoNullableList:(nullable NSArray<id> *)aList
completion:(void (^)(NSArray<id> *_Nullable, NSError *_Nullable))completion;
/// Returns the passed map, to test serialization and deserialization.
-- (void)echoNullableMap:(NSDictionary<NSString *, id> *)aMap
+- (void)echoNullableMap:(nullable NSDictionary<NSString *, id> *)aMap
completion:
(void (^)(NSDictionary<NSString *, id> *_Nullable, NSError *_Nullable))completion;
@end
diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m
index e7e136e..4b285ad 100644
--- a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m
+++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m
@@ -761,6 +761,123 @@
}
{
FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc]
+ initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoAllTypes"
+ binaryMessenger:binaryMessenger
+ codec:HostIntegrationCoreApiGetCodec()];
+ if (api) {
+ NSCAssert([api respondsToSelector:@selector(callFlutterEchoAllTypes:completion:)],
+ @"HostIntegrationCoreApi api (%@) doesn't respond to "
+ @"@selector(callFlutterEchoAllTypes:completion:)",
+ api);
+ [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
+ NSArray *args = message;
+ AllTypes *arg_everything = GetNullableObjectAtIndex(args, 0);
+ [api callFlutterEchoAllTypes:arg_everything
+ completion:^(AllTypes *_Nullable output, FlutterError *_Nullable error) {
+ callback(wrapResult(output, error));
+ }];
+ }];
+ } else {
+ [channel setMessageHandler:nil];
+ }
+ }
+ {
+ FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc]
+ initWithName:
+ @"dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterSendMultipleNullableTypes"
+ binaryMessenger:binaryMessenger
+ codec:HostIntegrationCoreApiGetCodec()];
+ if (api) {
+ NSCAssert([api respondsToSelector:@selector
+ (callFlutterSendMultipleNullableTypesABool:anInt:aString:completion:)],
+ @"HostIntegrationCoreApi api (%@) doesn't respond to "
+ @"@selector(callFlutterSendMultipleNullableTypesABool:anInt:aString:completion:)",
+ api);
+ [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
+ NSArray *args = message;
+ NSNumber *arg_aNullableBool = GetNullableObjectAtIndex(args, 0);
+ NSNumber *arg_aNullableInt = GetNullableObjectAtIndex(args, 1);
+ NSString *arg_aNullableString = GetNullableObjectAtIndex(args, 2);
+ [api callFlutterSendMultipleNullableTypesABool:arg_aNullableBool
+ anInt:arg_aNullableInt
+ aString:arg_aNullableString
+ completion:^(AllNullableTypes *_Nullable output,
+ FlutterError *_Nullable error) {
+ callback(wrapResult(output, error));
+ }];
+ }];
+ } else {
+ [channel setMessageHandler:nil];
+ }
+ }
+ {
+ FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc]
+ initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoBool"
+ binaryMessenger:binaryMessenger
+ codec:HostIntegrationCoreApiGetCodec()];
+ if (api) {
+ NSCAssert([api respondsToSelector:@selector(callFlutterEchoBool:completion:)],
+ @"HostIntegrationCoreApi api (%@) doesn't respond to "
+ @"@selector(callFlutterEchoBool:completion:)",
+ api);
+ [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
+ NSArray *args = message;
+ NSNumber *arg_aBool = GetNullableObjectAtIndex(args, 0);
+ [api callFlutterEchoBool:arg_aBool
+ completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) {
+ callback(wrapResult(output, error));
+ }];
+ }];
+ } else {
+ [channel setMessageHandler:nil];
+ }
+ }
+ {
+ FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc]
+ initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoInt"
+ binaryMessenger:binaryMessenger
+ codec:HostIntegrationCoreApiGetCodec()];
+ if (api) {
+ NSCAssert([api respondsToSelector:@selector(callFlutterEchoInt:completion:)],
+ @"HostIntegrationCoreApi api (%@) doesn't respond to "
+ @"@selector(callFlutterEchoInt:completion:)",
+ api);
+ [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
+ NSArray *args = message;
+ NSNumber *arg_anInt = GetNullableObjectAtIndex(args, 0);
+ [api callFlutterEchoInt:arg_anInt
+ completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) {
+ callback(wrapResult(output, error));
+ }];
+ }];
+ } else {
+ [channel setMessageHandler:nil];
+ }
+ }
+ {
+ FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc]
+ initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoDouble"
+ binaryMessenger:binaryMessenger
+ codec:HostIntegrationCoreApiGetCodec()];
+ if (api) {
+ NSCAssert([api respondsToSelector:@selector(callFlutterEchoDouble:completion:)],
+ @"HostIntegrationCoreApi api (%@) doesn't respond to "
+ @"@selector(callFlutterEchoDouble:completion:)",
+ api);
+ [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
+ NSArray *args = message;
+ NSNumber *arg_aDouble = GetNullableObjectAtIndex(args, 0);
+ [api callFlutterEchoDouble:arg_aDouble
+ completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) {
+ callback(wrapResult(output, error));
+ }];
+ }];
+ } else {
+ [channel setMessageHandler:nil];
+ }
+ }
+ {
+ FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc]
initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoString"
binaryMessenger:binaryMessenger
codec:HostIntegrationCoreApiGetCodec()];
@@ -781,6 +898,236 @@
[channel setMessageHandler:nil];
}
}
+ {
+ FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc]
+ initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoUint8List"
+ binaryMessenger:binaryMessenger
+ codec:HostIntegrationCoreApiGetCodec()];
+ if (api) {
+ NSCAssert([api respondsToSelector:@selector(callFlutterEchoUint8List:completion:)],
+ @"HostIntegrationCoreApi api (%@) doesn't respond to "
+ @"@selector(callFlutterEchoUint8List:completion:)",
+ api);
+ [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
+ NSArray *args = message;
+ FlutterStandardTypedData *arg_aList = GetNullableObjectAtIndex(args, 0);
+ [api callFlutterEchoUint8List:arg_aList
+ completion:^(FlutterStandardTypedData *_Nullable output,
+ FlutterError *_Nullable error) {
+ callback(wrapResult(output, error));
+ }];
+ }];
+ } else {
+ [channel setMessageHandler:nil];
+ }
+ }
+ {
+ FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc]
+ initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoList"
+ binaryMessenger:binaryMessenger
+ codec:HostIntegrationCoreApiGetCodec()];
+ if (api) {
+ NSCAssert([api respondsToSelector:@selector(callFlutterEchoList:completion:)],
+ @"HostIntegrationCoreApi api (%@) doesn't respond to "
+ @"@selector(callFlutterEchoList:completion:)",
+ api);
+ [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
+ NSArray *args = message;
+ NSArray<id> *arg_aList = GetNullableObjectAtIndex(args, 0);
+ [api callFlutterEchoList:arg_aList
+ completion:^(NSArray<id> *_Nullable output, FlutterError *_Nullable error) {
+ callback(wrapResult(output, error));
+ }];
+ }];
+ } else {
+ [channel setMessageHandler:nil];
+ }
+ }
+ {
+ FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc]
+ initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoMap"
+ binaryMessenger:binaryMessenger
+ codec:HostIntegrationCoreApiGetCodec()];
+ if (api) {
+ NSCAssert([api respondsToSelector:@selector(callFlutterEchoMap:completion:)],
+ @"HostIntegrationCoreApi api (%@) doesn't respond to "
+ @"@selector(callFlutterEchoMap:completion:)",
+ api);
+ [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
+ NSArray *args = message;
+ NSDictionary<NSString *, id> *arg_aMap = GetNullableObjectAtIndex(args, 0);
+ [api callFlutterEchoMap:arg_aMap
+ completion:^(NSDictionary<NSString *, id> *_Nullable output,
+ FlutterError *_Nullable error) {
+ callback(wrapResult(output, error));
+ }];
+ }];
+ } else {
+ [channel setMessageHandler:nil];
+ }
+ }
+ {
+ FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc]
+ initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableBool"
+ binaryMessenger:binaryMessenger
+ codec:HostIntegrationCoreApiGetCodec()];
+ if (api) {
+ NSCAssert([api respondsToSelector:@selector(callFlutterEchoNullableBool:completion:)],
+ @"HostIntegrationCoreApi api (%@) doesn't respond to "
+ @"@selector(callFlutterEchoNullableBool:completion:)",
+ api);
+ [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
+ NSArray *args = message;
+ NSNumber *arg_aBool = GetNullableObjectAtIndex(args, 0);
+ [api callFlutterEchoNullableBool:arg_aBool
+ completion:^(NSNumber *_Nullable output,
+ FlutterError *_Nullable error) {
+ callback(wrapResult(output, error));
+ }];
+ }];
+ } else {
+ [channel setMessageHandler:nil];
+ }
+ }
+ {
+ FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc]
+ initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableInt"
+ binaryMessenger:binaryMessenger
+ codec:HostIntegrationCoreApiGetCodec()];
+ if (api) {
+ NSCAssert([api respondsToSelector:@selector(callFlutterEchoNullableInt:completion:)],
+ @"HostIntegrationCoreApi api (%@) doesn't respond to "
+ @"@selector(callFlutterEchoNullableInt:completion:)",
+ api);
+ [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
+ NSArray *args = message;
+ NSNumber *arg_anInt = GetNullableObjectAtIndex(args, 0);
+ [api callFlutterEchoNullableInt:arg_anInt
+ completion:^(NSNumber *_Nullable output,
+ FlutterError *_Nullable error) {
+ callback(wrapResult(output, error));
+ }];
+ }];
+ } else {
+ [channel setMessageHandler:nil];
+ }
+ }
+ {
+ FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc]
+ initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableDouble"
+ binaryMessenger:binaryMessenger
+ codec:HostIntegrationCoreApiGetCodec()];
+ if (api) {
+ NSCAssert([api respondsToSelector:@selector(callFlutterEchoNullableDouble:completion:)],
+ @"HostIntegrationCoreApi api (%@) doesn't respond to "
+ @"@selector(callFlutterEchoNullableDouble:completion:)",
+ api);
+ [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
+ NSArray *args = message;
+ NSNumber *arg_aDouble = GetNullableObjectAtIndex(args, 0);
+ [api callFlutterEchoNullableDouble:arg_aDouble
+ completion:^(NSNumber *_Nullable output,
+ FlutterError *_Nullable error) {
+ callback(wrapResult(output, error));
+ }];
+ }];
+ } else {
+ [channel setMessageHandler:nil];
+ }
+ }
+ {
+ FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc]
+ initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableString"
+ binaryMessenger:binaryMessenger
+ codec:HostIntegrationCoreApiGetCodec()];
+ if (api) {
+ NSCAssert([api respondsToSelector:@selector(callFlutterEchoNullableString:completion:)],
+ @"HostIntegrationCoreApi api (%@) doesn't respond to "
+ @"@selector(callFlutterEchoNullableString:completion:)",
+ api);
+ [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
+ NSArray *args = message;
+ NSString *arg_aString = GetNullableObjectAtIndex(args, 0);
+ [api callFlutterEchoNullableString:arg_aString
+ completion:^(NSString *_Nullable output,
+ FlutterError *_Nullable error) {
+ callback(wrapResult(output, error));
+ }];
+ }];
+ } else {
+ [channel setMessageHandler:nil];
+ }
+ }
+ {
+ FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc]
+ initWithName:
+ @"dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableUint8List"
+ binaryMessenger:binaryMessenger
+ codec:HostIntegrationCoreApiGetCodec()];
+ if (api) {
+ NSCAssert([api respondsToSelector:@selector(callFlutterEchoNullableUint8List:completion:)],
+ @"HostIntegrationCoreApi api (%@) doesn't respond to "
+ @"@selector(callFlutterEchoNullableUint8List:completion:)",
+ api);
+ [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
+ NSArray *args = message;
+ FlutterStandardTypedData *arg_aList = GetNullableObjectAtIndex(args, 0);
+ [api callFlutterEchoNullableUint8List:arg_aList
+ completion:^(FlutterStandardTypedData *_Nullable output,
+ FlutterError *_Nullable error) {
+ callback(wrapResult(output, error));
+ }];
+ }];
+ } else {
+ [channel setMessageHandler:nil];
+ }
+ }
+ {
+ FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc]
+ initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableList"
+ binaryMessenger:binaryMessenger
+ codec:HostIntegrationCoreApiGetCodec()];
+ if (api) {
+ NSCAssert([api respondsToSelector:@selector(callFlutterEchoNullableList:completion:)],
+ @"HostIntegrationCoreApi api (%@) doesn't respond to "
+ @"@selector(callFlutterEchoNullableList:completion:)",
+ api);
+ [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
+ NSArray *args = message;
+ NSArray<id> *arg_aList = GetNullableObjectAtIndex(args, 0);
+ [api callFlutterEchoNullableList:arg_aList
+ completion:^(NSArray<id> *_Nullable output,
+ FlutterError *_Nullable error) {
+ callback(wrapResult(output, error));
+ }];
+ }];
+ } else {
+ [channel setMessageHandler:nil];
+ }
+ }
+ {
+ FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc]
+ initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableMap"
+ binaryMessenger:binaryMessenger
+ codec:HostIntegrationCoreApiGetCodec()];
+ if (api) {
+ NSCAssert([api respondsToSelector:@selector(callFlutterEchoNullableMap:completion:)],
+ @"HostIntegrationCoreApi api (%@) doesn't respond to "
+ @"@selector(callFlutterEchoNullableMap:completion:)",
+ api);
+ [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
+ NSArray *args = message;
+ NSDictionary<NSString *, id> *arg_aMap = GetNullableObjectAtIndex(args, 0);
+ [api callFlutterEchoNullableMap:arg_aMap
+ completion:^(NSDictionary<NSString *, id> *_Nullable output,
+ FlutterError *_Nullable error) {
+ callback(wrapResult(output, error));
+ }];
+ }];
+ } else {
+ [channel setMessageHandler:nil];
+ }
+ }
}
@interface FlutterIntegrationCoreApiCodecReader : FlutterStandardReader
@end
@@ -1067,7 +1414,7 @@
completion(output, nil);
}];
}
-- (void)echoNullableMap:(NSDictionary<NSString *, id> *)arg_aMap
+- (void)echoNullableMap:(nullable NSDictionary<NSString *, id> *)arg_aMap
completion:
(void (^)(NSDictionary<NSString *, id> *_Nullable, NSError *_Nullable))completion {
FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel
diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/integration_tests.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/integration_tests.dart
index a47622b..93fbc21 100644
--- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/integration_tests.dart
+++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/integration_tests.dart
@@ -97,21 +97,11 @@
expect(echoObject.aFloatArray, genericAllTypes.aFloatArray);
expect(listEquals(echoObject.aList, genericAllTypes.aList), true);
expect(mapEquals(echoObject.aMap, genericAllTypes.aMap), true);
- // TODO(stuartmorgan): Enable this once the Dart types are fixed; see
- // https://github.com/flutter/flutter/issues/116117
- // expect(echoObject.nestedList.length, genericAllTypes.nestedList.length);
- //for (int i = 0; i < echoObject.nestedList!.length; i++) {
- // expect(listEquals(echoObject.nestedList![i], genericAllTypes.nestedList![i]),
- // true);
- //}
- // expect(
- // mapEquals(
- // echoObject.mapWithAnnotations, genericAllTypes.mapWithAnnotations),
- // true);
- // expect(
- // mapEquals(echoObject.mapWithObject, genericAllTypes.mapWithObject), true);
expect(echoObject.anEnum, genericAllTypes.anEnum);
- });
+ },
+ // TODO(stuartmorgan): Fix and re-enable.
+ // See https://github.com/flutter/flutter/issues/118726
+ skip: targetGenerator == TargetGenerator.kotlin);
testWidgets('all nullable datatypes serialize and deserialize correctly',
(WidgetTester _) async {
@@ -160,7 +150,7 @@
expect(echoObject?.aNullableEnum, genericAllNullableTypes.aNullableEnum);
});
- testWidgets('all nulla datatypes serialize and deserialize correctly',
+ testWidgets('all null datatypes serialize and deserialize correctly',
(WidgetTester _) async {
final HostIntegrationCoreApi api = HostIntegrationCoreApi();
@@ -233,7 +223,10 @@
expect(echoNullFilledObject?.aNullableEnum, allTypesNull.aNullableEnum);
expect(echoNullFilledObject?.aNullableEnum, null);
- });
+ },
+ // TODO(stuartmorgan): Fix and re-enable.
+ // See https://github.com/flutter/flutter/issues/118733
+ skip: targetGenerator == TargetGenerator.objc);
testWidgets('errors are returned correctly', (WidgetTester _) async {
final HostIntegrationCoreApi api = HostIntegrationCoreApi();
@@ -518,15 +511,294 @@
expect(api.callFlutterNoop(), completes);
});
+ testWidgets('all datatypes serialize and deserialize correctly',
+ (WidgetTester _) async {
+ final HostIntegrationCoreApi api = HostIntegrationCoreApi();
+
+ final AllTypes echoObject =
+ await api.callFlutterEchoAllTypes(genericAllTypes);
+
+ expect(echoObject.aBool, genericAllTypes.aBool);
+ expect(echoObject.anInt, genericAllTypes.anInt);
+ expect(echoObject.aDouble, genericAllTypes.aDouble);
+ expect(echoObject.aString, genericAllTypes.aString);
+ expect(echoObject.aByteArray, genericAllTypes.aByteArray);
+ expect(echoObject.a4ByteArray, genericAllTypes.a4ByteArray);
+ expect(echoObject.a8ByteArray, genericAllTypes.a8ByteArray);
+ expect(echoObject.aFloatArray, genericAllTypes.aFloatArray);
+ expect(listEquals(echoObject.aList, genericAllTypes.aList), true);
+ expect(mapEquals(echoObject.aMap, genericAllTypes.aMap), true);
+ expect(echoObject.anEnum, genericAllTypes.anEnum);
+ },
+ // TODO(stuartmorgan): Fix and re-enable.
+ // See https://github.com/flutter/flutter/issues/118726
+ skip: targetGenerator == TargetGenerator.kotlin ||
+ // TODO(stuartmorgan): Fix and re-enable.
+ // See https://github.com/flutter/flutter/issues/118739
+ targetGenerator == TargetGenerator.cpp);
+
+ testWidgets(
+ 'Arguments of multiple types serialize and deserialize correctly',
+ (WidgetTester _) async {
+ final HostIntegrationCoreApi api = HostIntegrationCoreApi();
+ const String aNullableString = 'this is a String';
+ const bool aNullableBool = false;
+ const int aNullableInt = 42;
+
+ final AllNullableTypes compositeObject =
+ await api.callFlutterSendMultipleNullableTypes(
+ aNullableBool, aNullableInt, aNullableString);
+ expect(compositeObject.aNullableInt, aNullableInt);
+ expect(compositeObject.aNullableBool, aNullableBool);
+ expect(compositeObject.aNullableString, aNullableString);
+ });
+
+ testWidgets(
+ 'Arguments of multiple null types serialize and deserialize correctly',
+ (WidgetTester _) async {
+ final HostIntegrationCoreApi api = HostIntegrationCoreApi();
+
+ final AllNullableTypes compositeObject =
+ await api.callFlutterSendMultipleNullableTypes(null, null, null);
+ expect(compositeObject.aNullableInt, null);
+ expect(compositeObject.aNullableBool, null);
+ expect(compositeObject.aNullableString, null);
+ });
+
+ testWidgets('booleans serialize and deserialize correctly',
+ (WidgetTester _) async {
+ final HostIntegrationCoreApi api = HostIntegrationCoreApi();
+
+ for (final bool sentObject in <bool>[true, false]) {
+ final bool echoObject = await api.callFlutterEchoBool(sentObject);
+ expect(echoObject, sentObject);
+ }
+ });
+
+ testWidgets('ints serialize and deserialize correctly',
+ (WidgetTester _) async {
+ final HostIntegrationCoreApi api = HostIntegrationCoreApi();
+
+ const int sentObject = -13;
+ final int echoObject = await api.callFlutterEchoInt(sentObject);
+ expect(echoObject, sentObject);
+ },
+ // TODO(stuartmorgan): Fix and re-enable.
+ // See https://github.com/flutter/flutter/issues/118726
+ skip: targetGenerator == TargetGenerator.kotlin);
+
+ testWidgets('doubles serialize and deserialize correctly',
+ (WidgetTester _) async {
+ final HostIntegrationCoreApi api = HostIntegrationCoreApi();
+
+ const double sentObject = 2.0694;
+ final double echoObject = await api.callFlutterEchoDouble(sentObject);
+ expect(echoObject, sentObject);
+ });
+
testWidgets('strings serialize and deserialize correctly',
(WidgetTester _) async {
final HostIntegrationCoreApi api = HostIntegrationCoreApi();
const String sentObject = 'Hello Dart!';
-
final String echoObject = await api.callFlutterEchoString(sentObject);
expect(echoObject, sentObject);
});
+
+ testWidgets('Uint8Lists serialize and deserialize correctly',
+ (WidgetTester _) async {
+ final HostIntegrationCoreApi api = HostIntegrationCoreApi();
+
+ final List<int> data = <int>[
+ 102,
+ 111,
+ 114,
+ 116,
+ 121,
+ 45,
+ 116,
+ 119,
+ 111,
+ 0
+ ];
+ final Uint8List sentObject = Uint8List.fromList(data);
+ final Uint8List echoObject =
+ await api.callFlutterEchoUint8List(sentObject);
+ expect(echoObject, sentObject);
+ });
+
+ testWidgets('lists serialize and deserialize correctly',
+ (WidgetTester _) async {
+ final HostIntegrationCoreApi api = HostIntegrationCoreApi();
+
+ const List<Object?> sentObject = <Object>[7, 'Hello Dart!'];
+ final List<Object?> echoObject =
+ await api.callFlutterEchoList(sentObject);
+ expect(listEquals(echoObject, sentObject), true);
+ });
+
+ testWidgets('maps serialize and deserialize correctly',
+ (WidgetTester _) async {
+ final HostIntegrationCoreApi api = HostIntegrationCoreApi();
+
+ const Map<String?, Object?> sentObject = <String?, Object?>{
+ 'a': 1,
+ 'b': 2.3,
+ 'c': 'four',
+ };
+ final Map<String?, Object?> echoObject =
+ await api.callFlutterEchoMap(sentObject);
+ expect(mapEquals(echoObject, sentObject), true);
+ });
+
+ testWidgets('nullable booleans serialize and deserialize correctly',
+ (WidgetTester _) async {
+ final HostIntegrationCoreApi api = HostIntegrationCoreApi();
+
+ for (final bool? sentObject in <bool?>[true, false]) {
+ final bool? echoObject =
+ await api.callFlutterEchoNullableBool(sentObject);
+ expect(echoObject, sentObject);
+ }
+ });
+
+ testWidgets('null booleans serialize and deserialize correctly',
+ (WidgetTester _) async {
+ final HostIntegrationCoreApi api = HostIntegrationCoreApi();
+
+ const bool? sentObject = null;
+ final bool? echoObject =
+ await api.callFlutterEchoNullableBool(sentObject);
+ expect(echoObject, sentObject);
+ });
+
+ testWidgets('nullable ints serialize and deserialize correctly',
+ (WidgetTester _) async {
+ final HostIntegrationCoreApi api = HostIntegrationCoreApi();
+
+ const int sentObject = -13;
+ final int? echoObject = await api.callFlutterEchoNullableInt(sentObject);
+ expect(echoObject, sentObject);
+ },
+ // TODO(stuartmorgan): Fix and re-enable.
+ // See https://github.com/flutter/flutter/issues/118726
+ skip: targetGenerator == TargetGenerator.kotlin);
+
+ testWidgets('null ints serialize and deserialize correctly',
+ (WidgetTester _) async {
+ final HostIntegrationCoreApi api = HostIntegrationCoreApi();
+
+ final int? echoObject = await api.callFlutterEchoNullableInt(null);
+ expect(echoObject, null);
+ });
+
+ testWidgets('nullable doubles serialize and deserialize correctly',
+ (WidgetTester _) async {
+ final HostIntegrationCoreApi api = HostIntegrationCoreApi();
+
+ const double sentObject = 2.0694;
+ final double? echoObject =
+ await api.callFlutterEchoNullableDouble(sentObject);
+ expect(echoObject, sentObject);
+ });
+
+ testWidgets('null doubles serialize and deserialize correctly',
+ (WidgetTester _) async {
+ final HostIntegrationCoreApi api = HostIntegrationCoreApi();
+
+ final double? echoObject = await api.callFlutterEchoNullableDouble(null);
+ expect(echoObject, null);
+ });
+
+ testWidgets('nullable strings serialize and deserialize correctly',
+ (WidgetTester _) async {
+ final HostIntegrationCoreApi api = HostIntegrationCoreApi();
+
+ const String sentObject = "I'm a computer";
+ final String? echoObject =
+ await api.callFlutterEchoNullableString(sentObject);
+ expect(echoObject, sentObject);
+ });
+
+ testWidgets('null strings serialize and deserialize correctly',
+ (WidgetTester _) async {
+ final HostIntegrationCoreApi api = HostIntegrationCoreApi();
+
+ final String? echoObject = await api.callFlutterEchoNullableString(null);
+ expect(echoObject, null);
+ });
+
+ testWidgets('nullable Uint8Lists serialize and deserialize correctly',
+ (WidgetTester _) async {
+ final HostIntegrationCoreApi api = HostIntegrationCoreApi();
+ final List<int> data = <int>[
+ 102,
+ 111,
+ 114,
+ 116,
+ 121,
+ 45,
+ 116,
+ 119,
+ 111,
+ 0
+ ];
+ final Uint8List sentObject = Uint8List.fromList(data);
+ final Uint8List? echoObject =
+ await api.callFlutterEchoNullableUint8List(sentObject);
+ expect(echoObject, sentObject);
+ });
+
+ testWidgets('null Uint8Lists serialize and deserialize correctly',
+ (WidgetTester _) async {
+ final HostIntegrationCoreApi api = HostIntegrationCoreApi();
+
+ final Uint8List? echoObject =
+ await api.callFlutterEchoNullableUint8List(null);
+ expect(echoObject, null);
+ });
+
+ testWidgets('nullable lists serialize and deserialize correctly',
+ (WidgetTester _) async {
+ final HostIntegrationCoreApi api = HostIntegrationCoreApi();
+
+ const List<Object?> sentObject = <Object>[7, 'Hello Dart!'];
+ final List<Object?>? echoObject =
+ await api.callFlutterEchoNullableList(sentObject);
+ expect(listEquals(echoObject, sentObject), true);
+ });
+
+ testWidgets('null lists serialize and deserialize correctly',
+ (WidgetTester _) async {
+ final HostIntegrationCoreApi api = HostIntegrationCoreApi();
+
+ final List<Object?>? echoObject =
+ await api.callFlutterEchoNullableList(null);
+ expect(listEquals(echoObject, null), true);
+ });
+
+ testWidgets('nullable maps serialize and deserialize correctly',
+ (WidgetTester _) async {
+ final HostIntegrationCoreApi api = HostIntegrationCoreApi();
+
+ const Map<String?, Object?> sentObject = <String?, Object?>{
+ 'a': 1,
+ 'b': 2.3,
+ 'c': 'four',
+ };
+ final Map<String?, Object?>? echoObject =
+ await api.callFlutterEchoNullableMap(sentObject);
+ expect(mapEquals(echoObject, sentObject), true);
+ });
+
+ testWidgets('null maps serialize and deserialize correctly',
+ (WidgetTester _) async {
+ final HostIntegrationCoreApi api = HostIntegrationCoreApi();
+
+ final Map<String?, Object?>? echoObject =
+ await api.callFlutterEchoNullableMap(null);
+ expect(mapEquals(echoObject, null), true);
+ });
});
}
@@ -587,7 +859,7 @@
List<Object?>? echoNullableList(List<Object?>? aList) => aList;
@override
- Map<String?, Object?> echoNullableMap(Map<String?, Object?> aMap) => aMap;
+ Map<String?, Object?>? echoNullableMap(Map<String?, Object?>? aMap) => aMap;
@override
String? echoNullableString(String? aString) => aString;
diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart
index e0f6451..59f6712 100644
--- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart
+++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart
@@ -812,6 +812,148 @@
}
}
+ 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',
@@ -839,6 +981,253 @@
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 {
@@ -938,7 +1327,7 @@
List<Object?>? echoNullableList(List<Object?>? aList);
/// Returns the passed map, to test serialization and deserialization.
- Map<String?, Object?> echoNullableMap(Map<String?, Object?> aMap);
+ Map<String?, Object?>? echoNullableMap(Map<String?, Object?>? aMap);
static void setup(FlutterIntegrationCoreApi? api,
{BinaryMessenger? binaryMessenger}) {
@@ -1274,9 +1663,7 @@
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.echoNullableMap was null, expected non-null Map<String?, Object?>.');
- final Map<String?, Object?> output = api.echoNullableMap(arg_aMap!);
+ final Map<String?, Object?>? output = api.echoNullableMap(arg_aMap);
return output;
});
}
diff --git a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt
index 035863f..e9fa5c2 100644
--- a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt
+++ b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt
@@ -270,7 +270,22 @@
/** Returns the passed string asynchronously. */
fun echoAsyncString(aString: String, callback: (String) -> Unit)
fun callFlutterNoop(callback: () -> Unit)
+ fun callFlutterEchoAllTypes(everything: AllTypes, callback: (AllTypes) -> Unit)
+ fun callFlutterSendMultipleNullableTypes(aNullableBool: Boolean?, aNullableInt: Long?, aNullableString: String?, callback: (AllNullableTypes) -> Unit)
+ fun callFlutterEchoBool(aBool: Boolean, callback: (Boolean) -> Unit)
+ fun callFlutterEchoInt(anInt: Long, callback: (Long) -> Unit)
+ fun callFlutterEchoDouble(aDouble: Double, callback: (Double) -> Unit)
fun callFlutterEchoString(aString: String, callback: (String) -> Unit)
+ fun callFlutterEchoUint8List(aList: ByteArray, callback: (ByteArray) -> Unit)
+ fun callFlutterEchoList(aList: List<Any?>, callback: (List<Any?>) -> Unit)
+ fun callFlutterEchoMap(aMap: Map<String?, Any?>, callback: (Map<String?, Any?>) -> Unit)
+ fun callFlutterEchoNullableBool(aBool: Boolean?, callback: (Boolean?) -> Unit)
+ fun callFlutterEchoNullableInt(anInt: Long?, callback: (Long?) -> Unit)
+ fun callFlutterEchoNullableDouble(aDouble: Double?, callback: (Double?) -> Unit)
+ fun callFlutterEchoNullableString(aString: String?, callback: (String?) -> Unit)
+ fun callFlutterEchoNullableUint8List(aList: ByteArray?, callback: (ByteArray?) -> Unit)
+ fun callFlutterEchoNullableList(aList: List<Any?>?, callback: (List<Any?>?) -> Unit)
+ fun callFlutterEchoNullableMap(aMap: Map<String?, Any?>?, callback: (Map<String?, Any?>?) -> Unit)
companion object {
/** The codec used by HostIntegrationCoreApi. */
@@ -679,6 +694,108 @@
}
}
run {
+ val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoAllTypes", codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ var wrapped = listOf<Any?>()
+ try {
+ val args = message as List<Any?>
+ val everythingArg = args[0] as AllTypes
+ api.callFlutterEchoAllTypes(everythingArg) {
+ reply.reply(wrapResult(it))
+ }
+ } catch (exception: Error) {
+ wrapped = wrapError(exception)
+ reply.reply(wrapped)
+ }
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterSendMultipleNullableTypes", codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ var wrapped = listOf<Any?>()
+ try {
+ 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) {
+ reply.reply(wrapResult(it))
+ }
+ } catch (exception: Error) {
+ wrapped = wrapError(exception)
+ reply.reply(wrapped)
+ }
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoBool", codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ var wrapped = listOf<Any?>()
+ try {
+ val args = message as List<Any?>
+ val aBoolArg = args[0] as Boolean
+ api.callFlutterEchoBool(aBoolArg) {
+ reply.reply(wrapResult(it))
+ }
+ } catch (exception: Error) {
+ wrapped = wrapError(exception)
+ reply.reply(wrapped)
+ }
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoInt", codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ var wrapped = listOf<Any?>()
+ try {
+ val args = message as List<Any?>
+ val anIntArg = args[0].let { if (it is Int) it.toLong() else it as Long }
+ api.callFlutterEchoInt(anIntArg) {
+ reply.reply(wrapResult(it))
+ }
+ } catch (exception: Error) {
+ wrapped = wrapError(exception)
+ reply.reply(wrapped)
+ }
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoDouble", codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ var wrapped = listOf<Any?>()
+ try {
+ val args = message as List<Any?>
+ val aDoubleArg = args[0] as Double
+ api.callFlutterEchoDouble(aDoubleArg) {
+ reply.reply(wrapResult(it))
+ }
+ } catch (exception: Error) {
+ wrapped = wrapError(exception)
+ reply.reply(wrapped)
+ }
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoString", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
@@ -698,6 +815,206 @@
channel.setMessageHandler(null)
}
}
+ run {
+ val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoUint8List", codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ var wrapped = listOf<Any?>()
+ try {
+ val args = message as List<Any?>
+ val aListArg = args[0] as ByteArray
+ api.callFlutterEchoUint8List(aListArg) {
+ reply.reply(wrapResult(it))
+ }
+ } catch (exception: Error) {
+ wrapped = wrapError(exception)
+ reply.reply(wrapped)
+ }
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoList", codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ var wrapped = listOf<Any?>()
+ try {
+ val args = message as List<Any?>
+ val aListArg = args[0] as List<Any?>
+ api.callFlutterEchoList(aListArg) {
+ reply.reply(wrapResult(it))
+ }
+ } catch (exception: Error) {
+ wrapped = wrapError(exception)
+ reply.reply(wrapped)
+ }
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoMap", codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ var wrapped = listOf<Any?>()
+ try {
+ val args = message as List<Any?>
+ val aMapArg = args[0] as Map<String?, Any?>
+ api.callFlutterEchoMap(aMapArg) {
+ reply.reply(wrapResult(it))
+ }
+ } catch (exception: Error) {
+ wrapped = wrapError(exception)
+ reply.reply(wrapped)
+ }
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableBool", codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ var wrapped = listOf<Any?>()
+ try {
+ val args = message as List<Any?>
+ val aBoolArg = args[0] as? Boolean
+ api.callFlutterEchoNullableBool(aBoolArg) {
+ reply.reply(wrapResult(it))
+ }
+ } catch (exception: Error) {
+ wrapped = wrapError(exception)
+ reply.reply(wrapped)
+ }
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableInt", codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ var wrapped = listOf<Any?>()
+ try {
+ val args = message as List<Any?>
+ val anIntArg = args[0].let { if (it is Int) it.toLong() else it as? Long }
+ api.callFlutterEchoNullableInt(anIntArg) {
+ reply.reply(wrapResult(it))
+ }
+ } catch (exception: Error) {
+ wrapped = wrapError(exception)
+ reply.reply(wrapped)
+ }
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableDouble", codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ var wrapped = listOf<Any?>()
+ try {
+ val args = message as List<Any?>
+ val aDoubleArg = args[0] as? Double
+ api.callFlutterEchoNullableDouble(aDoubleArg) {
+ reply.reply(wrapResult(it))
+ }
+ } catch (exception: Error) {
+ wrapped = wrapError(exception)
+ reply.reply(wrapped)
+ }
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableString", codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ var wrapped = listOf<Any?>()
+ try {
+ val args = message as List<Any?>
+ val aStringArg = args[0] as? String
+ api.callFlutterEchoNullableString(aStringArg) {
+ reply.reply(wrapResult(it))
+ }
+ } catch (exception: Error) {
+ wrapped = wrapError(exception)
+ reply.reply(wrapped)
+ }
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableUint8List", codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ var wrapped = listOf<Any?>()
+ try {
+ val args = message as List<Any?>
+ val aListArg = args[0] as? ByteArray
+ api.callFlutterEchoNullableUint8List(aListArg) {
+ reply.reply(wrapResult(it))
+ }
+ } catch (exception: Error) {
+ wrapped = wrapError(exception)
+ reply.reply(wrapped)
+ }
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableList", codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ var wrapped = listOf<Any?>()
+ try {
+ val args = message as List<Any?>
+ val aListArg = args[0] as? List<Any?>
+ api.callFlutterEchoNullableList(aListArg) {
+ reply.reply(wrapResult(it))
+ }
+ } catch (exception: Error) {
+ wrapped = wrapError(exception)
+ reply.reply(wrapped)
+ }
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableMap", codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ var wrapped = listOf<Any?>()
+ try {
+ val args = message as List<Any?>
+ val aMapArg = args[0] as? Map<String?, Any?>
+ api.callFlutterEchoNullableMap(aMapArg) {
+ reply.reply(wrapResult(it))
+ }
+ } catch (exception: Error) {
+ wrapped = wrapError(exception)
+ reply.reply(wrapped)
+ }
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
}
}
}
@@ -899,10 +1216,10 @@
}
}
/** Returns the passed map, to test serialization and deserialization. */
- fun echoNullableMap(aMapArg: Map<String?, Any?>, callback: (Map<String?, Any?>) -> Unit) {
+ 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?>
+ val result = it as? Map<String?, Any?>?
callback(result)
}
}
diff --git a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/TestPlugin.kt b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/TestPlugin.kt
index b8620df..e224d02 100644
--- a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/TestPlugin.kt
+++ b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/TestPlugin.kt
@@ -116,7 +116,75 @@
flutterApi!!.noop() { callback() }
}
- override fun callFlutterEchoString(aString: String, callback: (String) -> Unit) {
- flutterApi!!.echoString(aString) { flutterString -> callback(flutterString) }
+ override fun callFlutterEchoAllTypes(everything: AllTypes, callback: (AllTypes) -> Unit) {
+ flutterApi!!.echoAllTypes(everything) { echo -> callback(echo) }
}
+
+ override fun callFlutterSendMultipleNullableTypes(
+ aNullableBool: Boolean?,
+ aNullableInt: Long?,
+ aNullableString: String?,
+ callback: (AllNullableTypes) -> Unit
+ ) {
+ flutterApi!!.sendMultipleNullableTypes(aNullableBool, aNullableInt, aNullableString) {
+ echo -> callback(echo)
+ }
+ }
+
+ override fun callFlutterEchoBool(aBool: Boolean, callback: (Boolean) -> Unit) {
+ flutterApi!!.echoBool(aBool) { echo -> callback(echo) }
+ }
+
+ override fun callFlutterEchoInt(anInt: Long, callback: (Long) -> Unit) {
+ flutterApi!!.echoInt(anInt) { echo -> callback(echo) }
+ }
+
+ override fun callFlutterEchoDouble(aDouble: Double, callback: (Double) -> Unit) {
+ flutterApi!!.echoDouble(aDouble) { echo -> callback(echo) }
+ }
+
+ override fun callFlutterEchoString(aString: String, callback: (String) -> Unit) {
+ flutterApi!!.echoString(aString) { echo -> callback(echo) }
+ }
+
+ override fun callFlutterEchoUint8List(aList: ByteArray, callback: (ByteArray) -> Unit) {
+ flutterApi!!.echoUint8List(aList) { echo -> callback(echo) }
+ }
+
+ override fun callFlutterEchoList(aList: List<Any?>, callback: (List<Any?>) -> Unit) {
+ flutterApi!!.echoList(aList) { echo -> callback(echo) }
+ }
+
+ override fun callFlutterEchoMap(aMap: Map<String?, Any?>, callback: (Map<String?, Any?>) -> Unit) {
+ flutterApi!!.echoMap(aMap) { echo -> callback(echo) }
+ }
+
+ override fun callFlutterEchoNullableBool(aBool: Boolean?, callback: (Boolean?) -> Unit) {
+ flutterApi!!.echoNullableBool(aBool) { echo -> callback(echo) }
+ }
+
+ override fun callFlutterEchoNullableInt(anInt: Long?, callback: (Long?) -> Unit) {
+ flutterApi!!.echoNullableInt(anInt) { echo -> callback(echo) }
+ }
+
+ override fun callFlutterEchoNullableDouble(aDouble: Double?, callback: (Double?) -> Unit) {
+ flutterApi!!.echoNullableDouble(aDouble) { echo -> callback(echo) }
+ }
+
+ override fun callFlutterEchoNullableString(aString: String?, callback: (String?) -> Unit) {
+ flutterApi!!.echoNullableString(aString) { echo -> callback(echo) }
+ }
+
+ override fun callFlutterEchoNullableUint8List(aList: ByteArray?, callback: (ByteArray?) -> Unit) {
+ flutterApi!!.echoNullableUint8List(aList) { echo -> callback(echo) }
+ }
+
+ override fun callFlutterEchoNullableList(aList: List<Any?>?, callback: (List<Any?>?) -> Unit) {
+ flutterApi!!.echoNullableList(aList) { echo -> callback(echo) }
+ }
+
+ override fun callFlutterEchoNullableMap(aMap: Map<String?, Any?>?, callback: (Map<String?, Any?>?) -> Unit) {
+ flutterApi!!.echoNullableMap(aMap) { echo -> callback(echo) }
+ }
+
}
diff --git a/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift b/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift
index 83d03ff..f4af18c 100644
--- a/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift
+++ b/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift
@@ -281,7 +281,22 @@
/// Returns the passed string asynchronously.
func echoAsyncString(aString: String, completion: @escaping (String) -> Void)
func callFlutterNoop(completion: @escaping () -> Void)
+ func callFlutterEchoAllTypes(everything: AllTypes, completion: @escaping (AllTypes) -> Void)
+ func callFlutterSendMultipleNullableTypes(aNullableBool: Bool?, aNullableInt: Int32?, aNullableString: String?, completion: @escaping (AllNullableTypes) -> Void)
+ func callFlutterEchoBool(aBool: Bool, completion: @escaping (Bool) -> Void)
+ func callFlutterEchoInt(anInt: Int32, completion: @escaping (Int32) -> Void)
+ func callFlutterEchoDouble(aDouble: Double, completion: @escaping (Double) -> Void)
func callFlutterEchoString(aString: String, completion: @escaping (String) -> Void)
+ func callFlutterEchoUint8List(aList: FlutterStandardTypedData, completion: @escaping (FlutterStandardTypedData) -> Void)
+ func callFlutterEchoList(aList: [Any?], completion: @escaping ([Any?]) -> Void)
+ func callFlutterEchoMap(aMap: [String?: Any?], completion: @escaping ([String?: Any?]) -> Void)
+ func callFlutterEchoNullableBool(aBool: Bool?, completion: @escaping (Bool?) -> Void)
+ func callFlutterEchoNullableInt(anInt: Int32?, completion: @escaping (Int32?) -> Void)
+ func callFlutterEchoNullableDouble(aDouble: Double?, completion: @escaping (Double?) -> Void)
+ func callFlutterEchoNullableString(aString: String?, completion: @escaping (String?) -> Void)
+ func callFlutterEchoNullableUint8List(aList: FlutterStandardTypedData?, completion: @escaping (FlutterStandardTypedData?) -> Void)
+ func callFlutterEchoNullableList(aList: [Any?]?, completion: @escaping ([Any?]?) -> Void)
+ func callFlutterEchoNullableMap(aMap: [String?: Any?]?, completion: @escaping ([String?: Any?]?) -> Void)
}
/// Generated setup class from Pigeon to handle messages through the `binaryMessenger`.
@@ -554,6 +569,68 @@
} else {
callFlutterNoopChannel.setMessageHandler(nil)
}
+ let callFlutterEchoAllTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoAllTypes", binaryMessenger: binaryMessenger, codec: codec)
+ if let api = api {
+ callFlutterEchoAllTypesChannel.setMessageHandler { message, reply in
+ let args = message as! [Any?]
+ let everythingArg = args[0] as! AllTypes
+ api.callFlutterEchoAllTypes(everything: everythingArg) { result in
+ reply(wrapResult(result))
+ }
+ }
+ } else {
+ callFlutterEchoAllTypesChannel.setMessageHandler(nil)
+ }
+ let callFlutterSendMultipleNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterSendMultipleNullableTypes", binaryMessenger: binaryMessenger, codec: codec)
+ if let api = api {
+ callFlutterSendMultipleNullableTypesChannel.setMessageHandler { message, reply in
+ let args = message as! [Any?]
+ let aNullableBoolArg = args[0] as? Bool
+ let aNullableIntArg = args[1] as? Int32
+ let aNullableStringArg = args[2] as? String
+ api.callFlutterSendMultipleNullableTypes(aNullableBool: aNullableBoolArg, aNullableInt: aNullableIntArg, aNullableString: aNullableStringArg) { result in
+ reply(wrapResult(result))
+ }
+ }
+ } else {
+ callFlutterSendMultipleNullableTypesChannel.setMessageHandler(nil)
+ }
+ let callFlutterEchoBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoBool", binaryMessenger: binaryMessenger, codec: codec)
+ if let api = api {
+ callFlutterEchoBoolChannel.setMessageHandler { message, reply in
+ let args = message as! [Any?]
+ let aBoolArg = args[0] as! Bool
+ api.callFlutterEchoBool(aBool: aBoolArg) { result in
+ reply(wrapResult(result))
+ }
+ }
+ } else {
+ callFlutterEchoBoolChannel.setMessageHandler(nil)
+ }
+ let callFlutterEchoIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoInt", binaryMessenger: binaryMessenger, codec: codec)
+ if let api = api {
+ callFlutterEchoIntChannel.setMessageHandler { message, reply in
+ let args = message as! [Any?]
+ let anIntArg = args[0] as! Int32
+ api.callFlutterEchoInt(anInt: anIntArg) { result in
+ reply(wrapResult(result))
+ }
+ }
+ } else {
+ callFlutterEchoIntChannel.setMessageHandler(nil)
+ }
+ let callFlutterEchoDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoDouble", binaryMessenger: binaryMessenger, codec: codec)
+ if let api = api {
+ callFlutterEchoDoubleChannel.setMessageHandler { message, reply in
+ let args = message as! [Any?]
+ let aDoubleArg = args[0] as! Double
+ api.callFlutterEchoDouble(aDouble: aDoubleArg) { result in
+ reply(wrapResult(result))
+ }
+ }
+ } else {
+ callFlutterEchoDoubleChannel.setMessageHandler(nil)
+ }
let callFlutterEchoStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoString", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
callFlutterEchoStringChannel.setMessageHandler { message, reply in
@@ -566,6 +643,126 @@
} else {
callFlutterEchoStringChannel.setMessageHandler(nil)
}
+ let callFlutterEchoUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoUint8List", binaryMessenger: binaryMessenger, codec: codec)
+ if let api = api {
+ callFlutterEchoUint8ListChannel.setMessageHandler { message, reply in
+ let args = message as! [Any?]
+ let aListArg = args[0] as! FlutterStandardTypedData
+ api.callFlutterEchoUint8List(aList: aListArg) { result in
+ reply(wrapResult(result))
+ }
+ }
+ } else {
+ callFlutterEchoUint8ListChannel.setMessageHandler(nil)
+ }
+ let callFlutterEchoListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoList", binaryMessenger: binaryMessenger, codec: codec)
+ if let api = api {
+ callFlutterEchoListChannel.setMessageHandler { message, reply in
+ let args = message as! [Any?]
+ let aListArg = args[0] as! [Any?]
+ api.callFlutterEchoList(aList: aListArg) { result in
+ reply(wrapResult(result))
+ }
+ }
+ } else {
+ callFlutterEchoListChannel.setMessageHandler(nil)
+ }
+ let callFlutterEchoMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoMap", binaryMessenger: binaryMessenger, codec: codec)
+ if let api = api {
+ callFlutterEchoMapChannel.setMessageHandler { message, reply in
+ let args = message as! [Any?]
+ let aMapArg = args[0] as! [String?: Any?]
+ api.callFlutterEchoMap(aMap: aMapArg) { result in
+ reply(wrapResult(result))
+ }
+ }
+ } else {
+ callFlutterEchoMapChannel.setMessageHandler(nil)
+ }
+ let callFlutterEchoNullableBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableBool", binaryMessenger: binaryMessenger, codec: codec)
+ if let api = api {
+ callFlutterEchoNullableBoolChannel.setMessageHandler { message, reply in
+ let args = message as! [Any?]
+ let aBoolArg = args[0] as? Bool
+ api.callFlutterEchoNullableBool(aBool: aBoolArg) { result in
+ reply(wrapResult(result))
+ }
+ }
+ } else {
+ callFlutterEchoNullableBoolChannel.setMessageHandler(nil)
+ }
+ let callFlutterEchoNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableInt", binaryMessenger: binaryMessenger, codec: codec)
+ if let api = api {
+ callFlutterEchoNullableIntChannel.setMessageHandler { message, reply in
+ let args = message as! [Any?]
+ let anIntArg = args[0] as? Int32
+ api.callFlutterEchoNullableInt(anInt: anIntArg) { result in
+ reply(wrapResult(result))
+ }
+ }
+ } else {
+ callFlutterEchoNullableIntChannel.setMessageHandler(nil)
+ }
+ let callFlutterEchoNullableDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableDouble", binaryMessenger: binaryMessenger, codec: codec)
+ if let api = api {
+ callFlutterEchoNullableDoubleChannel.setMessageHandler { message, reply in
+ let args = message as! [Any?]
+ let aDoubleArg = args[0] as? Double
+ api.callFlutterEchoNullableDouble(aDouble: aDoubleArg) { result in
+ reply(wrapResult(result))
+ }
+ }
+ } else {
+ callFlutterEchoNullableDoubleChannel.setMessageHandler(nil)
+ }
+ let callFlutterEchoNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableString", binaryMessenger: binaryMessenger, codec: codec)
+ if let api = api {
+ callFlutterEchoNullableStringChannel.setMessageHandler { message, reply in
+ let args = message as! [Any?]
+ let aStringArg = args[0] as? String
+ api.callFlutterEchoNullableString(aString: aStringArg) { result in
+ reply(wrapResult(result))
+ }
+ }
+ } else {
+ callFlutterEchoNullableStringChannel.setMessageHandler(nil)
+ }
+ let callFlutterEchoNullableUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableUint8List", binaryMessenger: binaryMessenger, codec: codec)
+ if let api = api {
+ callFlutterEchoNullableUint8ListChannel.setMessageHandler { message, reply in
+ let args = message as! [Any?]
+ let aListArg = args[0] as? FlutterStandardTypedData
+ api.callFlutterEchoNullableUint8List(aList: aListArg) { result in
+ reply(wrapResult(result))
+ }
+ }
+ } else {
+ callFlutterEchoNullableUint8ListChannel.setMessageHandler(nil)
+ }
+ let callFlutterEchoNullableListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableList", binaryMessenger: binaryMessenger, codec: codec)
+ if let api = api {
+ callFlutterEchoNullableListChannel.setMessageHandler { message, reply in
+ let args = message as! [Any?]
+ let aListArg = args[0] as? [Any?]
+ api.callFlutterEchoNullableList(aList: aListArg) { result in
+ reply(wrapResult(result))
+ }
+ }
+ } else {
+ callFlutterEchoNullableListChannel.setMessageHandler(nil)
+ }
+ let callFlutterEchoNullableMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableMap", binaryMessenger: binaryMessenger, codec: codec)
+ if let api = api {
+ callFlutterEchoNullableMapChannel.setMessageHandler { message, reply in
+ let args = message as! [Any?]
+ let aMapArg = args[0] as? [String?: Any?]
+ api.callFlutterEchoNullableMap(aMap: aMapArg) { result in
+ reply(wrapResult(result))
+ }
+ }
+ } else {
+ callFlutterEchoNullableMapChannel.setMessageHandler(nil)
+ }
}
}
private class FlutterIntegrationCoreApiCodecReader: FlutterStandardReader {
@@ -765,10 +962,10 @@
}
}
/// Returns the passed map, to test serialization and deserialization.
- func echoNullableMap(aMap aMapArg: [String?: Any?], completion: @escaping ([String?: Any?]) -> Void) {
+ func echoNullableMap(aMap aMapArg: [String?: Any?]?, completion: @escaping ([String?: Any?]?) -> Void) {
let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aMapArg] as [Any?]) { response in
- let result = response as! [String?: Any?]
+ let result = response as? [String?: Any?]
completion(result)
}
}
diff --git a/packages/pigeon/platform_tests/test_plugin/ios/Classes/TestPlugin.swift b/packages/pigeon/platform_tests/test_plugin/ios/Classes/TestPlugin.swift
index 7170f5f..3515e49 100644
--- a/packages/pigeon/platform_tests/test_plugin/ios/Classes/TestPlugin.swift
+++ b/packages/pigeon/platform_tests/test_plugin/ios/Classes/TestPlugin.swift
@@ -114,9 +114,78 @@
}
}
- func callFlutterEchoString(aString: String, completion: @escaping (String) -> Void) {
- flutterAPI.echoString(aString: aString) { flutterString in
- completion(flutterString)
+ func callFlutterEchoAllTypes(everything: AllTypes, completion: @escaping (AllTypes) -> Void) {
+ flutterAPI.echoAllTypes(everything: everything) { completion($0) }
+ }
+
+ func callFlutterSendMultipleNullableTypes(
+ aNullableBool: Bool?,
+ aNullableInt: Int32?,
+ aNullableString: String?,
+ completion: @escaping (AllNullableTypes) -> Void
+ ) {
+ flutterAPI.sendMultipleNullableTypes(
+ aNullableBool: aNullableBool,
+ aNullableInt: aNullableInt,
+ aNullableString: aNullableString
+ ) {
+ completion($0)
}
}
+
+ func callFlutterEchoBool(aBool: Bool, completion: @escaping (Bool) -> Void) {
+ flutterAPI.echoBool(aBool: aBool) { completion($0) }
+ }
+
+ func callFlutterEchoInt(anInt: Int32, completion: @escaping (Int32) -> Void) {
+ flutterAPI.echoInt(anInt: anInt) { completion($0) }
+ }
+
+ func callFlutterEchoDouble(aDouble: Double, completion: @escaping (Double) -> Void) {
+ flutterAPI.echoDouble(aDouble: aDouble) { completion($0) }
+ }
+
+ func callFlutterEchoString(aString: String, completion: @escaping (String) -> Void) {
+ flutterAPI.echoString(aString: aString) { completion($0) }
+ }
+
+ func callFlutterEchoUint8List(aList: FlutterStandardTypedData, completion: @escaping (FlutterStandardTypedData) -> Void) {
+ flutterAPI.echoUint8List(aList: aList) { completion($0) }
+ }
+
+ func callFlutterEchoList(aList: [Any?], completion: @escaping ([Any?]) -> Void) {
+ flutterAPI.echoList(aList: aList) { completion($0) }
+ }
+
+ func callFlutterEchoMap(aMap: [String? : Any?], completion: @escaping ([String? : Any?]) -> Void) {
+ flutterAPI.echoMap(aMap: aMap) { completion($0) }
+ }
+
+ func callFlutterEchoNullableBool(aBool: Bool?, completion: @escaping (Bool?) -> Void) {
+ flutterAPI.echoNullableBool(aBool: aBool) { completion($0) }
+ }
+
+ func callFlutterEchoNullableInt(anInt: Int32?, completion: @escaping (Int32?) -> Void) {
+ flutterAPI.echoNullableInt(anInt: anInt) { completion($0) }
+ }
+
+ func callFlutterEchoNullableDouble(aDouble: Double?, completion: @escaping (Double?) -> Void) {
+ flutterAPI.echoNullableDouble(aDouble: aDouble) { completion($0) }
+ }
+
+ func callFlutterEchoNullableString(aString: String?, completion: @escaping (String?) -> Void) {
+ flutterAPI.echoNullableString(aString: aString) { completion($0) }
+ }
+
+ func callFlutterEchoNullableUint8List(aList: FlutterStandardTypedData?, completion: @escaping (FlutterStandardTypedData?) -> Void) {
+ flutterAPI.echoNullableUint8List(aList: aList) { completion($0) }
+ }
+
+ func callFlutterEchoNullableList(aList: [Any?]?, completion: @escaping ([Any?]?) -> Void) {
+ flutterAPI.echoNullableList(aList: aList) { completion($0) }
+ }
+
+ func callFlutterEchoNullableMap(aMap: [String? : Any?]?, completion: @escaping ([String? : Any?]?) -> Void) {
+ flutterAPI.echoNullableMap(aMap: aMap) { completion($0) }
+ }
}
diff --git a/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift b/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift
index 83d03ff..f4af18c 100644
--- a/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift
+++ b/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift
@@ -281,7 +281,22 @@
/// Returns the passed string asynchronously.
func echoAsyncString(aString: String, completion: @escaping (String) -> Void)
func callFlutterNoop(completion: @escaping () -> Void)
+ func callFlutterEchoAllTypes(everything: AllTypes, completion: @escaping (AllTypes) -> Void)
+ func callFlutterSendMultipleNullableTypes(aNullableBool: Bool?, aNullableInt: Int32?, aNullableString: String?, completion: @escaping (AllNullableTypes) -> Void)
+ func callFlutterEchoBool(aBool: Bool, completion: @escaping (Bool) -> Void)
+ func callFlutterEchoInt(anInt: Int32, completion: @escaping (Int32) -> Void)
+ func callFlutterEchoDouble(aDouble: Double, completion: @escaping (Double) -> Void)
func callFlutterEchoString(aString: String, completion: @escaping (String) -> Void)
+ func callFlutterEchoUint8List(aList: FlutterStandardTypedData, completion: @escaping (FlutterStandardTypedData) -> Void)
+ func callFlutterEchoList(aList: [Any?], completion: @escaping ([Any?]) -> Void)
+ func callFlutterEchoMap(aMap: [String?: Any?], completion: @escaping ([String?: Any?]) -> Void)
+ func callFlutterEchoNullableBool(aBool: Bool?, completion: @escaping (Bool?) -> Void)
+ func callFlutterEchoNullableInt(anInt: Int32?, completion: @escaping (Int32?) -> Void)
+ func callFlutterEchoNullableDouble(aDouble: Double?, completion: @escaping (Double?) -> Void)
+ func callFlutterEchoNullableString(aString: String?, completion: @escaping (String?) -> Void)
+ func callFlutterEchoNullableUint8List(aList: FlutterStandardTypedData?, completion: @escaping (FlutterStandardTypedData?) -> Void)
+ func callFlutterEchoNullableList(aList: [Any?]?, completion: @escaping ([Any?]?) -> Void)
+ func callFlutterEchoNullableMap(aMap: [String?: Any?]?, completion: @escaping ([String?: Any?]?) -> Void)
}
/// Generated setup class from Pigeon to handle messages through the `binaryMessenger`.
@@ -554,6 +569,68 @@
} else {
callFlutterNoopChannel.setMessageHandler(nil)
}
+ let callFlutterEchoAllTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoAllTypes", binaryMessenger: binaryMessenger, codec: codec)
+ if let api = api {
+ callFlutterEchoAllTypesChannel.setMessageHandler { message, reply in
+ let args = message as! [Any?]
+ let everythingArg = args[0] as! AllTypes
+ api.callFlutterEchoAllTypes(everything: everythingArg) { result in
+ reply(wrapResult(result))
+ }
+ }
+ } else {
+ callFlutterEchoAllTypesChannel.setMessageHandler(nil)
+ }
+ let callFlutterSendMultipleNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterSendMultipleNullableTypes", binaryMessenger: binaryMessenger, codec: codec)
+ if let api = api {
+ callFlutterSendMultipleNullableTypesChannel.setMessageHandler { message, reply in
+ let args = message as! [Any?]
+ let aNullableBoolArg = args[0] as? Bool
+ let aNullableIntArg = args[1] as? Int32
+ let aNullableStringArg = args[2] as? String
+ api.callFlutterSendMultipleNullableTypes(aNullableBool: aNullableBoolArg, aNullableInt: aNullableIntArg, aNullableString: aNullableStringArg) { result in
+ reply(wrapResult(result))
+ }
+ }
+ } else {
+ callFlutterSendMultipleNullableTypesChannel.setMessageHandler(nil)
+ }
+ let callFlutterEchoBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoBool", binaryMessenger: binaryMessenger, codec: codec)
+ if let api = api {
+ callFlutterEchoBoolChannel.setMessageHandler { message, reply in
+ let args = message as! [Any?]
+ let aBoolArg = args[0] as! Bool
+ api.callFlutterEchoBool(aBool: aBoolArg) { result in
+ reply(wrapResult(result))
+ }
+ }
+ } else {
+ callFlutterEchoBoolChannel.setMessageHandler(nil)
+ }
+ let callFlutterEchoIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoInt", binaryMessenger: binaryMessenger, codec: codec)
+ if let api = api {
+ callFlutterEchoIntChannel.setMessageHandler { message, reply in
+ let args = message as! [Any?]
+ let anIntArg = args[0] as! Int32
+ api.callFlutterEchoInt(anInt: anIntArg) { result in
+ reply(wrapResult(result))
+ }
+ }
+ } else {
+ callFlutterEchoIntChannel.setMessageHandler(nil)
+ }
+ let callFlutterEchoDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoDouble", binaryMessenger: binaryMessenger, codec: codec)
+ if let api = api {
+ callFlutterEchoDoubleChannel.setMessageHandler { message, reply in
+ let args = message as! [Any?]
+ let aDoubleArg = args[0] as! Double
+ api.callFlutterEchoDouble(aDouble: aDoubleArg) { result in
+ reply(wrapResult(result))
+ }
+ }
+ } else {
+ callFlutterEchoDoubleChannel.setMessageHandler(nil)
+ }
let callFlutterEchoStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoString", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
callFlutterEchoStringChannel.setMessageHandler { message, reply in
@@ -566,6 +643,126 @@
} else {
callFlutterEchoStringChannel.setMessageHandler(nil)
}
+ let callFlutterEchoUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoUint8List", binaryMessenger: binaryMessenger, codec: codec)
+ if let api = api {
+ callFlutterEchoUint8ListChannel.setMessageHandler { message, reply in
+ let args = message as! [Any?]
+ let aListArg = args[0] as! FlutterStandardTypedData
+ api.callFlutterEchoUint8List(aList: aListArg) { result in
+ reply(wrapResult(result))
+ }
+ }
+ } else {
+ callFlutterEchoUint8ListChannel.setMessageHandler(nil)
+ }
+ let callFlutterEchoListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoList", binaryMessenger: binaryMessenger, codec: codec)
+ if let api = api {
+ callFlutterEchoListChannel.setMessageHandler { message, reply in
+ let args = message as! [Any?]
+ let aListArg = args[0] as! [Any?]
+ api.callFlutterEchoList(aList: aListArg) { result in
+ reply(wrapResult(result))
+ }
+ }
+ } else {
+ callFlutterEchoListChannel.setMessageHandler(nil)
+ }
+ let callFlutterEchoMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoMap", binaryMessenger: binaryMessenger, codec: codec)
+ if let api = api {
+ callFlutterEchoMapChannel.setMessageHandler { message, reply in
+ let args = message as! [Any?]
+ let aMapArg = args[0] as! [String?: Any?]
+ api.callFlutterEchoMap(aMap: aMapArg) { result in
+ reply(wrapResult(result))
+ }
+ }
+ } else {
+ callFlutterEchoMapChannel.setMessageHandler(nil)
+ }
+ let callFlutterEchoNullableBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableBool", binaryMessenger: binaryMessenger, codec: codec)
+ if let api = api {
+ callFlutterEchoNullableBoolChannel.setMessageHandler { message, reply in
+ let args = message as! [Any?]
+ let aBoolArg = args[0] as? Bool
+ api.callFlutterEchoNullableBool(aBool: aBoolArg) { result in
+ reply(wrapResult(result))
+ }
+ }
+ } else {
+ callFlutterEchoNullableBoolChannel.setMessageHandler(nil)
+ }
+ let callFlutterEchoNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableInt", binaryMessenger: binaryMessenger, codec: codec)
+ if let api = api {
+ callFlutterEchoNullableIntChannel.setMessageHandler { message, reply in
+ let args = message as! [Any?]
+ let anIntArg = args[0] as? Int32
+ api.callFlutterEchoNullableInt(anInt: anIntArg) { result in
+ reply(wrapResult(result))
+ }
+ }
+ } else {
+ callFlutterEchoNullableIntChannel.setMessageHandler(nil)
+ }
+ let callFlutterEchoNullableDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableDouble", binaryMessenger: binaryMessenger, codec: codec)
+ if let api = api {
+ callFlutterEchoNullableDoubleChannel.setMessageHandler { message, reply in
+ let args = message as! [Any?]
+ let aDoubleArg = args[0] as? Double
+ api.callFlutterEchoNullableDouble(aDouble: aDoubleArg) { result in
+ reply(wrapResult(result))
+ }
+ }
+ } else {
+ callFlutterEchoNullableDoubleChannel.setMessageHandler(nil)
+ }
+ let callFlutterEchoNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableString", binaryMessenger: binaryMessenger, codec: codec)
+ if let api = api {
+ callFlutterEchoNullableStringChannel.setMessageHandler { message, reply in
+ let args = message as! [Any?]
+ let aStringArg = args[0] as? String
+ api.callFlutterEchoNullableString(aString: aStringArg) { result in
+ reply(wrapResult(result))
+ }
+ }
+ } else {
+ callFlutterEchoNullableStringChannel.setMessageHandler(nil)
+ }
+ let callFlutterEchoNullableUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableUint8List", binaryMessenger: binaryMessenger, codec: codec)
+ if let api = api {
+ callFlutterEchoNullableUint8ListChannel.setMessageHandler { message, reply in
+ let args = message as! [Any?]
+ let aListArg = args[0] as? FlutterStandardTypedData
+ api.callFlutterEchoNullableUint8List(aList: aListArg) { result in
+ reply(wrapResult(result))
+ }
+ }
+ } else {
+ callFlutterEchoNullableUint8ListChannel.setMessageHandler(nil)
+ }
+ let callFlutterEchoNullableListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableList", binaryMessenger: binaryMessenger, codec: codec)
+ if let api = api {
+ callFlutterEchoNullableListChannel.setMessageHandler { message, reply in
+ let args = message as! [Any?]
+ let aListArg = args[0] as? [Any?]
+ api.callFlutterEchoNullableList(aList: aListArg) { result in
+ reply(wrapResult(result))
+ }
+ }
+ } else {
+ callFlutterEchoNullableListChannel.setMessageHandler(nil)
+ }
+ let callFlutterEchoNullableMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableMap", binaryMessenger: binaryMessenger, codec: codec)
+ if let api = api {
+ callFlutterEchoNullableMapChannel.setMessageHandler { message, reply in
+ let args = message as! [Any?]
+ let aMapArg = args[0] as? [String?: Any?]
+ api.callFlutterEchoNullableMap(aMap: aMapArg) { result in
+ reply(wrapResult(result))
+ }
+ }
+ } else {
+ callFlutterEchoNullableMapChannel.setMessageHandler(nil)
+ }
}
}
private class FlutterIntegrationCoreApiCodecReader: FlutterStandardReader {
@@ -765,10 +962,10 @@
}
}
/// Returns the passed map, to test serialization and deserialization.
- func echoNullableMap(aMap aMapArg: [String?: Any?], completion: @escaping ([String?: Any?]) -> Void) {
+ func echoNullableMap(aMap aMapArg: [String?: Any?]?, completion: @escaping ([String?: Any?]?) -> Void) {
let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aMapArg] as [Any?]) { response in
- let result = response as! [String?: Any?]
+ let result = response as? [String?: Any?]
completion(result)
}
}
diff --git a/packages/pigeon/platform_tests/test_plugin/macos/Classes/TestPlugin.swift b/packages/pigeon/platform_tests/test_plugin/macos/Classes/TestPlugin.swift
index 2cfe487..7461473 100644
--- a/packages/pigeon/platform_tests/test_plugin/macos/Classes/TestPlugin.swift
+++ b/packages/pigeon/platform_tests/test_plugin/macos/Classes/TestPlugin.swift
@@ -23,7 +23,7 @@
// MARK: HostIntegrationCoreApi implementation
- func noop() {
+ func noop() {
}
func echoAllTypes(everything: AllTypes) -> AllTypes {
@@ -114,9 +114,78 @@
}
}
- func callFlutterEchoString(aString: String, completion: @escaping (String) -> Void) {
- flutterAPI.echoString(aString: aString) { flutterString in
- completion(flutterString)
+ func callFlutterEchoAllTypes(everything: AllTypes, completion: @escaping (AllTypes) -> Void) {
+ flutterAPI.echoAllTypes(everything: everything) { completion($0) }
+ }
+
+ func callFlutterSendMultipleNullableTypes(
+ aNullableBool: Bool?,
+ aNullableInt: Int32?,
+ aNullableString: String?,
+ completion: @escaping (AllNullableTypes) -> Void
+ ) {
+ flutterAPI.sendMultipleNullableTypes(
+ aNullableBool: aNullableBool,
+ aNullableInt: aNullableInt,
+ aNullableString: aNullableString
+ ) {
+ completion($0)
}
}
+
+ func callFlutterEchoBool(aBool: Bool, completion: @escaping (Bool) -> Void) {
+ flutterAPI.echoBool(aBool: aBool) { completion($0) }
+ }
+
+ func callFlutterEchoInt(anInt: Int32, completion: @escaping (Int32) -> Void) {
+ flutterAPI.echoInt(anInt: anInt) { completion($0) }
+ }
+
+ func callFlutterEchoDouble(aDouble: Double, completion: @escaping (Double) -> Void) {
+ flutterAPI.echoDouble(aDouble: aDouble) { completion($0) }
+ }
+
+ func callFlutterEchoString(aString: String, completion: @escaping (String) -> Void) {
+ flutterAPI.echoString(aString: aString) { completion($0) }
+ }
+
+ func callFlutterEchoUint8List(aList: FlutterStandardTypedData, completion: @escaping (FlutterStandardTypedData) -> Void) {
+ flutterAPI.echoUint8List(aList: aList) { completion($0) }
+ }
+
+ func callFlutterEchoList(aList: [Any?], completion: @escaping ([Any?]) -> Void) {
+ flutterAPI.echoList(aList: aList) { completion($0) }
+ }
+
+ func callFlutterEchoMap(aMap: [String? : Any?], completion: @escaping ([String? : Any?]) -> Void) {
+ flutterAPI.echoMap(aMap: aMap) { completion($0) }
+ }
+
+ func callFlutterEchoNullableBool(aBool: Bool?, completion: @escaping (Bool?) -> Void) {
+ flutterAPI.echoNullableBool(aBool: aBool) { completion($0) }
+ }
+
+ func callFlutterEchoNullableInt(anInt: Int32?, completion: @escaping (Int32?) -> Void) {
+ flutterAPI.echoNullableInt(anInt: anInt) { completion($0) }
+ }
+
+ func callFlutterEchoNullableDouble(aDouble: Double?, completion: @escaping (Double?) -> Void) {
+ flutterAPI.echoNullableDouble(aDouble: aDouble) { completion($0) }
+ }
+
+ func callFlutterEchoNullableString(aString: String?, completion: @escaping (String?) -> Void) {
+ flutterAPI.echoNullableString(aString: aString) { completion($0) }
+ }
+
+ func callFlutterEchoNullableUint8List(aList: FlutterStandardTypedData?, completion: @escaping (FlutterStandardTypedData?) -> Void) {
+ flutterAPI.echoNullableUint8List(aList: aList) { completion($0) }
+ }
+
+ func callFlutterEchoNullableList(aList: [Any?]?, completion: @escaping ([Any?]?) -> Void) {
+ flutterAPI.echoNullableList(aList: aList) { completion($0) }
+ }
+
+ func callFlutterEchoNullableMap(aMap: [String? : Any?]?, completion: @escaping ([String? : Any?]?) -> Void) {
+ flutterAPI.echoNullableMap(aMap: aMap) { completion($0) }
+ }
}
diff --git a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp
index aa09812..30d9b45 100644
--- a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp
+++ b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp
@@ -1314,6 +1314,201 @@
{
auto channel = std::make_unique<flutter::BasicMessageChannel<>>(
binary_messenger,
+ "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoAllTypes",
+ &GetCodec());
+ if (api != nullptr) {
+ channel->SetMessageHandler(
+ [api](const flutter::EncodableValue& message,
+ const flutter::MessageReply<flutter::EncodableValue>& reply) {
+ try {
+ const auto& args = std::get<flutter::EncodableList>(message);
+ const auto& encodable_everything_arg = args.at(0);
+ if (encodable_everything_arg.IsNull()) {
+ reply(WrapError("everything_arg unexpectedly null."));
+ return;
+ }
+ const auto& everything_arg = std::any_cast<const AllTypes&>(
+ std::get<flutter::CustomEncodableValue>(
+ encodable_everything_arg));
+ api->CallFlutterEchoAllTypes(
+ everything_arg, [reply](ErrorOr<AllTypes>&& output) {
+ if (output.has_error()) {
+ reply(WrapError(output.error()));
+ return;
+ }
+ flutter::EncodableList wrapped;
+ wrapped.push_back(flutter::CustomEncodableValue(
+ std::move(output).TakeValue()));
+ reply(flutter::EncodableValue(std::move(wrapped)));
+ });
+ } catch (const std::exception& exception) {
+ reply(WrapError(exception.what()));
+ }
+ });
+ } else {
+ channel->SetMessageHandler(nullptr);
+ }
+ }
+ {
+ auto channel = std::make_unique<flutter::BasicMessageChannel<>>(
+ binary_messenger,
+ "dev.flutter.pigeon.HostIntegrationCoreApi."
+ "callFlutterSendMultipleNullableTypes",
+ &GetCodec());
+ if (api != nullptr) {
+ channel->SetMessageHandler(
+ [api](const flutter::EncodableValue& message,
+ const flutter::MessageReply<flutter::EncodableValue>& reply) {
+ try {
+ const auto& args = std::get<flutter::EncodableList>(message);
+ const auto& encodable_a_nullable_bool_arg = args.at(0);
+ const auto* a_nullable_bool_arg =
+ std::get_if<bool>(&encodable_a_nullable_bool_arg);
+ const auto& encodable_a_nullable_int_arg = args.at(1);
+ const int64_t a_nullable_int_arg_value =
+ encodable_a_nullable_int_arg.IsNull()
+ ? 0
+ : encodable_a_nullable_int_arg.LongValue();
+ const auto* a_nullable_int_arg =
+ encodable_a_nullable_int_arg.IsNull()
+ ? nullptr
+ : &a_nullable_int_arg_value;
+ const auto& encodable_a_nullable_string_arg = args.at(2);
+ const auto* a_nullable_string_arg =
+ std::get_if<std::string>(&encodable_a_nullable_string_arg);
+ api->CallFlutterSendMultipleNullableTypes(
+ a_nullable_bool_arg, a_nullable_int_arg,
+ a_nullable_string_arg,
+ [reply](ErrorOr<AllNullableTypes>&& output) {
+ if (output.has_error()) {
+ reply(WrapError(output.error()));
+ return;
+ }
+ flutter::EncodableList wrapped;
+ wrapped.push_back(flutter::CustomEncodableValue(
+ std::move(output).TakeValue()));
+ reply(flutter::EncodableValue(std::move(wrapped)));
+ });
+ } catch (const std::exception& exception) {
+ reply(WrapError(exception.what()));
+ }
+ });
+ } else {
+ channel->SetMessageHandler(nullptr);
+ }
+ }
+ {
+ auto channel = std::make_unique<flutter::BasicMessageChannel<>>(
+ binary_messenger,
+ "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoBool",
+ &GetCodec());
+ if (api != nullptr) {
+ channel->SetMessageHandler(
+ [api](const flutter::EncodableValue& message,
+ const flutter::MessageReply<flutter::EncodableValue>& reply) {
+ try {
+ const auto& args = std::get<flutter::EncodableList>(message);
+ const auto& encodable_a_bool_arg = args.at(0);
+ if (encodable_a_bool_arg.IsNull()) {
+ reply(WrapError("a_bool_arg unexpectedly null."));
+ return;
+ }
+ const auto& a_bool_arg = std::get<bool>(encodable_a_bool_arg);
+ api->CallFlutterEchoBool(
+ a_bool_arg, [reply](ErrorOr<bool>&& output) {
+ if (output.has_error()) {
+ reply(WrapError(output.error()));
+ return;
+ }
+ flutter::EncodableList wrapped;
+ wrapped.push_back(
+ flutter::EncodableValue(std::move(output).TakeValue()));
+ reply(flutter::EncodableValue(std::move(wrapped)));
+ });
+ } catch (const std::exception& exception) {
+ reply(WrapError(exception.what()));
+ }
+ });
+ } else {
+ channel->SetMessageHandler(nullptr);
+ }
+ }
+ {
+ auto channel = std::make_unique<flutter::BasicMessageChannel<>>(
+ binary_messenger,
+ "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoInt",
+ &GetCodec());
+ if (api != nullptr) {
+ channel->SetMessageHandler(
+ [api](const flutter::EncodableValue& message,
+ const flutter::MessageReply<flutter::EncodableValue>& reply) {
+ try {
+ const auto& args = std::get<flutter::EncodableList>(message);
+ const auto& encodable_an_int_arg = args.at(0);
+ if (encodable_an_int_arg.IsNull()) {
+ reply(WrapError("an_int_arg unexpectedly null."));
+ return;
+ }
+ const int64_t an_int_arg = encodable_an_int_arg.LongValue();
+ api->CallFlutterEchoInt(
+ an_int_arg, [reply](ErrorOr<int64_t>&& output) {
+ if (output.has_error()) {
+ reply(WrapError(output.error()));
+ return;
+ }
+ flutter::EncodableList wrapped;
+ wrapped.push_back(
+ flutter::EncodableValue(std::move(output).TakeValue()));
+ reply(flutter::EncodableValue(std::move(wrapped)));
+ });
+ } catch (const std::exception& exception) {
+ reply(WrapError(exception.what()));
+ }
+ });
+ } else {
+ channel->SetMessageHandler(nullptr);
+ }
+ }
+ {
+ auto channel = std::make_unique<flutter::BasicMessageChannel<>>(
+ binary_messenger,
+ "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoDouble",
+ &GetCodec());
+ if (api != nullptr) {
+ channel->SetMessageHandler(
+ [api](const flutter::EncodableValue& message,
+ const flutter::MessageReply<flutter::EncodableValue>& reply) {
+ try {
+ const auto& args = std::get<flutter::EncodableList>(message);
+ const auto& encodable_a_double_arg = args.at(0);
+ if (encodable_a_double_arg.IsNull()) {
+ reply(WrapError("a_double_arg unexpectedly null."));
+ return;
+ }
+ const auto& a_double_arg =
+ std::get<double>(encodable_a_double_arg);
+ api->CallFlutterEchoDouble(
+ a_double_arg, [reply](ErrorOr<double>&& output) {
+ if (output.has_error()) {
+ reply(WrapError(output.error()));
+ return;
+ }
+ flutter::EncodableList wrapped;
+ wrapped.push_back(
+ flutter::EncodableValue(std::move(output).TakeValue()));
+ reply(flutter::EncodableValue(std::move(wrapped)));
+ });
+ } catch (const std::exception& exception) {
+ reply(WrapError(exception.what()));
+ }
+ });
+ } else {
+ channel->SetMessageHandler(nullptr);
+ }
+ }
+ {
+ auto channel = std::make_unique<flutter::BasicMessageChannel<>>(
+ binary_messenger,
"dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoString",
&GetCodec());
if (api != nullptr) {
@@ -1348,6 +1543,399 @@
channel->SetMessageHandler(nullptr);
}
}
+ {
+ auto channel = std::make_unique<flutter::BasicMessageChannel<>>(
+ binary_messenger,
+ "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoUint8List",
+ &GetCodec());
+ if (api != nullptr) {
+ channel->SetMessageHandler(
+ [api](const flutter::EncodableValue& message,
+ const flutter::MessageReply<flutter::EncodableValue>& reply) {
+ try {
+ const auto& args = std::get<flutter::EncodableList>(message);
+ const auto& encodable_a_list_arg = args.at(0);
+ if (encodable_a_list_arg.IsNull()) {
+ reply(WrapError("a_list_arg unexpectedly null."));
+ return;
+ }
+ const auto& a_list_arg =
+ std::get<std::vector<uint8_t>>(encodable_a_list_arg);
+ api->CallFlutterEchoUint8List(
+ a_list_arg, [reply](ErrorOr<std::vector<uint8_t>>&& output) {
+ if (output.has_error()) {
+ reply(WrapError(output.error()));
+ return;
+ }
+ flutter::EncodableList wrapped;
+ wrapped.push_back(
+ flutter::EncodableValue(std::move(output).TakeValue()));
+ reply(flutter::EncodableValue(std::move(wrapped)));
+ });
+ } catch (const std::exception& exception) {
+ reply(WrapError(exception.what()));
+ }
+ });
+ } else {
+ channel->SetMessageHandler(nullptr);
+ }
+ }
+ {
+ auto channel = std::make_unique<flutter::BasicMessageChannel<>>(
+ binary_messenger,
+ "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoList",
+ &GetCodec());
+ if (api != nullptr) {
+ channel->SetMessageHandler(
+ [api](const flutter::EncodableValue& message,
+ const flutter::MessageReply<flutter::EncodableValue>& reply) {
+ try {
+ const auto& args = std::get<flutter::EncodableList>(message);
+ const auto& encodable_a_list_arg = args.at(0);
+ if (encodable_a_list_arg.IsNull()) {
+ reply(WrapError("a_list_arg unexpectedly null."));
+ return;
+ }
+ const auto& a_list_arg =
+ std::get<flutter::EncodableList>(encodable_a_list_arg);
+ api->CallFlutterEchoList(
+ a_list_arg,
+ [reply](ErrorOr<flutter::EncodableList>&& output) {
+ if (output.has_error()) {
+ reply(WrapError(output.error()));
+ return;
+ }
+ flutter::EncodableList wrapped;
+ wrapped.push_back(
+ flutter::EncodableValue(std::move(output).TakeValue()));
+ reply(flutter::EncodableValue(std::move(wrapped)));
+ });
+ } catch (const std::exception& exception) {
+ reply(WrapError(exception.what()));
+ }
+ });
+ } else {
+ channel->SetMessageHandler(nullptr);
+ }
+ }
+ {
+ auto channel = std::make_unique<flutter::BasicMessageChannel<>>(
+ binary_messenger,
+ "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoMap",
+ &GetCodec());
+ if (api != nullptr) {
+ channel->SetMessageHandler(
+ [api](const flutter::EncodableValue& message,
+ const flutter::MessageReply<flutter::EncodableValue>& reply) {
+ try {
+ const auto& args = std::get<flutter::EncodableList>(message);
+ const auto& encodable_a_map_arg = args.at(0);
+ if (encodable_a_map_arg.IsNull()) {
+ reply(WrapError("a_map_arg unexpectedly null."));
+ return;
+ }
+ const auto& a_map_arg =
+ std::get<flutter::EncodableMap>(encodable_a_map_arg);
+ api->CallFlutterEchoMap(
+ a_map_arg, [reply](ErrorOr<flutter::EncodableMap>&& output) {
+ if (output.has_error()) {
+ reply(WrapError(output.error()));
+ return;
+ }
+ flutter::EncodableList wrapped;
+ wrapped.push_back(
+ flutter::EncodableValue(std::move(output).TakeValue()));
+ reply(flutter::EncodableValue(std::move(wrapped)));
+ });
+ } catch (const std::exception& exception) {
+ reply(WrapError(exception.what()));
+ }
+ });
+ } else {
+ channel->SetMessageHandler(nullptr);
+ }
+ }
+ {
+ auto channel = std::make_unique<flutter::BasicMessageChannel<>>(
+ binary_messenger,
+ "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableBool",
+ &GetCodec());
+ if (api != nullptr) {
+ channel->SetMessageHandler(
+ [api](const flutter::EncodableValue& message,
+ const flutter::MessageReply<flutter::EncodableValue>& reply) {
+ try {
+ const auto& args = std::get<flutter::EncodableList>(message);
+ const auto& encodable_a_bool_arg = args.at(0);
+ const auto* a_bool_arg = std::get_if<bool>(&encodable_a_bool_arg);
+ api->CallFlutterEchoNullableBool(
+ a_bool_arg, [reply](ErrorOr<std::optional<bool>>&& output) {
+ if (output.has_error()) {
+ reply(WrapError(output.error()));
+ return;
+ }
+ flutter::EncodableList wrapped;
+ auto output_optional = std::move(output).TakeValue();
+ if (output_optional) {
+ wrapped.push_back(flutter::EncodableValue(
+ std::move(output_optional).value()));
+ } else {
+ wrapped.push_back(flutter::EncodableValue());
+ }
+ reply(flutter::EncodableValue(std::move(wrapped)));
+ });
+ } catch (const std::exception& exception) {
+ reply(WrapError(exception.what()));
+ }
+ });
+ } else {
+ channel->SetMessageHandler(nullptr);
+ }
+ }
+ {
+ auto channel = std::make_unique<flutter::BasicMessageChannel<>>(
+ binary_messenger,
+ "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableInt",
+ &GetCodec());
+ if (api != nullptr) {
+ channel->SetMessageHandler(
+ [api](const flutter::EncodableValue& message,
+ const flutter::MessageReply<flutter::EncodableValue>& reply) {
+ try {
+ const auto& args = std::get<flutter::EncodableList>(message);
+ const auto& encodable_an_int_arg = args.at(0);
+ const int64_t an_int_arg_value =
+ encodable_an_int_arg.IsNull()
+ ? 0
+ : encodable_an_int_arg.LongValue();
+ const auto* an_int_arg =
+ encodable_an_int_arg.IsNull() ? nullptr : &an_int_arg_value;
+ api->CallFlutterEchoNullableInt(
+ an_int_arg,
+ [reply](ErrorOr<std::optional<int64_t>>&& output) {
+ if (output.has_error()) {
+ reply(WrapError(output.error()));
+ return;
+ }
+ flutter::EncodableList wrapped;
+ auto output_optional = std::move(output).TakeValue();
+ if (output_optional) {
+ wrapped.push_back(flutter::EncodableValue(
+ std::move(output_optional).value()));
+ } else {
+ wrapped.push_back(flutter::EncodableValue());
+ }
+ reply(flutter::EncodableValue(std::move(wrapped)));
+ });
+ } catch (const std::exception& exception) {
+ reply(WrapError(exception.what()));
+ }
+ });
+ } else {
+ channel->SetMessageHandler(nullptr);
+ }
+ }
+ {
+ auto channel = std::make_unique<flutter::BasicMessageChannel<>>(
+ binary_messenger,
+ "dev.flutter.pigeon.HostIntegrationCoreApi."
+ "callFlutterEchoNullableDouble",
+ &GetCodec());
+ if (api != nullptr) {
+ channel->SetMessageHandler(
+ [api](const flutter::EncodableValue& message,
+ const flutter::MessageReply<flutter::EncodableValue>& reply) {
+ try {
+ const auto& args = std::get<flutter::EncodableList>(message);
+ const auto& encodable_a_double_arg = args.at(0);
+ const auto* a_double_arg =
+ std::get_if<double>(&encodable_a_double_arg);
+ api->CallFlutterEchoNullableDouble(
+ a_double_arg,
+ [reply](ErrorOr<std::optional<double>>&& output) {
+ if (output.has_error()) {
+ reply(WrapError(output.error()));
+ return;
+ }
+ flutter::EncodableList wrapped;
+ auto output_optional = std::move(output).TakeValue();
+ if (output_optional) {
+ wrapped.push_back(flutter::EncodableValue(
+ std::move(output_optional).value()));
+ } else {
+ wrapped.push_back(flutter::EncodableValue());
+ }
+ reply(flutter::EncodableValue(std::move(wrapped)));
+ });
+ } catch (const std::exception& exception) {
+ reply(WrapError(exception.what()));
+ }
+ });
+ } else {
+ channel->SetMessageHandler(nullptr);
+ }
+ }
+ {
+ auto channel = std::make_unique<flutter::BasicMessageChannel<>>(
+ binary_messenger,
+ "dev.flutter.pigeon.HostIntegrationCoreApi."
+ "callFlutterEchoNullableString",
+ &GetCodec());
+ if (api != nullptr) {
+ channel->SetMessageHandler(
+ [api](const flutter::EncodableValue& message,
+ const flutter::MessageReply<flutter::EncodableValue>& reply) {
+ try {
+ const auto& args = std::get<flutter::EncodableList>(message);
+ const auto& encodable_a_string_arg = args.at(0);
+ const auto* a_string_arg =
+ std::get_if<std::string>(&encodable_a_string_arg);
+ api->CallFlutterEchoNullableString(
+ a_string_arg,
+ [reply](ErrorOr<std::optional<std::string>>&& output) {
+ if (output.has_error()) {
+ reply(WrapError(output.error()));
+ return;
+ }
+ flutter::EncodableList wrapped;
+ auto output_optional = std::move(output).TakeValue();
+ if (output_optional) {
+ wrapped.push_back(flutter::EncodableValue(
+ std::move(output_optional).value()));
+ } else {
+ wrapped.push_back(flutter::EncodableValue());
+ }
+ reply(flutter::EncodableValue(std::move(wrapped)));
+ });
+ } catch (const std::exception& exception) {
+ reply(WrapError(exception.what()));
+ }
+ });
+ } else {
+ channel->SetMessageHandler(nullptr);
+ }
+ }
+ {
+ auto channel = std::make_unique<flutter::BasicMessageChannel<>>(
+ binary_messenger,
+ "dev.flutter.pigeon.HostIntegrationCoreApi."
+ "callFlutterEchoNullableUint8List",
+ &GetCodec());
+ if (api != nullptr) {
+ channel->SetMessageHandler(
+ [api](const flutter::EncodableValue& message,
+ const flutter::MessageReply<flutter::EncodableValue>& reply) {
+ try {
+ const auto& args = std::get<flutter::EncodableList>(message);
+ const auto& encodable_a_list_arg = args.at(0);
+ const auto* a_list_arg =
+ std::get_if<std::vector<uint8_t>>(&encodable_a_list_arg);
+ api->CallFlutterEchoNullableUint8List(
+ a_list_arg,
+ [reply](
+ ErrorOr<std::optional<std::vector<uint8_t>>>&& output) {
+ if (output.has_error()) {
+ reply(WrapError(output.error()));
+ return;
+ }
+ flutter::EncodableList wrapped;
+ auto output_optional = std::move(output).TakeValue();
+ if (output_optional) {
+ wrapped.push_back(flutter::EncodableValue(
+ std::move(output_optional).value()));
+ } else {
+ wrapped.push_back(flutter::EncodableValue());
+ }
+ reply(flutter::EncodableValue(std::move(wrapped)));
+ });
+ } catch (const std::exception& exception) {
+ reply(WrapError(exception.what()));
+ }
+ });
+ } else {
+ channel->SetMessageHandler(nullptr);
+ }
+ }
+ {
+ auto channel = std::make_unique<flutter::BasicMessageChannel<>>(
+ binary_messenger,
+ "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableList",
+ &GetCodec());
+ if (api != nullptr) {
+ channel->SetMessageHandler(
+ [api](const flutter::EncodableValue& message,
+ const flutter::MessageReply<flutter::EncodableValue>& reply) {
+ try {
+ const auto& args = std::get<flutter::EncodableList>(message);
+ const auto& encodable_a_list_arg = args.at(0);
+ const auto* a_list_arg =
+ std::get_if<flutter::EncodableList>(&encodable_a_list_arg);
+ api->CallFlutterEchoNullableList(
+ a_list_arg,
+ [reply](
+ ErrorOr<std::optional<flutter::EncodableList>>&& output) {
+ if (output.has_error()) {
+ reply(WrapError(output.error()));
+ return;
+ }
+ flutter::EncodableList wrapped;
+ auto output_optional = std::move(output).TakeValue();
+ if (output_optional) {
+ wrapped.push_back(flutter::EncodableValue(
+ std::move(output_optional).value()));
+ } else {
+ wrapped.push_back(flutter::EncodableValue());
+ }
+ reply(flutter::EncodableValue(std::move(wrapped)));
+ });
+ } catch (const std::exception& exception) {
+ reply(WrapError(exception.what()));
+ }
+ });
+ } else {
+ channel->SetMessageHandler(nullptr);
+ }
+ }
+ {
+ auto channel = std::make_unique<flutter::BasicMessageChannel<>>(
+ binary_messenger,
+ "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableMap",
+ &GetCodec());
+ if (api != nullptr) {
+ channel->SetMessageHandler(
+ [api](const flutter::EncodableValue& message,
+ const flutter::MessageReply<flutter::EncodableValue>& reply) {
+ try {
+ const auto& args = std::get<flutter::EncodableList>(message);
+ const auto& encodable_a_map_arg = args.at(0);
+ const auto* a_map_arg =
+ std::get_if<flutter::EncodableMap>(&encodable_a_map_arg);
+ api->CallFlutterEchoNullableMap(
+ a_map_arg,
+ [reply](
+ ErrorOr<std::optional<flutter::EncodableMap>>&& output) {
+ if (output.has_error()) {
+ reply(WrapError(output.error()));
+ return;
+ }
+ flutter::EncodableList wrapped;
+ auto output_optional = std::move(output).TakeValue();
+ if (output_optional) {
+ wrapped.push_back(flutter::EncodableValue(
+ std::move(output_optional).value()));
+ } else {
+ wrapped.push_back(flutter::EncodableValue());
+ }
+ reply(flutter::EncodableValue(std::move(wrapped)));
+ });
+ } catch (const std::exception& exception) {
+ reply(WrapError(exception.what()));
+ }
+ });
+ } else {
+ channel->SetMessageHandler(nullptr);
+ }
+ }
}
flutter::EncodableValue HostIntegrationCoreApi::WrapError(
@@ -1826,8 +2414,8 @@
});
}
void FlutterIntegrationCoreApi::EchoNullableMap(
- const flutter::EncodableMap& a_map_arg,
- std::function<void(const flutter::EncodableMap&)>&& on_success,
+ const flutter::EncodableMap* a_map_arg,
+ std::function<void(const flutter::EncodableMap*)>&& on_success,
std::function<void(const FlutterError&)>&& on_error) {
auto channel = std::make_unique<flutter::BasicMessageChannel<>>(
binary_messenger_,
@@ -1835,7 +2423,8 @@
&GetCodec());
flutter::EncodableValue encoded_api_arguments =
flutter::EncodableValue(flutter::EncodableList{
- flutter::EncodableValue(a_map_arg),
+ a_map_arg ? flutter::EncodableValue(*a_map_arg)
+ : flutter::EncodableValue(),
});
channel->Send(
encoded_api_arguments,
@@ -1844,8 +2433,8 @@
std::unique_ptr<flutter::EncodableValue> response =
GetCodec().DecodeMessage(reply, reply_size);
const auto& encodable_return_value = *response;
- const auto& return_value =
- std::get<flutter::EncodableMap>(encodable_return_value);
+ const auto* return_value =
+ std::get_if<flutter::EncodableMap>(&encodable_return_value);
on_success(return_value);
});
}
diff --git a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h
index ed9c2ee..0bc91f0 100644
--- a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h
+++ b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h
@@ -327,9 +327,56 @@
std::function<void(ErrorOr<std::string> reply)> result) = 0;
virtual void CallFlutterNoop(
std::function<void(std::optional<FlutterError> reply)> result) = 0;
+ virtual void CallFlutterEchoAllTypes(
+ const AllTypes& everything,
+ std::function<void(ErrorOr<AllTypes> reply)> result) = 0;
+ virtual void CallFlutterSendMultipleNullableTypes(
+ const bool* a_nullable_bool, const int64_t* a_nullable_int,
+ const std::string* a_nullable_string,
+ std::function<void(ErrorOr<AllNullableTypes> reply)> result) = 0;
+ virtual void CallFlutterEchoBool(
+ bool a_bool, std::function<void(ErrorOr<bool> reply)> result) = 0;
+ virtual void CallFlutterEchoInt(
+ int64_t an_int, std::function<void(ErrorOr<int64_t> reply)> result) = 0;
+ virtual void CallFlutterEchoDouble(
+ double a_double, std::function<void(ErrorOr<double> reply)> result) = 0;
virtual void CallFlutterEchoString(
const std::string& a_string,
std::function<void(ErrorOr<std::string> reply)> result) = 0;
+ virtual void CallFlutterEchoUint8List(
+ const std::vector<uint8_t>& a_list,
+ std::function<void(ErrorOr<std::vector<uint8_t>> reply)> result) = 0;
+ virtual void CallFlutterEchoList(
+ const flutter::EncodableList& a_list,
+ std::function<void(ErrorOr<flutter::EncodableList> reply)> result) = 0;
+ virtual void CallFlutterEchoMap(
+ const flutter::EncodableMap& a_map,
+ std::function<void(ErrorOr<flutter::EncodableMap> reply)> result) = 0;
+ virtual void CallFlutterEchoNullableBool(
+ const bool* a_bool,
+ std::function<void(ErrorOr<std::optional<bool>> reply)> result) = 0;
+ virtual void CallFlutterEchoNullableInt(
+ const int64_t* an_int,
+ std::function<void(ErrorOr<std::optional<int64_t>> reply)> result) = 0;
+ virtual void CallFlutterEchoNullableDouble(
+ const double* a_double,
+ std::function<void(ErrorOr<std::optional<double>> reply)> result) = 0;
+ virtual void CallFlutterEchoNullableString(
+ const std::string* a_string,
+ std::function<void(ErrorOr<std::optional<std::string>> reply)>
+ result) = 0;
+ virtual void CallFlutterEchoNullableUint8List(
+ const std::vector<uint8_t>* a_list,
+ std::function<void(ErrorOr<std::optional<std::vector<uint8_t>>> reply)>
+ result) = 0;
+ virtual void CallFlutterEchoNullableList(
+ const flutter::EncodableList* a_list,
+ std::function<void(ErrorOr<std::optional<flutter::EncodableList>> reply)>
+ result) = 0;
+ virtual void CallFlutterEchoNullableMap(
+ const flutter::EncodableMap* a_map,
+ std::function<void(ErrorOr<std::optional<flutter::EncodableMap>> reply)>
+ result) = 0;
// The codec used by HostIntegrationCoreApi.
static const flutter::StandardMessageCodec& GetCodec();
@@ -449,8 +496,8 @@
std::function<void(const FlutterError&)>&& on_error);
// Returns the passed map, to test serialization and deserialization.
void EchoNullableMap(
- const flutter::EncodableMap& a_map,
- std::function<void(const flutter::EncodableMap&)>&& on_success,
+ const flutter::EncodableMap* a_map,
+ std::function<void(const flutter::EncodableMap*)>&& on_success,
std::function<void(const FlutterError&)>&& on_error);
};
diff --git a/packages/pigeon/platform_tests/test_plugin/windows/test_plugin.cpp b/packages/pigeon/platform_tests/test_plugin/windows/test_plugin.cpp
index b5477b4..56c0a3a 100644
--- a/packages/pigeon/platform_tests/test_plugin/windows/test_plugin.cpp
+++ b/packages/pigeon/platform_tests/test_plugin/windows/test_plugin.cpp
@@ -23,6 +23,9 @@
using core_tests_pigeontest::FlutterError;
using core_tests_pigeontest::FlutterIntegrationCoreApi;
using core_tests_pigeontest::HostIntegrationCoreApi;
+using flutter::EncodableList;
+using flutter::EncodableMap;
+using flutter::EncodableValue;
// static
void TestPlugin::RegisterWithRegistrar(
@@ -73,8 +76,8 @@
return a_uint8_list;
}
-ErrorOr<flutter::EncodableValue> TestPlugin::EchoObject(
- const flutter::EncodableValue& an_object) {
+ErrorOr<EncodableValue> TestPlugin::EchoObject(
+ const EncodableValue& an_object) {
return an_object;
}
@@ -158,8 +161,8 @@
return *a_nullable_uint8_list;
};
-ErrorOr<std::optional<flutter::EncodableValue>> TestPlugin::EchoNullableObject(
- const flutter::EncodableValue* a_nullable_object) {
+ErrorOr<std::optional<EncodableValue>> TestPlugin::EchoNullableObject(
+ const EncodableValue* a_nullable_object) {
if (!a_nullable_object) {
return std::nullopt;
}
@@ -183,12 +186,153 @@
[result](const FlutterError& error) { result(error); });
}
+void TestPlugin::CallFlutterEchoAllTypes(
+ const AllTypes& everything,
+ std::function<void(ErrorOr<AllTypes> reply)> result) {
+ flutter_api_->EchoAllTypes(
+ everything, [result](const AllTypes& echo) { result(echo); },
+ [result](const FlutterError& error) { result(error); });
+}
+
+void TestPlugin::CallFlutterSendMultipleNullableTypes(
+ const bool* a_nullable_bool, const int64_t* a_nullable_int,
+ const std::string* a_nullable_string,
+ std::function<void(ErrorOr<AllNullableTypes> reply)> result) {
+ flutter_api_->SendMultipleNullableTypes(
+ a_nullable_bool, a_nullable_int, a_nullable_string,
+ [result](const AllNullableTypes& echo) { result(echo); },
+ [result](const FlutterError& error) { result(error); });
+}
+
+void TestPlugin::CallFlutterEchoBool(
+ bool a_bool, std::function<void(ErrorOr<bool> reply)> result) {
+ flutter_api_->EchoBool(
+ a_bool, [result](bool echo) { result(echo); },
+ [result](const FlutterError& error) { result(error); });
+}
+
+void TestPlugin::CallFlutterEchoInt(
+ int64_t an_int, std::function<void(ErrorOr<int64_t> reply)> result) {
+ flutter_api_->EchoInt(
+ an_int, [result](int64_t echo) { result(echo); },
+ [result](const FlutterError& error) { result(error); });
+}
+
+void TestPlugin::CallFlutterEchoDouble(
+ double a_double, std::function<void(ErrorOr<double> reply)> result) {
+ flutter_api_->EchoDouble(
+ a_double, [result](double echo) { result(echo); },
+ [result](const FlutterError& error) { result(error); });
+}
+
void TestPlugin::CallFlutterEchoString(
const std::string& a_string,
std::function<void(ErrorOr<std::string> reply)> result) {
flutter_api_->EchoString(
+ a_string, [result](const std::string& echo) { result(echo); },
+ [result](const FlutterError& error) { result(error); });
+}
+
+void TestPlugin::CallFlutterEchoUint8List(
+ const std::vector<uint8_t>& a_list,
+ std::function<void(ErrorOr<std::vector<uint8_t>> reply)> result) {
+ flutter_api_->EchoUint8List(
+ a_list, [result](const std::vector<uint8_t>& echo) { result(echo); },
+ [result](const FlutterError& error) { result(error); });
+}
+
+void TestPlugin::CallFlutterEchoList(
+ const EncodableList& a_list,
+ std::function<void(ErrorOr<EncodableList> reply)> result) {
+ flutter_api_->EchoList(
+ a_list, [result](const EncodableList& echo) { result(echo); },
+ [result](const FlutterError& error) { result(error); });
+}
+
+void TestPlugin::CallFlutterEchoMap(
+ const EncodableMap& a_map,
+ std::function<void(ErrorOr<EncodableMap> reply)> result) {
+ flutter_api_->EchoMap(
+ a_map, [result](const EncodableMap& echo) { result(echo); },
+ [result](const FlutterError& error) { result(error); });
+}
+
+void TestPlugin::CallFlutterEchoNullableBool(
+ const bool* a_bool,
+ std::function<void(ErrorOr<std::optional<bool>> reply)> result) {
+ flutter_api_->EchoNullableBool(
+ a_bool,
+ [result](const bool* echo) {
+ result(echo ? std::optional<bool>(*echo) : std::nullopt);
+ },
+ [result](const FlutterError& error) { result(error); });
+}
+
+void TestPlugin::CallFlutterEchoNullableInt(
+ const int64_t* an_int,
+ std::function<void(ErrorOr<std::optional<int64_t>> reply)> result) {
+ flutter_api_->EchoNullableInt(
+ an_int,
+ [result](const int64_t* echo) {
+ result(echo ? std::optional<int64_t>(*echo) : std::nullopt);
+ },
+ [result](const FlutterError& error) { result(error); });
+}
+
+void TestPlugin::CallFlutterEchoNullableDouble(
+ const double* a_double,
+ std::function<void(ErrorOr<std::optional<double>> reply)> result) {
+ flutter_api_->EchoNullableDouble(
+ a_double,
+ [result](const double* echo) {
+ result(echo ? std::optional<double>(*echo) : std::nullopt);
+ },
+ [result](const FlutterError& error) { result(error); });
+}
+
+void TestPlugin::CallFlutterEchoNullableString(
+ const std::string* a_string,
+ std::function<void(ErrorOr<std::optional<std::string>> reply)> result) {
+ flutter_api_->EchoNullableString(
a_string,
- [result](const std::string& flutter_string) { result(flutter_string); },
+ [result](const std::string* echo) {
+ result(echo ? std::optional<std::string>(*echo) : std::nullopt);
+ },
+ [result](const FlutterError& error) { result(error); });
+}
+
+void TestPlugin::CallFlutterEchoNullableUint8List(
+ const std::vector<uint8_t>* a_list,
+ std::function<void(ErrorOr<std::optional<std::vector<uint8_t>>> reply)>
+ result) {
+ flutter_api_->EchoNullableUint8List(
+ a_list,
+ [result](const std::vector<uint8_t>* echo) {
+ result(echo ? std::optional<std::vector<uint8_t>>(*echo)
+ : std::nullopt);
+ },
+ [result](const FlutterError& error) { result(error); });
+}
+
+void TestPlugin::CallFlutterEchoNullableList(
+ const EncodableList* a_list,
+ std::function<void(ErrorOr<std::optional<EncodableList>> reply)> result) {
+ flutter_api_->EchoNullableList(
+ a_list,
+ [result](const EncodableList* echo) {
+ result(echo ? std::optional<EncodableList>(*echo) : std::nullopt);
+ },
+ [result](const FlutterError& error) { result(error); });
+}
+
+void TestPlugin::CallFlutterEchoNullableMap(
+ const EncodableMap* a_map,
+ std::function<void(ErrorOr<std::optional<EncodableMap>> reply)> result) {
+ flutter_api_->EchoNullableMap(
+ a_map,
+ [result](const EncodableMap* echo) {
+ result(echo ? std::optional<EncodableMap>(*echo) : std::nullopt);
+ },
[result](const FlutterError& error) { result(error); });
}
diff --git a/packages/pigeon/platform_tests/test_plugin/windows/test_plugin.h b/packages/pigeon/platform_tests/test_plugin/windows/test_plugin.h
index 1c5bb9d..aa0e19c 100644
--- a/packages/pigeon/platform_tests/test_plugin/windows/test_plugin.h
+++ b/packages/pigeon/platform_tests/test_plugin/windows/test_plugin.h
@@ -82,10 +82,88 @@
std::function<
void(std::optional<core_tests_pigeontest::FlutterError> reply)>
result) override;
+ void CallFlutterEchoAllTypes(
+ const core_tests_pigeontest::AllTypes& everything,
+ std::function<
+ void(core_tests_pigeontest::ErrorOr<core_tests_pigeontest::AllTypes>
+ reply)>
+ result) override;
+ void CallFlutterSendMultipleNullableTypes(
+ const bool* a_nullable_bool, const int64_t* a_nullable_int,
+ const std::string* a_nullable_string,
+ std::function<void(core_tests_pigeontest::ErrorOr<
+ core_tests_pigeontest::AllNullableTypes>
+ reply)>
+ result) override;
+ void CallFlutterEchoBool(
+ bool a_bool,
+ std::function<void(core_tests_pigeontest::ErrorOr<bool> reply)> result)
+ override;
+ void CallFlutterEchoInt(
+ int64_t an_int,
+ std::function<void(core_tests_pigeontest::ErrorOr<int64_t> reply)> result)
+ override;
+ void CallFlutterEchoDouble(
+ double a_double,
+ std::function<void(core_tests_pigeontest::ErrorOr<double> reply)> result)
+ override;
void CallFlutterEchoString(
const std::string& a_string,
std::function<void(core_tests_pigeontest::ErrorOr<std::string> reply)>
result) override;
+ void CallFlutterEchoUint8List(
+ const std::vector<uint8_t>& a_list,
+ std::function<
+ void(core_tests_pigeontest::ErrorOr<std::vector<uint8_t>> reply)>
+ result) override;
+ void CallFlutterEchoList(
+ const flutter::EncodableList& a_list,
+ std::function<
+ void(core_tests_pigeontest::ErrorOr<flutter::EncodableList> reply)>
+ result) override;
+ void CallFlutterEchoMap(
+ const flutter::EncodableMap& a_map,
+ std::function<
+ void(core_tests_pigeontest::ErrorOr<flutter::EncodableMap> reply)>
+ result) override;
+ void CallFlutterEchoNullableBool(
+ const bool* a_bool,
+ std::function<
+ void(core_tests_pigeontest::ErrorOr<std::optional<bool>> reply)>
+ result) override;
+ void CallFlutterEchoNullableInt(
+ const int64_t* an_int,
+ std::function<
+ void(core_tests_pigeontest::ErrorOr<std::optional<int64_t>> reply)>
+ result) override;
+ void CallFlutterEchoNullableDouble(
+ const double* a_double,
+ std::function<
+ void(core_tests_pigeontest::ErrorOr<std::optional<double>> reply)>
+ result) override;
+ void CallFlutterEchoNullableString(
+ const std::string* a_string,
+ std::function<void(
+ core_tests_pigeontest::ErrorOr<std::optional<std::string>> reply)>
+ result) override;
+ void CallFlutterEchoNullableUint8List(
+ const std::vector<uint8_t>* a_list,
+ std::function<void(
+ core_tests_pigeontest::ErrorOr<std::optional<std::vector<uint8_t>>>
+ reply)>
+ result) override;
+ void CallFlutterEchoNullableList(
+ const flutter::EncodableList* a_list,
+ std::function<void(
+ core_tests_pigeontest::ErrorOr<std::optional<flutter::EncodableList>>
+ reply)>
+ result) override;
+ void CallFlutterEchoNullableMap(
+ const flutter::EncodableMap* a_map,
+ std::function<void(
+ core_tests_pigeontest::ErrorOr<std::optional<flutter::EncodableMap>>
+ reply)>
+ result) override;
private:
std::unique_ptr<core_tests_pigeontest::FlutterIntegrationCoreApi>