diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/.gitignore b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/.gitignore deleted file mode 100644 index 0fa6b675c0a..00000000000 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/.gitignore +++ /dev/null @@ -1,46 +0,0 @@ -# Miscellaneous -*.class -*.log -*.pyc -*.swp -.DS_Store -.atom/ -.buildlog/ -.history -.svn/ - -# IntelliJ related -*.iml -*.ipr -*.iws -.idea/ - -# The .vscode folder contains launch configuration and tasks you configure in -# VS Code which you may wish to be included in version control, so this line -# is commented out by default. -#.vscode/ - -# Flutter/Dart/Pub related -**/doc/api/ -**/ios/Flutter/.last_build_id -.dart_tool/ -.flutter-plugins -.flutter-plugins-dependencies -.packages -.pub-cache/ -.pub/ -/build/ - -# Web related -lib/generated_plugin_registrant.dart - -# Symbolication related -app.*.symbols - -# Obfuscation related -app.*.map.json - -# Android Studio will place build artifacts here -/android/app/debug -/android/app/profile -/android/app/release diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/.metadata b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/.metadata deleted file mode 100644 index 5db57c1fab4..00000000000 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/.metadata +++ /dev/null @@ -1,10 +0,0 @@ -# This file tracks properties of this Flutter project. -# Used by Flutter tool to assess capabilities and perform upgrades etc. -# -# This file should be version controlled and should not be manually edited. - -version: - revision: 6db3d61ed4a58ba89140d7fe1fd294b598cc29c5 - channel: master - -project_type: app diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/README.md b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/README.md deleted file mode 100644 index 3c52fc95e5c..00000000000 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# flutter_unit_tests - -Unit test scaffold for null safe Flutter projects. diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/.gitignore b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/.gitignore deleted file mode 100644 index 955123f360f..00000000000 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -# TODO(stuartmorgan) Remove this file when these are no longer generated; -# see the TODO in _runFlutterUnitTests in test_suites.dart -async_handlers.gen.dart -host2flutter.gen.dart -list.gen.dart -void_arg_flutter.gen.dart -void_arg_host.gen.dart -voidflutter.gen.dart -voidhost.gen.dart diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/core_tests.gen.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/core_tests.gen.dart deleted file mode 100644 index 6c0ded63c25..00000000000 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/core_tests.gen.dart +++ /dev/null @@ -1,2738 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// -// Autogenerated from Pigeon (v10.1.4), do not edit directly. -// See also: https://pub.dev/packages/pigeon -// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import - -import 'dart:async'; -import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; - -import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; -import 'package:flutter/services.dart'; - -enum AnEnum { - one, - two, - three, -} - -/// A class containing all supported types. -class AllTypes { - AllTypes({ - required this.aBool, - required this.anInt, - required this.anInt64, - required this.aDouble, - required this.aByteArray, - required this.a4ByteArray, - required this.a8ByteArray, - required this.aFloatArray, - required this.aList, - required this.aMap, - required this.anEnum, - required this.aString, - required this.anObject, - }); - - bool aBool; - - int anInt; - - int anInt64; - - double aDouble; - - Uint8List aByteArray; - - Int32List a4ByteArray; - - Int64List a8ByteArray; - - Float64List aFloatArray; - - List aList; - - Map aMap; - - AnEnum anEnum; - - String aString; - - Object anObject; - - Object encode() { - return [ - aBool, - anInt, - anInt64, - aDouble, - aByteArray, - a4ByteArray, - a8ByteArray, - aFloatArray, - aList, - aMap, - anEnum.index, - aString, - anObject, - ]; - } - - static AllTypes decode(Object result) { - result as List; - return AllTypes( - aBool: result[0]! as bool, - anInt: result[1]! as int, - anInt64: result[2]! as int, - aDouble: result[3]! as double, - aByteArray: result[4]! as Uint8List, - a4ByteArray: result[5]! as Int32List, - a8ByteArray: result[6]! as Int64List, - aFloatArray: result[7]! as Float64List, - aList: result[8]! as List, - aMap: result[9]! as Map, - anEnum: AnEnum.values[result[10]! as int], - aString: result[11]! as String, - anObject: result[12]!, - ); - } -} - -/// A class containing all supported nullable types. -class AllNullableTypes { - AllNullableTypes({ - this.aNullableBool, - this.aNullableInt, - this.aNullableInt64, - this.aNullableDouble, - this.aNullableByteArray, - this.aNullable4ByteArray, - this.aNullable8ByteArray, - this.aNullableFloatArray, - this.aNullableList, - this.aNullableMap, - this.nullableNestedList, - this.nullableMapWithAnnotations, - this.nullableMapWithObject, - this.aNullableEnum, - this.aNullableString, - this.aNullableObject, - }); - - bool? aNullableBool; - - int? aNullableInt; - - int? aNullableInt64; - - double? aNullableDouble; - - Uint8List? aNullableByteArray; - - Int32List? aNullable4ByteArray; - - Int64List? aNullable8ByteArray; - - Float64List? aNullableFloatArray; - - List? aNullableList; - - Map? aNullableMap; - - List?>? nullableNestedList; - - Map? nullableMapWithAnnotations; - - Map? nullableMapWithObject; - - AnEnum? aNullableEnum; - - String? aNullableString; - - Object? aNullableObject; - - Object encode() { - return [ - aNullableBool, - aNullableInt, - aNullableInt64, - aNullableDouble, - aNullableByteArray, - aNullable4ByteArray, - aNullable8ByteArray, - aNullableFloatArray, - aNullableList, - aNullableMap, - nullableNestedList, - nullableMapWithAnnotations, - nullableMapWithObject, - aNullableEnum?.index, - aNullableString, - aNullableObject, - ]; - } - - static AllNullableTypes decode(Object result) { - result as List; - return AllNullableTypes( - aNullableBool: result[0] as bool?, - aNullableInt: result[1] as int?, - aNullableInt64: result[2] as int?, - aNullableDouble: result[3] as double?, - aNullableByteArray: result[4] as Uint8List?, - aNullable4ByteArray: result[5] as Int32List?, - aNullable8ByteArray: result[6] as Int64List?, - aNullableFloatArray: result[7] as Float64List?, - aNullableList: result[8] as List?, - aNullableMap: result[9] as Map?, - nullableNestedList: (result[10] as List?)?.cast?>(), - nullableMapWithAnnotations: - (result[11] as Map?)?.cast(), - nullableMapWithObject: - (result[12] as Map?)?.cast(), - aNullableEnum: - result[13] != null ? AnEnum.values[result[13]! as int] : null, - aNullableString: result[14] as String?, - aNullableObject: result[15], - ); - } -} - -/// A class for testing nested class handling. -/// -/// This is needed to test nested nullable and non-nullable classes, -/// `AllNullableTypes` is non-nullable here as it is easier to instantiate -/// than `AllTypes` when testing doesn't require both (ie. testing null classes). -class AllClassesWrapper { - AllClassesWrapper({ - required this.allNullableTypes, - this.allTypes, - }); - - AllNullableTypes allNullableTypes; - - AllTypes? allTypes; - - Object encode() { - return [ - allNullableTypes.encode(), - allTypes?.encode(), - ]; - } - - static AllClassesWrapper decode(Object result) { - result as List; - return AllClassesWrapper( - allNullableTypes: AllNullableTypes.decode(result[0]! as List), - allTypes: result[1] != null - ? AllTypes.decode(result[1]! as List) - : null, - ); - } -} - -/// A data class containing a List, used in unit tests. -class TestMessage { - TestMessage({ - this.testList, - }); - - List? testList; - - Object encode() { - return [ - testList, - ]; - } - - static TestMessage decode(Object result) { - result as List; - return TestMessage( - testList: result[0] as List?, - ); - } -} - -class _HostIntegrationCoreApiCodec extends StandardMessageCodec { - const _HostIntegrationCoreApiCodec(); - @override - void writeValue(WriteBuffer buffer, Object? value) { - if (value is AllClassesWrapper) { - buffer.putUint8(128); - writeValue(buffer, value.encode()); - } else if (value is AllNullableTypes) { - buffer.putUint8(129); - writeValue(buffer, value.encode()); - } else if (value is AllTypes) { - buffer.putUint8(130); - writeValue(buffer, value.encode()); - } else if (value is TestMessage) { - buffer.putUint8(131); - writeValue(buffer, value.encode()); - } else { - super.writeValue(buffer, value); - } - } - - @override - Object? readValueOfType(int type, ReadBuffer buffer) { - switch (type) { - case 128: - return AllClassesWrapper.decode(readValue(buffer)!); - case 129: - return AllNullableTypes.decode(readValue(buffer)!); - case 130: - return AllTypes.decode(readValue(buffer)!); - case 131: - return TestMessage.decode(readValue(buffer)!); - default: - return super.readValueOfType(type, buffer); - } - } -} - -/// The core interface that each host language plugin must implement in -/// platform_test integration tests. -class HostIntegrationCoreApi { - /// Constructor for [HostIntegrationCoreApi]. The [binaryMessenger] named argument is - /// available for dependency injection. If it is left null, the default - /// BinaryMessenger will be used which routes to the host platform. - HostIntegrationCoreApi({BinaryMessenger? binaryMessenger}) - : _binaryMessenger = binaryMessenger; - final BinaryMessenger? _binaryMessenger; - - static const MessageCodec codec = _HostIntegrationCoreApiCodec(); - - /// A no-op function taking no arguments and returning no value, to sanity - /// test basic calling. - Future noop() async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.noop', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else { - return; - } - } - - /// Returns the passed object, to test serialization and deserialization. - Future echoAllTypes(AllTypes arg_everything) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoAllTypes', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_everything]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else if (replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (replyList[0] as AllTypes?)!; - } - } - - /// Returns an error, to test error handling. - Future throwError() async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.throwError', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else { - return replyList[0]; - } - } - - /// Returns an error from a void function, to test error handling. - Future throwErrorFromVoid() async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.throwErrorFromVoid', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else { - return; - } - } - - /// Returns a Flutter error, to test error handling. - Future throwFlutterError() async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.throwFlutterError', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else { - return replyList[0]; - } - } - - /// Returns passed in int. - Future echoInt(int arg_anInt) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoInt', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_anInt]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else if (replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (replyList[0] as int?)!; - } - } - - /// Returns passed in double. - Future echoDouble(double arg_aDouble) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoDouble', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aDouble]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else if (replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (replyList[0] as double?)!; - } - } - - /// Returns the passed in boolean. - Future echoBool(bool arg_aBool) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoBool', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aBool]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else if (replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (replyList[0] as bool?)!; - } - } - - /// Returns the passed in string. - Future echoString(String arg_aString) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoString', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aString]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else if (replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (replyList[0] as String?)!; - } - } - - /// Returns the passed in Uint8List. - Future echoUint8List(Uint8List arg_aUint8List) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoUint8List', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aUint8List]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else if (replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (replyList[0] as Uint8List?)!; - } - } - - /// Returns the passed in generic Object. - Future echoObject(Object arg_anObject) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoObject', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_anObject]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else if (replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return replyList[0]!; - } - } - - /// Returns the passed list, to test serialization and deserialization. - Future> echoList(List arg_aList) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoList', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aList]) as List?; - 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?)!.cast(); - } - } - - /// Returns the passed map, to test serialization and deserialization. - Future> echoMap(Map arg_aMap) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoMap', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aMap]) as List?; - 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?)!.cast(); - } - } - - /// Returns the passed map to test nested class serialization and deserialization. - Future echoClassWrapper( - AllClassesWrapper arg_wrapper) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoClassWrapper', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_wrapper]) as List?; - 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 AllClassesWrapper?)!; - } - } - - /// Returns the passed object, to test serialization and deserialization. - Future echoAllNullableTypes( - AllNullableTypes? arg_everything) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoAllNullableTypes', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_everything]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else { - return (replyList[0] as AllNullableTypes?); - } - } - - /// Returns the inner `aString` value from the wrapped object, to test - /// sending of nested objects. - Future extractNestedNullableString( - AllClassesWrapper arg_wrapper) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.extractNestedNullableString', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_wrapper]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else { - return (replyList[0] as String?); - } - } - - /// Returns the inner `aString` value from the wrapped object, to test - /// sending of nested objects. - Future createNestedNullableString( - String? arg_nullableString) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.createNestedNullableString', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_nullableString]) as List?; - 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 AllClassesWrapper?)!; - } - } - - /// Returns passed in arguments of multiple types. - Future sendMultipleNullableTypes(bool? arg_aNullableBool, - int? arg_aNullableInt, String? arg_aNullableString) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.sendMultipleNullableTypes', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send( - [arg_aNullableBool, arg_aNullableInt, arg_aNullableString]) - as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else if (replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (replyList[0] as AllNullableTypes?)!; - } - } - - /// Returns passed in int. - Future echoNullableInt(int? arg_aNullableInt) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoNullableInt', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aNullableInt]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else { - return (replyList[0] as int?); - } - } - - /// Returns passed in double. - Future echoNullableDouble(double? arg_aNullableDouble) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoNullableDouble', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aNullableDouble]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else { - return (replyList[0] as double?); - } - } - - /// Returns the passed in boolean. - Future echoNullableBool(bool? arg_aNullableBool) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoNullableBool', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aNullableBool]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else { - return (replyList[0] as bool?); - } - } - - /// Returns the passed in string. - Future echoNullableString(String? arg_aNullableString) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoNullableString', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aNullableString]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else { - return (replyList[0] as String?); - } - } - - /// Returns the passed in Uint8List. - Future echoNullableUint8List( - Uint8List? arg_aNullableUint8List) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoNullableUint8List', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aNullableUint8List]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else { - return (replyList[0] as Uint8List?); - } - } - - /// Returns the passed in generic Object. - Future echoNullableObject(Object? arg_aNullableObject) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoNullableObject', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aNullableObject]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else { - return replyList[0]; - } - } - - /// Returns the passed list, to test serialization and deserialization. - Future?> echoNullableList( - List? arg_aNullableList) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoNullableList', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aNullableList]) as List?; - 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?)?.cast(); - } - } - - /// Returns the passed map, to test serialization and deserialization. - Future?> echoNullableMap( - Map? arg_aNullableMap) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoNullableMap', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aNullableMap]) as List?; - 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?)?.cast(); - } - } - - /// A no-op function taking no arguments and returning no value, to sanity - /// test basic asynchronous calling. - Future noopAsync() async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.noopAsync', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else { - return; - } - } - - /// Returns passed in int asynchronously. - Future echoAsyncInt(int arg_anInt) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoAsyncInt', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_anInt]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else if (replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (replyList[0] as int?)!; - } - } - - /// Returns passed in double asynchronously. - Future echoAsyncDouble(double arg_aDouble) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoAsyncDouble', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aDouble]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else if (replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (replyList[0] as double?)!; - } - } - - /// Returns the passed in boolean asynchronously. - Future echoAsyncBool(bool arg_aBool) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoAsyncBool', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aBool]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else if (replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (replyList[0] as bool?)!; - } - } - - /// Returns the passed string asynchronously. - Future echoAsyncString(String arg_aString) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoAsyncString', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aString]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else if (replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (replyList[0] as String?)!; - } - } - - /// Returns the passed in Uint8List asynchronously. - Future echoAsyncUint8List(Uint8List arg_aUint8List) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoAsyncUint8List', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aUint8List]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else if (replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (replyList[0] as Uint8List?)!; - } - } - - /// Returns the passed in generic Object asynchronously. - Future echoAsyncObject(Object arg_anObject) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoAsyncObject', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_anObject]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else if (replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return replyList[0]!; - } - } - - /// Returns the passed list, to test serialization and deserialization asynchronously. - Future> echoAsyncList(List arg_aList) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoAsyncList', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aList]) as List?; - 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?)!.cast(); - } - } - - /// Returns the passed map, to test serialization and deserialization asynchronously. - Future> echoAsyncMap( - Map arg_aMap) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoAsyncMap', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aMap]) as List?; - 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?)!.cast(); - } - } - - /// Responds with an error from an async function returning a value. - Future throwAsyncError() async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.throwAsyncError', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else { - return replyList[0]; - } - } - - /// Responds with an error from an async void function. - Future throwAsyncErrorFromVoid() async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.throwAsyncErrorFromVoid', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; - 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; - } - } - - /// Responds with a Flutter error from an async function returning a value. - Future throwAsyncFlutterError() async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.throwAsyncFlutterError', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else { - return replyList[0]; - } - } - - /// Returns the passed object, to test async serialization and deserialization. - Future echoAsyncAllTypes(AllTypes arg_everything) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoAsyncAllTypes', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_everything]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else if (replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (replyList[0] as AllTypes?)!; - } - } - - /// Returns the passed object, to test serialization and deserialization. - Future echoAsyncNullableAllNullableTypes( - AllNullableTypes? arg_everything) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoAsyncNullableAllNullableTypes', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_everything]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else { - return (replyList[0] as AllNullableTypes?); - } - } - - /// Returns passed in int asynchronously. - Future echoAsyncNullableInt(int? arg_anInt) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoAsyncNullableInt', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_anInt]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else { - return (replyList[0] as int?); - } - } - - /// Returns passed in double asynchronously. - Future echoAsyncNullableDouble(double? arg_aDouble) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoAsyncNullableDouble', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aDouble]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else { - return (replyList[0] as double?); - } - } - - /// Returns the passed in boolean asynchronously. - Future echoAsyncNullableBool(bool? arg_aBool) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoAsyncNullableBool', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aBool]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else { - return (replyList[0] as bool?); - } - } - - /// Returns the passed string asynchronously. - Future echoAsyncNullableString(String? arg_aString) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoAsyncNullableString', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aString]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else { - return (replyList[0] as String?); - } - } - - /// Returns the passed in Uint8List asynchronously. - Future echoAsyncNullableUint8List( - Uint8List? arg_aUint8List) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoAsyncNullableUint8List', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aUint8List]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else { - return (replyList[0] as Uint8List?); - } - } - - /// Returns the passed in generic Object asynchronously. - Future echoAsyncNullableObject(Object? arg_anObject) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoAsyncNullableObject', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_anObject]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else { - return replyList[0]; - } - } - - /// Returns the passed list, to test serialization and deserialization asynchronously. - Future?> echoAsyncNullableList(List? arg_aList) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoAsyncNullableList', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aList]) as List?; - 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?)?.cast(); - } - } - - /// Returns the passed map, to test serialization and deserialization asynchronously. - Future?> echoAsyncNullableMap( - Map? arg_aMap) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.echoAsyncNullableMap', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aMap]) as List?; - 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?)?.cast(); - } - } - - Future callFlutterNoop() async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.callFlutterNoop', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else { - return; - } - } - - Future callFlutterThrowError() async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.callFlutterThrowError', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else { - return replyList[0]; - } - } - - Future callFlutterThrowErrorFromVoid() async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.callFlutterThrowErrorFromVoid', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else { - return; - } - } - - Future callFlutterEchoAllTypes(AllTypes arg_everything) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.callFlutterEchoAllTypes', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_everything]) as List?; - 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 callFlutterSendMultipleNullableTypes( - bool? arg_aNullableBool, - int? arg_aNullableInt, - String? arg_aNullableString) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.callFlutterSendMultipleNullableTypes', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send( - [arg_aNullableBool, arg_aNullableInt, arg_aNullableString]) - as List?; - 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 callFlutterEchoBool(bool arg_aBool) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.callFlutterEchoBool', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aBool]) as List?; - 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 callFlutterEchoInt(int arg_anInt) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.callFlutterEchoInt', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_anInt]) as List?; - 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 callFlutterEchoDouble(double arg_aDouble) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.callFlutterEchoDouble', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aDouble]) as List?; - 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 callFlutterEchoString(String arg_aString) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.callFlutterEchoString', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aString]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else if (replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (replyList[0] as String?)!; - } - } - - Future callFlutterEchoUint8List(Uint8List arg_aList) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.callFlutterEchoUint8List', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aList]) as List?; - 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> callFlutterEchoList(List arg_aList) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.callFlutterEchoList', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aList]) as List?; - 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?)!.cast(); - } - } - - Future> callFlutterEchoMap( - Map arg_aMap) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.callFlutterEchoMap', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aMap]) as List?; - 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?)!.cast(); - } - } - - Future callFlutterEchoNullableBool(bool? arg_aBool) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.callFlutterEchoNullableBool', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aBool]) as List?; - 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 callFlutterEchoNullableInt(int? arg_anInt) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.callFlutterEchoNullableInt', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_anInt]) as List?; - 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 callFlutterEchoNullableDouble(double? arg_aDouble) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.callFlutterEchoNullableDouble', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aDouble]) as List?; - 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 callFlutterEchoNullableString(String? arg_aString) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.callFlutterEchoNullableString', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aString]) as List?; - 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 callFlutterEchoNullableUint8List( - Uint8List? arg_aList) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.callFlutterEchoNullableUint8List', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aList]) as List?; - 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?> callFlutterEchoNullableList( - List? arg_aList) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.callFlutterEchoNullableList', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aList]) as List?; - 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?)?.cast(); - } - } - - Future?> callFlutterEchoNullableMap( - Map? arg_aMap) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostIntegrationCoreApi.callFlutterEchoNullableMap', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aMap]) as List?; - 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?)?.cast(); - } - } -} - -class _FlutterIntegrationCoreApiCodec extends StandardMessageCodec { - const _FlutterIntegrationCoreApiCodec(); - @override - void writeValue(WriteBuffer buffer, Object? value) { - if (value is AllClassesWrapper) { - buffer.putUint8(128); - writeValue(buffer, value.encode()); - } else if (value is AllNullableTypes) { - buffer.putUint8(129); - writeValue(buffer, value.encode()); - } else if (value is AllTypes) { - buffer.putUint8(130); - writeValue(buffer, value.encode()); - } else if (value is TestMessage) { - buffer.putUint8(131); - writeValue(buffer, value.encode()); - } else { - super.writeValue(buffer, value); - } - } - - @override - Object? readValueOfType(int type, ReadBuffer buffer) { - switch (type) { - case 128: - return AllClassesWrapper.decode(readValue(buffer)!); - case 129: - return AllNullableTypes.decode(readValue(buffer)!); - case 130: - return AllTypes.decode(readValue(buffer)!); - case 131: - return TestMessage.decode(readValue(buffer)!); - default: - return super.readValueOfType(type, buffer); - } - } -} - -/// The core interface that the Dart platform_test code implements for host -/// integration tests to call into. -abstract class FlutterIntegrationCoreApi { - static const MessageCodec codec = _FlutterIntegrationCoreApiCodec(); - - /// A no-op function taking no arguments and returning no value, to sanity - /// test basic calling. - void noop(); - - /// Responds with an error from an async function returning a value. - Object? throwError(); - - /// Responds with an error from an async void function. - void throwErrorFromVoid(); - - /// Returns the passed object, to test serialization and deserialization. - AllTypes echoAllTypes(AllTypes everything); - - /// Returns the passed object, to test serialization and deserialization. - AllNullableTypes echoAllNullableTypes(AllNullableTypes everything); - - /// Returns passed in arguments of multiple types. - /// - /// Tests multiple-arity FlutterApi handling. - AllNullableTypes sendMultipleNullableTypes( - bool? aNullableBool, int? aNullableInt, String? aNullableString); - - /// Returns the passed boolean, to test serialization and deserialization. - bool echoBool(bool aBool); - - /// Returns the passed int, to test serialization and deserialization. - int echoInt(int anInt); - - /// Returns the passed double, to test serialization and deserialization. - double echoDouble(double aDouble); - - /// Returns the passed string, to test serialization and deserialization. - String echoString(String aString); - - /// Returns the passed byte list, to test serialization and deserialization. - Uint8List echoUint8List(Uint8List aList); - - /// Returns the passed list, to test serialization and deserialization. - List echoList(List aList); - - /// Returns the passed map, to test serialization and deserialization. - Map echoMap(Map aMap); - - /// Returns the passed boolean, to test serialization and deserialization. - bool? echoNullableBool(bool? aBool); - - /// Returns the passed int, to test serialization and deserialization. - int? echoNullableInt(int? anInt); - - /// Returns the passed double, to test serialization and deserialization. - double? echoNullableDouble(double? aDouble); - - /// Returns the passed string, to test serialization and deserialization. - String? echoNullableString(String? aString); - - /// Returns the passed byte list, to test serialization and deserialization. - Uint8List? echoNullableUint8List(Uint8List? aList); - - /// Returns the passed list, to test serialization and deserialization. - List? echoNullableList(List? aList); - - /// Returns the passed map, to test serialization and deserialization. - Map? echoNullableMap(Map? aMap); - - /// A no-op function taking no arguments and returning no value, to sanity - /// test basic asynchronous calling. - Future noopAsync(); - - /// Returns the passed in generic Object asynchronously. - Future echoAsyncString(String aString); - - static void setup(FlutterIntegrationCoreApi? api, - {BinaryMessenger? binaryMessenger}) { - { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.noop', - codec, - binaryMessenger: binaryMessenger); - if (api == null) { - channel.setMessageHandler(null); - } else { - channel.setMessageHandler((Object? message) async { - // ignore message - api.noop(); - return; - }); - } - } - { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.throwError', - codec, - binaryMessenger: binaryMessenger); - if (api == null) { - channel.setMessageHandler(null); - } else { - channel.setMessageHandler((Object? message) async { - // ignore message - final Object? output = api.throwError(); - return output; - }); - } - } - { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.throwErrorFromVoid', - codec, - binaryMessenger: binaryMessenger); - if (api == null) { - channel.setMessageHandler(null); - } else { - channel.setMessageHandler((Object? message) async { - // ignore message - api.throwErrorFromVoid(); - return; - }); - } - } - { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoAllTypes', - codec, - binaryMessenger: binaryMessenger); - if (api == null) { - channel.setMessageHandler(null); - } else { - channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoAllTypes was null.'); - final List args = (message as List?)!; - final AllTypes? arg_everything = (args[0] as AllTypes?); - assert(arg_everything != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoAllTypes was null, expected non-null AllTypes.'); - final AllTypes output = api.echoAllTypes(arg_everything!); - return output; - }); - } - } - { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoAllNullableTypes', - codec, - binaryMessenger: binaryMessenger); - if (api == null) { - channel.setMessageHandler(null); - } else { - channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoAllNullableTypes was null.'); - final List args = (message as List?)!; - final AllNullableTypes? arg_everything = - (args[0] as AllNullableTypes?); - assert(arg_everything != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoAllNullableTypes was null, expected non-null AllNullableTypes.'); - final AllNullableTypes output = - api.echoAllNullableTypes(arg_everything!); - return output; - }); - } - } - { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.sendMultipleNullableTypes', - codec, - binaryMessenger: binaryMessenger); - if (api == null) { - channel.setMessageHandler(null); - } else { - channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.sendMultipleNullableTypes was null.'); - final List args = (message as List?)!; - final bool? arg_aNullableBool = (args[0] as bool?); - final int? arg_aNullableInt = (args[1] as int?); - final String? arg_aNullableString = (args[2] as String?); - final AllNullableTypes output = api.sendMultipleNullableTypes( - arg_aNullableBool, arg_aNullableInt, arg_aNullableString); - return output; - }); - } - } - { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoBool', - codec, - binaryMessenger: binaryMessenger); - if (api == null) { - channel.setMessageHandler(null); - } else { - channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoBool was null.'); - final List args = (message as List?)!; - final bool? arg_aBool = (args[0] as bool?); - assert(arg_aBool != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoBool was null, expected non-null bool.'); - final bool output = api.echoBool(arg_aBool!); - return output; - }); - } - } - { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoInt', - codec, - binaryMessenger: binaryMessenger); - if (api == null) { - channel.setMessageHandler(null); - } else { - channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoInt was null.'); - final List args = (message as List?)!; - final int? arg_anInt = (args[0] as int?); - assert(arg_anInt != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoInt was null, expected non-null int.'); - final int output = api.echoInt(arg_anInt!); - return output; - }); - } - } - { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoDouble', - codec, - binaryMessenger: binaryMessenger); - if (api == null) { - channel.setMessageHandler(null); - } else { - channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoDouble was null.'); - final List args = (message as List?)!; - final double? arg_aDouble = (args[0] as double?); - assert(arg_aDouble != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoDouble was null, expected non-null double.'); - final double output = api.echoDouble(arg_aDouble!); - return output; - }); - } - } - { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoString', - codec, - binaryMessenger: binaryMessenger); - if (api == null) { - channel.setMessageHandler(null); - } else { - channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoString was null.'); - final List args = (message as List?)!; - final String? arg_aString = (args[0] as String?); - assert(arg_aString != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoString was null, expected non-null String.'); - final String output = api.echoString(arg_aString!); - return output; - }); - } - } - { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoUint8List', - codec, - binaryMessenger: binaryMessenger); - if (api == null) { - channel.setMessageHandler(null); - } else { - channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoUint8List was null.'); - final List args = (message as List?)!; - final Uint8List? arg_aList = (args[0] as Uint8List?); - assert(arg_aList != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoUint8List was null, expected non-null Uint8List.'); - final Uint8List output = api.echoUint8List(arg_aList!); - return output; - }); - } - } - { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoList', - codec, - binaryMessenger: binaryMessenger); - if (api == null) { - channel.setMessageHandler(null); - } else { - channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoList was null.'); - final List args = (message as List?)!; - final List? arg_aList = - (args[0] as List?)?.cast(); - assert(arg_aList != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoList was null, expected non-null List.'); - final List output = api.echoList(arg_aList!); - return output; - }); - } - } - { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoMap', - codec, - binaryMessenger: binaryMessenger); - if (api == null) { - channel.setMessageHandler(null); - } else { - channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoMap was null.'); - final List args = (message as List?)!; - final Map? arg_aMap = - (args[0] as Map?)?.cast(); - assert(arg_aMap != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoMap was null, expected non-null Map.'); - final Map output = api.echoMap(arg_aMap!); - return output; - }); - } - } - { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoNullableBool', - codec, - binaryMessenger: binaryMessenger); - if (api == null) { - channel.setMessageHandler(null); - } else { - channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoNullableBool was null.'); - final List args = (message as List?)!; - final bool? arg_aBool = (args[0] as bool?); - final bool? output = api.echoNullableBool(arg_aBool); - return output; - }); - } - } - { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoNullableInt', - codec, - binaryMessenger: binaryMessenger); - if (api == null) { - channel.setMessageHandler(null); - } else { - channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoNullableInt was null.'); - final List args = (message as List?)!; - final int? arg_anInt = (args[0] as int?); - final int? output = api.echoNullableInt(arg_anInt); - return output; - }); - } - } - { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoNullableDouble', - codec, - binaryMessenger: binaryMessenger); - if (api == null) { - channel.setMessageHandler(null); - } else { - channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoNullableDouble was null.'); - final List args = (message as List?)!; - final double? arg_aDouble = (args[0] as double?); - final double? output = api.echoNullableDouble(arg_aDouble); - return output; - }); - } - } - { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoNullableString', - codec, - binaryMessenger: binaryMessenger); - if (api == null) { - channel.setMessageHandler(null); - } else { - channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoNullableString was null.'); - final List args = (message as List?)!; - final String? arg_aString = (args[0] as String?); - final String? output = api.echoNullableString(arg_aString); - return output; - }); - } - } - { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoNullableUint8List', - codec, - binaryMessenger: binaryMessenger); - if (api == null) { - channel.setMessageHandler(null); - } else { - channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoNullableUint8List was null.'); - final List args = (message as List?)!; - final Uint8List? arg_aList = (args[0] as Uint8List?); - final Uint8List? output = api.echoNullableUint8List(arg_aList); - return output; - }); - } - } - { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoNullableList', - codec, - binaryMessenger: binaryMessenger); - if (api == null) { - channel.setMessageHandler(null); - } else { - channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoNullableList was null.'); - final List args = (message as List?)!; - final List? arg_aList = - (args[0] as List?)?.cast(); - final List? output = api.echoNullableList(arg_aList); - return output; - }); - } - } - { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoNullableMap', - codec, - binaryMessenger: binaryMessenger); - if (api == null) { - channel.setMessageHandler(null); - } else { - channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoNullableMap was null.'); - final List args = (message as List?)!; - final Map? arg_aMap = - (args[0] as Map?)?.cast(); - final Map? output = api.echoNullableMap(arg_aMap); - return output; - }); - } - } - { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.noopAsync', - codec, - binaryMessenger: binaryMessenger); - if (api == null) { - channel.setMessageHandler(null); - } else { - channel.setMessageHandler((Object? message) async { - // ignore message - await api.noopAsync(); - return; - }); - } - } - { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoAsyncString', - codec, - binaryMessenger: binaryMessenger); - if (api == null) { - channel.setMessageHandler(null); - } else { - channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoAsyncString was null.'); - final List args = (message as List?)!; - final String? arg_aString = (args[0] as String?); - assert(arg_aString != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.FlutterIntegrationCoreApi.echoAsyncString was null, expected non-null String.'); - final String output = await api.echoAsyncString(arg_aString!); - return output; - }); - } - } - } -} - -/// An API that can be implemented for minimal, compile-only tests. -class HostTrivialApi { - /// Constructor for [HostTrivialApi]. The [binaryMessenger] named argument is - /// available for dependency injection. If it is left null, the default - /// BinaryMessenger will be used which routes to the host platform. - HostTrivialApi({BinaryMessenger? binaryMessenger}) - : _binaryMessenger = binaryMessenger; - final BinaryMessenger? _binaryMessenger; - - static const MessageCodec codec = StandardMessageCodec(); - - Future noop() async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostTrivialApi.noop', codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else { - return; - } - } -} - -/// A simple API implemented in some unit tests. -class HostSmallApi { - /// Constructor for [HostSmallApi]. The [binaryMessenger] named argument is - /// available for dependency injection. If it is left null, the default - /// BinaryMessenger will be used which routes to the host platform. - HostSmallApi({BinaryMessenger? binaryMessenger}) - : _binaryMessenger = binaryMessenger; - final BinaryMessenger? _binaryMessenger; - - static const MessageCodec codec = StandardMessageCodec(); - - Future echo(String arg_aString) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostSmallApi.echo', codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aString]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else if (replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (replyList[0] as String?)!; - } - } - - Future voidVoid() async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.HostSmallApi.voidVoid', codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else { - return; - } - } -} - -class _FlutterSmallApiCodec extends StandardMessageCodec { - const _FlutterSmallApiCodec(); - @override - void writeValue(WriteBuffer buffer, Object? value) { - if (value is TestMessage) { - buffer.putUint8(128); - writeValue(buffer, value.encode()); - } else { - super.writeValue(buffer, value); - } - } - - @override - Object? readValueOfType(int type, ReadBuffer buffer) { - switch (type) { - case 128: - return TestMessage.decode(readValue(buffer)!); - default: - return super.readValueOfType(type, buffer); - } - } -} - -/// A simple API called in some unit tests. -abstract class FlutterSmallApi { - static const MessageCodec codec = _FlutterSmallApiCodec(); - - TestMessage echoWrappedList(TestMessage msg); - - static void setup(FlutterSmallApi? api, {BinaryMessenger? binaryMessenger}) { - { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.FlutterSmallApi.echoWrappedList', - codec, - binaryMessenger: binaryMessenger); - if (api == null) { - channel.setMessageHandler(null); - } else { - channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.FlutterSmallApi.echoWrappedList was null.'); - final List args = (message as List?)!; - final TestMessage? arg_msg = (args[0] as TestMessage?); - assert(arg_msg != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.FlutterSmallApi.echoWrappedList was null, expected non-null TestMessage.'); - final TestMessage output = api.echoWrappedList(arg_msg!); - return output; - }); - } - } - } -} diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/pubspec.yaml b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/pubspec.yaml deleted file mode 100644 index 843d473c896..00000000000 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/pubspec.yaml +++ /dev/null @@ -1,20 +0,0 @@ -name: flutter_unit_tests -description: Unit test scaffold for null safe Flutter projects. -publish_to: none # Remove this line if you wish to publish to pub.dev -version: 1.0.0+1 -environment: - sdk: ">=2.18.0 <4.0.0" - flutter: ">=3.3.0" - -dependencies: - flutter: - sdk: flutter - -dev_dependencies: - build_runner: ^2.1.10 - flutter_test: - sdk: flutter - mockito: 5.4.1 - -flutter: - uses-material-design: true diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/.gitignore b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/.gitignore deleted file mode 100644 index 796ec975a2f..00000000000 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -# TODO(stuartmorgan): Remove this, so that review will show the effects of -# changes on generated files. This will need a way to avoid unnecessary churn, -# such as a flag to suppress version stamp generation. -*.gen.dart -# The following are files that are used in integration tests, which need to be -# checked in to avoid analysis failures. -!core_tests.gen.dart diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/background_platform_channels.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/background_platform_channels.gen.dart new file mode 100644 index 00000000000..8b4a04e9e9e --- /dev/null +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/background_platform_channels.gen.dart @@ -0,0 +1,52 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Autogenerated from Pigeon, do not edit directly. +// See also: https://pub.dev/packages/pigeon +// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import + +import 'dart:async'; +import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; + +import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; +import 'package:flutter/services.dart'; + +class BackgroundApi2Host { + /// Constructor for [BackgroundApi2Host]. The [binaryMessenger] named argument is + /// available for dependency injection. If it is left null, the default + /// BinaryMessenger will be used which routes to the host platform. + BackgroundApi2Host({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; + final BinaryMessenger? _binaryMessenger; + + static const MessageCodec codec = StandardMessageCodec(); + + Future add(int arg_x, int arg_y) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.pigeon_integration_tests.BackgroundApi2Host.add', + codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send([arg_x, arg_y]) as List?; + 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?)!; + } + } +} diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/enum.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/enum.gen.dart new file mode 100644 index 00000000000..31a24062074 --- /dev/null +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/enum.gen.dart @@ -0,0 +1,165 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Autogenerated from Pigeon, do not edit directly. +// See also: https://pub.dev/packages/pigeon +// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import + +import 'dart:async'; +import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; + +import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; +import 'package:flutter/services.dart'; + +/// This comment is to test enum documentation comments. +enum EnumState { + /// This comment is to test enum member (Pending) documentation comments. + Pending, + + /// This comment is to test enum member (Success) documentation comments. + Success, + + /// This comment is to test enum member (Error) documentation comments. + Error, +} + +/// This comment is to test class documentation comments. +class DataWithEnum { + DataWithEnum({ + this.state, + }); + + /// This comment is to test field documentation comments. + EnumState? state; + + Object encode() { + return [ + state?.index, + ]; + } + + static DataWithEnum decode(Object result) { + result as List; + return DataWithEnum( + state: result[0] != null ? EnumState.values[result[0]! as int] : null, + ); + } +} + +class _EnumApi2HostCodec extends StandardMessageCodec { + const _EnumApi2HostCodec(); + @override + void writeValue(WriteBuffer buffer, Object? value) { + if (value is DataWithEnum) { + buffer.putUint8(128); + writeValue(buffer, value.encode()); + } else { + super.writeValue(buffer, value); + } + } + + @override + Object? readValueOfType(int type, ReadBuffer buffer) { + switch (type) { + case 128: + return DataWithEnum.decode(readValue(buffer)!); + default: + return super.readValueOfType(type, buffer); + } + } +} + +/// This comment is to test api documentation comments. +class EnumApi2Host { + /// Constructor for [EnumApi2Host]. The [binaryMessenger] named argument is + /// available for dependency injection. If it is left null, the default + /// BinaryMessenger will be used which routes to the host platform. + EnumApi2Host({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; + final BinaryMessenger? _binaryMessenger; + + static const MessageCodec codec = _EnumApi2HostCodec(); + + /// This comment is to test method documentation comments. + Future echo(DataWithEnum arg_data) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.pigeon_integration_tests.EnumApi2Host.echo', codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send([arg_data]) as List?; + 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 DataWithEnum?)!; + } + } +} + +class _EnumApi2FlutterCodec extends StandardMessageCodec { + const _EnumApi2FlutterCodec(); + @override + void writeValue(WriteBuffer buffer, Object? value) { + if (value is DataWithEnum) { + buffer.putUint8(128); + writeValue(buffer, value.encode()); + } else { + super.writeValue(buffer, value); + } + } + + @override + Object? readValueOfType(int type, ReadBuffer buffer) { + switch (type) { + case 128: + return DataWithEnum.decode(readValue(buffer)!); + default: + return super.readValueOfType(type, buffer); + } + } +} + +/// This comment is to test api documentation comments. +abstract class EnumApi2Flutter { + static const MessageCodec codec = _EnumApi2FlutterCodec(); + + /// This comment is to test method documentation comments. + DataWithEnum echo(DataWithEnum data); + + static void setup(EnumApi2Flutter? api, {BinaryMessenger? binaryMessenger}) { + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.pigeon_integration_tests.EnumApi2Flutter.echo', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.EnumApi2Flutter.echo was null.'); + final List args = (message as List?)!; + final DataWithEnum? arg_data = (args[0] as DataWithEnum?); + assert(arg_data != null, + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.EnumApi2Flutter.echo was null, expected non-null DataWithEnum.'); + final DataWithEnum output = api.echo(arg_data!); + return output; + }); + } + } + } +} diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/flutter_unittests.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/flutter_unittests.gen.dart similarity index 95% rename from packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/flutter_unittests.gen.dart rename to packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/flutter_unittests.gen.dart index d7dad85b257..5dfb8b7e037 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/flutter_unittests.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/flutter_unittests.gen.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// Autogenerated from Pigeon (v10.1.4), do not edit directly. +// Autogenerated from Pigeon, do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import @@ -150,7 +150,7 @@ class Api { Future search(FlutterSearchRequest arg_request) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.Api.search', codec, + 'dev.flutter.pigeon.pigeon_integration_tests.Api.search', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_request]) as List?; @@ -178,7 +178,7 @@ class Api { Future doSearches( FlutterSearchRequests arg_request) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.Api.doSearches', codec, + 'dev.flutter.pigeon.pigeon_integration_tests.Api.doSearches', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_request]) as List?; @@ -205,7 +205,7 @@ class Api { Future echo(FlutterSearchRequests arg_requests) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.Api.echo', codec, + 'dev.flutter.pigeon.pigeon_integration_tests.Api.echo', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_requests]) as List?; @@ -232,7 +232,7 @@ class Api { Future anInt(int arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.Api.anInt', codec, + 'dev.flutter.pigeon.pigeon_integration_tests.Api.anInt', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_value]) as List?; diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/message.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/message.gen.dart new file mode 100644 index 00000000000..482bbfd4f20 --- /dev/null +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/message.gen.dart @@ -0,0 +1,359 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Autogenerated from Pigeon, do not edit directly. +// See also: https://pub.dev/packages/pigeon +// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import + +import 'dart:async'; +import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; + +import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; +import 'package:flutter/services.dart'; + +/// This comment is to test enum documentation comments. +/// +/// This comment also tests multiple line comments. +/// +/// //////////////////////// +/// This comment also tests comments that start with '/' +/// //////////////////////// +enum MessageRequestState { + pending, + success, + failure, +} + +/// This comment is to test class documentation comments. +/// +/// This comment also tests multiple line comments. +class MessageSearchRequest { + MessageSearchRequest({ + this.query, + this.anInt, + this.aBool, + }); + + /// This comment is to test field documentation comments. + String? query; + + /// This comment is to test field documentation comments. + int? anInt; + + /// This comment is to test field documentation comments. + bool? aBool; + + Object encode() { + return [ + query, + anInt, + aBool, + ]; + } + + static MessageSearchRequest decode(Object result) { + result as List; + return MessageSearchRequest( + query: result[0] as String?, + anInt: result[1] as int?, + aBool: result[2] as bool?, + ); + } +} + +/// This comment is to test class documentation comments. +class MessageSearchReply { + MessageSearchReply({ + this.result, + this.error, + this.state, + }); + + /// This comment is to test field documentation comments. + /// + /// This comment also tests multiple line comments. + String? result; + + /// This comment is to test field documentation comments. + String? error; + + /// This comment is to test field documentation comments. + MessageRequestState? state; + + Object encode() { + return [ + result, + error, + state?.index, + ]; + } + + static MessageSearchReply decode(Object result) { + result as List; + return MessageSearchReply( + result: result[0] as String?, + error: result[1] as String?, + state: result[2] != null + ? MessageRequestState.values[result[2]! as int] + : null, + ); + } +} + +/// This comment is to test class documentation comments. +class MessageNested { + MessageNested({ + this.request, + }); + + /// This comment is to test field documentation comments. + MessageSearchRequest? request; + + Object encode() { + return [ + request?.encode(), + ]; + } + + static MessageNested decode(Object result) { + result as List; + return MessageNested( + request: result[0] != null + ? MessageSearchRequest.decode(result[0]! as List) + : null, + ); + } +} + +class _MessageApiCodec extends StandardMessageCodec { + const _MessageApiCodec(); + @override + void writeValue(WriteBuffer buffer, Object? value) { + if (value is MessageSearchReply) { + buffer.putUint8(128); + writeValue(buffer, value.encode()); + } else if (value is MessageSearchRequest) { + buffer.putUint8(129); + writeValue(buffer, value.encode()); + } else { + super.writeValue(buffer, value); + } + } + + @override + Object? readValueOfType(int type, ReadBuffer buffer) { + switch (type) { + case 128: + return MessageSearchReply.decode(readValue(buffer)!); + case 129: + return MessageSearchRequest.decode(readValue(buffer)!); + default: + return super.readValueOfType(type, buffer); + } + } +} + +/// This comment is to test api documentation comments. +/// +/// This comment also tests multiple line comments. +class MessageApi { + /// Constructor for [MessageApi]. The [binaryMessenger] named argument is + /// available for dependency injection. If it is left null, the default + /// BinaryMessenger will be used which routes to the host platform. + MessageApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; + final BinaryMessenger? _binaryMessenger; + + static const MessageCodec codec = _MessageApiCodec(); + + /// This comment is to test documentation comments. + /// + /// This comment also tests multiple line comments. + Future initialize() async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.pigeon_integration_tests.MessageApi.initialize', + codec, + binaryMessenger: _binaryMessenger); + final List? replyList = await channel.send(null) as List?; + 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; + } + } + + /// This comment is to test method documentation comments. + Future search(MessageSearchRequest arg_request) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.pigeon_integration_tests.MessageApi.search', codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send([arg_request]) as List?; + 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 MessageSearchReply?)!; + } + } +} + +class _MessageNestedApiCodec extends StandardMessageCodec { + const _MessageNestedApiCodec(); + @override + void writeValue(WriteBuffer buffer, Object? value) { + if (value is MessageNested) { + buffer.putUint8(128); + writeValue(buffer, value.encode()); + } else if (value is MessageSearchReply) { + buffer.putUint8(129); + writeValue(buffer, value.encode()); + } else if (value is MessageSearchRequest) { + buffer.putUint8(130); + writeValue(buffer, value.encode()); + } else { + super.writeValue(buffer, value); + } + } + + @override + Object? readValueOfType(int type, ReadBuffer buffer) { + switch (type) { + case 128: + return MessageNested.decode(readValue(buffer)!); + case 129: + return MessageSearchReply.decode(readValue(buffer)!); + case 130: + return MessageSearchRequest.decode(readValue(buffer)!); + default: + return super.readValueOfType(type, buffer); + } + } +} + +/// This comment is to test api documentation comments. +class MessageNestedApi { + /// Constructor for [MessageNestedApi]. The [binaryMessenger] named argument is + /// available for dependency injection. If it is left null, the default + /// BinaryMessenger will be used which routes to the host platform. + MessageNestedApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; + final BinaryMessenger? _binaryMessenger; + + static const MessageCodec codec = _MessageNestedApiCodec(); + + /// This comment is to test method documentation comments. + /// + /// This comment also tests multiple line comments. + Future search(MessageNested arg_nested) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.pigeon_integration_tests.MessageNestedApi.search', + codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send([arg_nested]) as List?; + 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 MessageSearchReply?)!; + } + } +} + +class _MessageFlutterSearchApiCodec extends StandardMessageCodec { + const _MessageFlutterSearchApiCodec(); + @override + void writeValue(WriteBuffer buffer, Object? value) { + if (value is MessageSearchReply) { + buffer.putUint8(128); + writeValue(buffer, value.encode()); + } else if (value is MessageSearchRequest) { + buffer.putUint8(129); + writeValue(buffer, value.encode()); + } else { + super.writeValue(buffer, value); + } + } + + @override + Object? readValueOfType(int type, ReadBuffer buffer) { + switch (type) { + case 128: + return MessageSearchReply.decode(readValue(buffer)!); + case 129: + return MessageSearchRequest.decode(readValue(buffer)!); + default: + return super.readValueOfType(type, buffer); + } + } +} + +/// This comment is to test api documentation comments. +abstract class MessageFlutterSearchApi { + static const MessageCodec codec = _MessageFlutterSearchApiCodec(); + + /// This comment is to test method documentation comments. + MessageSearchReply search(MessageSearchRequest request); + + static void setup(MessageFlutterSearchApi? api, + {BinaryMessenger? binaryMessenger}) { + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.pigeon_integration_tests.MessageFlutterSearchApi.search', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.MessageFlutterSearchApi.search was null.'); + final List args = (message as List?)!; + final MessageSearchRequest? arg_request = + (args[0] as MessageSearchRequest?); + assert(arg_request != null, + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.MessageFlutterSearchApi.search was null, expected non-null MessageSearchRequest.'); + final MessageSearchReply output = api.search(arg_request!); + return output; + }); + } + } + } +} diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/multiple_arity.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/multiple_arity.gen.dart similarity index 82% rename from packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/multiple_arity.gen.dart rename to packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/multiple_arity.gen.dart index 2b4c1746bae..a73735fde7a 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/multiple_arity.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/multiple_arity.gen.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// Autogenerated from Pigeon (v10.1.4), do not edit directly. +// Autogenerated from Pigeon, do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import @@ -24,7 +24,7 @@ class MultipleArityHostApi { Future subtract(int arg_x, int arg_y) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.MultipleArityHostApi.subtract', + 'dev.flutter.pigeon.pigeon_integration_tests.MultipleArityHostApi.subtract', codec, binaryMessenger: _binaryMessenger); final List? replyList = @@ -60,7 +60,7 @@ abstract class MultipleArityFlutterApi { {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.MultipleArityFlutterApi.subtract', + 'dev.flutter.pigeon.pigeon_integration_tests.MultipleArityFlutterApi.subtract', codec, binaryMessenger: binaryMessenger); if (api == null) { @@ -68,14 +68,14 @@ abstract class MultipleArityFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.MultipleArityFlutterApi.subtract was null.'); + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.MultipleArityFlutterApi.subtract was null.'); final List args = (message as List?)!; final int? arg_x = (args[0] as int?); assert(arg_x != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.MultipleArityFlutterApi.subtract was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.MultipleArityFlutterApi.subtract was null, expected non-null int.'); final int? arg_y = (args[1] as int?); assert(arg_y != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.MultipleArityFlutterApi.subtract was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.MultipleArityFlutterApi.subtract was null, expected non-null int.'); final int output = api.subtract(arg_x!, arg_y!); return output; }); diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/non_null_fields.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/non_null_fields.gen.dart similarity index 93% rename from packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/non_null_fields.gen.dart rename to packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/non_null_fields.gen.dart index 8484653e4fa..4fc0d6a59c7 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/non_null_fields.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/non_null_fields.gen.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// Autogenerated from Pigeon (v10.1.4), do not edit directly. +// Autogenerated from Pigeon, do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import @@ -151,7 +151,7 @@ class NonNullFieldHostApi { Future search( NonNullFieldSearchRequest arg_nested) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.NonNullFieldHostApi.search', + 'dev.flutter.pigeon.pigeon_integration_tests.NonNullFieldHostApi.search', codec, binaryMessenger: _binaryMessenger); final List? replyList = @@ -220,7 +220,7 @@ abstract class NonNullFieldFlutterApi { {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.NonNullFieldFlutterApi.search', + 'dev.flutter.pigeon.pigeon_integration_tests.NonNullFieldFlutterApi.search', codec, binaryMessenger: binaryMessenger); if (api == null) { @@ -228,12 +228,12 @@ abstract class NonNullFieldFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.NonNullFieldFlutterApi.search was null.'); + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.NonNullFieldFlutterApi.search was null.'); final List args = (message as List?)!; final NonNullFieldSearchRequest? arg_request = (args[0] as NonNullFieldSearchRequest?); assert(arg_request != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.NonNullFieldFlutterApi.search was null, expected non-null NonNullFieldSearchRequest.'); + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.NonNullFieldFlutterApi.search was null, expected non-null NonNullFieldSearchRequest.'); final NonNullFieldSearchReply output = api.search(arg_request!); return output; }); diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_fields.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/null_fields.gen.dart similarity index 92% rename from packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_fields.gen.dart rename to packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/null_fields.gen.dart index a0d790939fb..145467832d9 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_fields.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/null_fields.gen.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// Autogenerated from Pigeon (v10.1.4), do not edit directly. +// Autogenerated from Pigeon, do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import @@ -129,7 +129,8 @@ class NullFieldsHostApi { Future search( NullFieldsSearchRequest arg_nested) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.NullFieldsHostApi.search', codec, + 'dev.flutter.pigeon.pigeon_integration_tests.NullFieldsHostApi.search', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_nested]) as List?; @@ -192,7 +193,7 @@ abstract class NullFieldsFlutterApi { {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.NullFieldsFlutterApi.search', + 'dev.flutter.pigeon.pigeon_integration_tests.NullFieldsFlutterApi.search', codec, binaryMessenger: binaryMessenger); if (api == null) { @@ -200,12 +201,12 @@ abstract class NullFieldsFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.NullFieldsFlutterApi.search was null.'); + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.NullFieldsFlutterApi.search was null.'); final List args = (message as List?)!; final NullFieldsSearchRequest? arg_request = (args[0] as NullFieldsSearchRequest?); assert(arg_request != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.NullFieldsFlutterApi.search was null, expected non-null NullFieldsSearchRequest.'); + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.NullFieldsFlutterApi.search was null, expected non-null NullFieldsSearchRequest.'); final NullFieldsSearchReply output = api.search(arg_request!); return output; }); diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/nullable_returns.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/nullable_returns.gen.dart similarity index 89% rename from packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/nullable_returns.gen.dart rename to packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/nullable_returns.gen.dart index 3f6602a3007..286c5d5f14c 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/nullable_returns.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/nullable_returns.gen.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// Autogenerated from Pigeon (v10.1.4), do not edit directly. +// Autogenerated from Pigeon, do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import @@ -24,7 +24,7 @@ class NullableReturnHostApi { Future doit() async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.NullableReturnHostApi.doit', + 'dev.flutter.pigeon.pigeon_integration_tests.NullableReturnHostApi.doit', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send(null) as List?; @@ -54,7 +54,7 @@ abstract class NullableReturnFlutterApi { {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.NullableReturnFlutterApi.doit', + 'dev.flutter.pigeon.pigeon_integration_tests.NullableReturnFlutterApi.doit', codec, binaryMessenger: binaryMessenger); if (api == null) { @@ -82,7 +82,8 @@ class NullableArgHostApi { Future doit(int? arg_x) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.NullableArgHostApi.doit', codec, + 'dev.flutter.pigeon.pigeon_integration_tests.NullableArgHostApi.doit', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_x]) as List?; @@ -117,7 +118,7 @@ abstract class NullableArgFlutterApi { {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.NullableArgFlutterApi.doit', + 'dev.flutter.pigeon.pigeon_integration_tests.NullableArgFlutterApi.doit', codec, binaryMessenger: binaryMessenger); if (api == null) { @@ -125,7 +126,7 @@ abstract class NullableArgFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.NullableArgFlutterApi.doit was null.'); + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.NullableArgFlutterApi.doit was null.'); final List args = (message as List?)!; final int? arg_x = (args[0] as int?); final int output = api.doit(arg_x); @@ -148,7 +149,7 @@ class NullableCollectionReturnHostApi { Future?> doit() async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.NullableCollectionReturnHostApi.doit', + 'dev.flutter.pigeon.pigeon_integration_tests.NullableCollectionReturnHostApi.doit', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send(null) as List?; @@ -178,7 +179,7 @@ abstract class NullableCollectionReturnFlutterApi { {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.NullableCollectionReturnFlutterApi.doit', + 'dev.flutter.pigeon.pigeon_integration_tests.NullableCollectionReturnFlutterApi.doit', codec, binaryMessenger: binaryMessenger); if (api == null) { @@ -206,7 +207,7 @@ class NullableCollectionArgHostApi { Future> doit(List? arg_x) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.NullableCollectionArgHostApi.doit', + 'dev.flutter.pigeon.pigeon_integration_tests.NullableCollectionArgHostApi.doit', codec, binaryMessenger: _binaryMessenger); final List? replyList = @@ -242,7 +243,7 @@ abstract class NullableCollectionArgFlutterApi { {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.NullableCollectionArgFlutterApi.doit', + 'dev.flutter.pigeon.pigeon_integration_tests.NullableCollectionArgFlutterApi.doit', codec, binaryMessenger: binaryMessenger); if (api == null) { @@ -250,7 +251,7 @@ abstract class NullableCollectionArgFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.NullableCollectionArgFlutterApi.doit was null.'); + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.NullableCollectionArgFlutterApi.doit was null.'); final List args = (message as List?)!; final List? arg_x = (args[0] as List?)?.cast(); diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/primitive.gen.dart similarity index 79% rename from packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.gen.dart rename to packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/primitive.gen.dart index 0a491ff13d2..ef12ee8243f 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/primitive.gen.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// Autogenerated from Pigeon (v10.1.4), do not edit directly. +// Autogenerated from Pigeon, do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import @@ -24,7 +24,8 @@ class PrimitiveHostApi { Future anInt(int arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.PrimitiveHostApi.anInt', codec, + 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.anInt', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_value]) as List?; @@ -51,7 +52,8 @@ class PrimitiveHostApi { Future aBool(bool arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.PrimitiveHostApi.aBool', codec, + 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.aBool', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_value]) as List?; @@ -78,7 +80,8 @@ class PrimitiveHostApi { Future aString(String arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.PrimitiveHostApi.aString', codec, + 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.aString', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_value]) as List?; @@ -105,7 +108,8 @@ class PrimitiveHostApi { Future aDouble(double arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.PrimitiveHostApi.aDouble', codec, + 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.aDouble', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_value]) as List?; @@ -132,7 +136,8 @@ class PrimitiveHostApi { Future> aMap(Map arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.PrimitiveHostApi.aMap', codec, + 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.aMap', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_value]) as List?; @@ -159,7 +164,8 @@ class PrimitiveHostApi { Future> aList(List arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.PrimitiveHostApi.aList', codec, + 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.aList', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_value]) as List?; @@ -186,7 +192,7 @@ class PrimitiveHostApi { Future anInt32List(Int32List arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.PrimitiveHostApi.anInt32List', + 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.anInt32List', codec, binaryMessenger: _binaryMessenger); final List? replyList = @@ -214,7 +220,7 @@ class PrimitiveHostApi { Future> aBoolList(List arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.PrimitiveHostApi.aBoolList', + 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.aBoolList', codec, binaryMessenger: _binaryMessenger); final List? replyList = @@ -242,7 +248,7 @@ class PrimitiveHostApi { Future> aStringIntMap(Map arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.PrimitiveHostApi.aStringIntMap', + 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.aStringIntMap', codec, binaryMessenger: _binaryMessenger); final List? replyList = @@ -294,7 +300,7 @@ abstract class PrimitiveFlutterApi { {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.PrimitiveFlutterApi.anInt', + 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.anInt', codec, binaryMessenger: binaryMessenger); if (api == null) { @@ -302,11 +308,11 @@ abstract class PrimitiveFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.PrimitiveFlutterApi.anInt was null.'); + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.anInt was null.'); final List args = (message as List?)!; final int? arg_value = (args[0] as int?); assert(arg_value != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.PrimitiveFlutterApi.anInt was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.anInt was null, expected non-null int.'); final int output = api.anInt(arg_value!); return output; }); @@ -314,7 +320,7 @@ abstract class PrimitiveFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.PrimitiveFlutterApi.aBool', + 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aBool', codec, binaryMessenger: binaryMessenger); if (api == null) { @@ -322,11 +328,11 @@ abstract class PrimitiveFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.PrimitiveFlutterApi.aBool was null.'); + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aBool was null.'); final List args = (message as List?)!; final bool? arg_value = (args[0] as bool?); assert(arg_value != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.PrimitiveFlutterApi.aBool was null, expected non-null bool.'); + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aBool was null, expected non-null bool.'); final bool output = api.aBool(arg_value!); return output; }); @@ -334,7 +340,7 @@ abstract class PrimitiveFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.PrimitiveFlutterApi.aString', + 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aString', codec, binaryMessenger: binaryMessenger); if (api == null) { @@ -342,11 +348,11 @@ abstract class PrimitiveFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.PrimitiveFlutterApi.aString was null.'); + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aString was null.'); final List args = (message as List?)!; final String? arg_value = (args[0] as String?); assert(arg_value != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.PrimitiveFlutterApi.aString was null, expected non-null String.'); + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aString was null, expected non-null String.'); final String output = api.aString(arg_value!); return output; }); @@ -354,7 +360,7 @@ abstract class PrimitiveFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.PrimitiveFlutterApi.aDouble', + 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aDouble', codec, binaryMessenger: binaryMessenger); if (api == null) { @@ -362,11 +368,11 @@ abstract class PrimitiveFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.PrimitiveFlutterApi.aDouble was null.'); + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aDouble was null.'); final List args = (message as List?)!; final double? arg_value = (args[0] as double?); assert(arg_value != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.PrimitiveFlutterApi.aDouble was null, expected non-null double.'); + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aDouble was null, expected non-null double.'); final double output = api.aDouble(arg_value!); return output; }); @@ -374,7 +380,7 @@ abstract class PrimitiveFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.PrimitiveFlutterApi.aMap', + 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aMap', codec, binaryMessenger: binaryMessenger); if (api == null) { @@ -382,12 +388,12 @@ abstract class PrimitiveFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.PrimitiveFlutterApi.aMap was null.'); + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aMap was null.'); final List args = (message as List?)!; final Map? arg_value = (args[0] as Map?); assert(arg_value != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.PrimitiveFlutterApi.aMap was null, expected non-null Map.'); + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aMap was null, expected non-null Map.'); final Map output = api.aMap(arg_value!); return output; }); @@ -395,7 +401,7 @@ abstract class PrimitiveFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.PrimitiveFlutterApi.aList', + 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aList', codec, binaryMessenger: binaryMessenger); if (api == null) { @@ -403,11 +409,11 @@ abstract class PrimitiveFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.PrimitiveFlutterApi.aList was null.'); + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aList was null.'); final List args = (message as List?)!; final List? arg_value = (args[0] as List?); assert(arg_value != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.PrimitiveFlutterApi.aList was null, expected non-null List.'); + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aList was null, expected non-null List.'); final List output = api.aList(arg_value!); return output; }); @@ -415,7 +421,7 @@ abstract class PrimitiveFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.PrimitiveFlutterApi.anInt32List', + 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.anInt32List', codec, binaryMessenger: binaryMessenger); if (api == null) { @@ -423,11 +429,11 @@ abstract class PrimitiveFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.PrimitiveFlutterApi.anInt32List was null.'); + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.anInt32List was null.'); final List args = (message as List?)!; final Int32List? arg_value = (args[0] as Int32List?); assert(arg_value != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.PrimitiveFlutterApi.anInt32List was null, expected non-null Int32List.'); + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.anInt32List was null, expected non-null Int32List.'); final Int32List output = api.anInt32List(arg_value!); return output; }); @@ -435,7 +441,7 @@ abstract class PrimitiveFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.PrimitiveFlutterApi.aBoolList', + 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aBoolList', codec, binaryMessenger: binaryMessenger); if (api == null) { @@ -443,12 +449,12 @@ abstract class PrimitiveFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.PrimitiveFlutterApi.aBoolList was null.'); + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aBoolList was null.'); final List args = (message as List?)!; final List? arg_value = (args[0] as List?)?.cast(); assert(arg_value != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.PrimitiveFlutterApi.aBoolList was null, expected non-null List.'); + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aBoolList was null, expected non-null List.'); final List output = api.aBoolList(arg_value!); return output; }); @@ -456,7 +462,7 @@ abstract class PrimitiveFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.flutter_unit_tests.PrimitiveFlutterApi.aStringIntMap', + 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aStringIntMap', codec, binaryMessenger: binaryMessenger); if (api == null) { @@ -464,12 +470,12 @@ abstract class PrimitiveFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.PrimitiveFlutterApi.aStringIntMap was null.'); + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aStringIntMap was null.'); final List args = (message as List?)!; final Map? arg_value = (args[0] as Map?)?.cast(); assert(arg_value != null, - 'Argument for dev.flutter.pigeon.flutter_unit_tests.PrimitiveFlutterApi.aStringIntMap was null, expected non-null Map.'); + 'Argument for dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aStringIntMap was null, expected non-null Map.'); final Map output = api.aStringIntMap(arg_value!); return output; }); diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/pubspec.yaml b/packages/pigeon/platform_tests/shared_test_plugin_code/pubspec.yaml index 742b00a1cf7..0256dda07dd 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/pubspec.yaml +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/pubspec.yaml @@ -8,6 +8,7 @@ environment: flutter: ">=3.3.0" dependencies: + build_runner: ^2.1.10 flutter: sdk: flutter # These are normal dependencies rather than dev_dependencies because the @@ -17,3 +18,4 @@ dependencies: sdk: flutter integration_test: sdk: flutter + mockito: 5.4.1 diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/regenerate_mocks.sh b/packages/pigeon/platform_tests/shared_test_plugin_code/regenerate_mocks.sh similarity index 71% rename from packages/pigeon/platform_tests/flutter_null_safe_unit_tests/regenerate_mocks.sh rename to packages/pigeon/platform_tests/shared_test_plugin_code/regenerate_mocks.sh index cd1f670090d..0cb7e0f805f 100755 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/regenerate_mocks.sh +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/regenerate_mocks.sh @@ -2,4 +2,4 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -flutter pub run build_runner build --delete-conflicting-outputs +dart run build_runner build --delete-conflicting-outputs diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/multiple_arity_test.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/test/multiple_arity_test.dart similarity index 87% rename from packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/multiple_arity_test.dart rename to packages/pigeon/platform_tests/shared_test_plugin_code/test/multiple_arity_test.dart index 1c3d535460a..d446a036f74 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/multiple_arity_test.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/test/multiple_arity_test.dart @@ -4,9 +4,10 @@ import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:flutter_unit_tests/multiple_arity.gen.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; +import 'package:shared_test_plugin_code/src/generated/multiple_arity.gen.dart'; + import 'multiple_arity_test.mocks.dart'; @GenerateMocks([BinaryMessenger]) @@ -14,7 +15,7 @@ void main() { test('multiple arity', () async { final BinaryMessenger mockMessenger = MockBinaryMessenger(); when(mockMessenger.send( - 'dev.flutter.pigeon.flutter_unit_tests.MultipleArityHostApi.subtract', + 'dev.flutter.pigeon.pigeon_integration_tests.MultipleArityHostApi.subtract', any)) .thenAnswer((Invocation realInvocation) async { final Object input = MultipleArityHostApi.codec diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/multiple_arity_test.mocks.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/test/multiple_arity_test.mocks.dart similarity index 94% rename from packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/multiple_arity_test.mocks.dart rename to packages/pigeon/platform_tests/shared_test_plugin_code/test/multiple_arity_test.mocks.dart index 0214f7e7196..58653ceb060 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/multiple_arity_test.mocks.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/test/multiple_arity_test.mocks.dart @@ -1,7 +1,9 @@ -// Mocks generated by Mockito 5.4.0 from annotations -// in flutter_unit_tests/test/multiple_arity_test.dart. +// Mocks generated by Mockito 5.4.1 from annotations +// in shared_test_plugin_code/test/multiple_arity_test.dart. // Do not manually edit this file. +// @dart=2.19 + // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i3; import 'dart:typed_data' as _i4; diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/non_null_fields_test.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/test/non_null_fields_test.dart similarity index 83% rename from packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/non_null_fields_test.dart rename to packages/pigeon/platform_tests/shared_test_plugin_code/test/non_null_fields_test.dart index 34b4193d571..bca236c840a 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/non_null_fields_test.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/test/non_null_fields_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter_test/flutter_test.dart'; -import 'package:flutter_unit_tests/non_null_fields.gen.dart'; +import 'package:shared_test_plugin_code/src/generated/non_null_fields.gen.dart'; void main() { test('test constructor', () { diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/null_fields_test.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/test/null_fields_test.dart similarity index 98% rename from packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/null_fields_test.dart rename to packages/pigeon/platform_tests/shared_test_plugin_code/test/null_fields_test.dart index ec75a8ea169..112317a3895 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/null_fields_test.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/test/null_fields_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter_test/flutter_test.dart'; -import 'package:flutter_unit_tests/null_fields.gen.dart'; +import 'package:shared_test_plugin_code/src/generated/null_fields.gen.dart'; void main() { test('test constructor with values', () { diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/null_safe_test.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/test/null_safe_test.dart similarity index 88% rename from packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/null_safe_test.dart rename to packages/pigeon/platform_tests/shared_test_plugin_code/test/null_safe_test.dart index 12bbf61f074..ffa3063374b 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/null_safe_test.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/test/null_safe_test.dart @@ -6,10 +6,10 @@ import 'dart:async'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:flutter_unit_tests/flutter_unittests.gen.dart'; -import 'package:flutter_unit_tests/nullable_returns.gen.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; +import 'package:shared_test_plugin_code/src/generated/flutter_unittests.gen.dart'; +import 'package:shared_test_plugin_code/src/generated/nullable_returns.gen.dart'; import 'null_safe_test.mocks.dart'; import 'test_util.dart'; @@ -53,7 +53,7 @@ void main() { completer.complete(Api.codec.encodeMessage([reply])); final Future sendResult = completer.future; when(mockMessenger.send( - 'dev.flutter.pigeon.flutter_unit_tests.Api.search', any)) + 'dev.flutter.pigeon.pigeon_integration_tests.Api.search', any)) .thenAnswer((Invocation realInvocation) => sendResult); final Api api = Api(binaryMessenger: mockMessenger); final FlutterSearchReply readReply = await api.search(request); @@ -68,7 +68,7 @@ void main() { final BinaryMessenger mockMessenger = MockBinaryMessenger(); echoOneArgument( mockMessenger, - 'dev.flutter.pigeon.flutter_unit_tests.Api.echo', + 'dev.flutter.pigeon.pigeon_integration_tests.Api.echo', Api.codec, ); final Api api = Api(binaryMessenger: mockMessenger); @@ -81,7 +81,7 @@ void main() { final BinaryMessenger mockMessenger = MockBinaryMessenger(); echoOneArgument( mockMessenger, - 'dev.flutter.pigeon.flutter_unit_tests.Api.anInt', + 'dev.flutter.pigeon.pigeon_integration_tests.Api.anInt', Api.codec, ); final Api api = Api(binaryMessenger: mockMessenger); @@ -91,7 +91,8 @@ void main() { test('return null to nonnull', () async { final BinaryMessenger mockMessenger = MockBinaryMessenger(); - const String channel = 'dev.flutter.pigeon.flutter_unit_tests.Api.anInt'; + const String channel = + 'dev.flutter.pigeon.pigeon_integration_tests.Api.anInt'; when(mockMessenger.send(channel, any)) .thenAnswer((Invocation realInvocation) async { return Api.codec.encodeMessage([null]); @@ -104,7 +105,7 @@ void main() { test('send null parameter', () async { final BinaryMessenger mockMessenger = MockBinaryMessenger(); const String channel = - 'dev.flutter.pigeon.flutter_unit_tests.NullableArgHostApi.doit'; + 'dev.flutter.pigeon.pigeon_integration_tests.NullableArgHostApi.doit'; when(mockMessenger.send(channel, any)) .thenAnswer((Invocation realInvocation) async { return Api.codec.encodeMessage([123]); @@ -117,7 +118,7 @@ void main() { test('send null collection parameter', () async { final BinaryMessenger mockMessenger = MockBinaryMessenger(); const String channel = - 'dev.flutter.pigeon.flutter_unit_tests.NullableCollectionArgHostApi.doit'; + 'dev.flutter.pigeon.pigeon_integration_tests.NullableCollectionArgHostApi.doit'; when(mockMessenger.send(channel, any)) .thenAnswer((Invocation realInvocation) async { return Api.codec.encodeMessage([ @@ -138,7 +139,7 @@ void main() { final Completer resultCompleter = Completer(); binding.defaultBinaryMessenger.handlePlatformMessage( - 'dev.flutter.pigeon.flutter_unit_tests.NullableArgFlutterApi.doit', + 'dev.flutter.pigeon.pigeon_integration_tests.NullableArgFlutterApi.doit', NullableArgFlutterApi.codec.encodeMessage([null]), (ByteData? data) { resultCompleter.complete( @@ -162,7 +163,7 @@ void main() { final Completer> resultCompleter = Completer>(); binding.defaultBinaryMessenger.handlePlatformMessage( - 'dev.flutter.pigeon.flutter_unit_tests.NullableCollectionArgFlutterApi.doit', + 'dev.flutter.pigeon.pigeon_integration_tests.NullableCollectionArgFlutterApi.doit', NullableCollectionArgFlutterApi.codec.encodeMessage([null]), (ByteData? data) { resultCompleter.complete( @@ -182,7 +183,7 @@ void main() { test('receive null return', () async { final BinaryMessenger mockMessenger = MockBinaryMessenger(); const String channel = - 'dev.flutter.pigeon.flutter_unit_tests.NullableReturnHostApi.doit'; + 'dev.flutter.pigeon.pigeon_integration_tests.NullableReturnHostApi.doit'; when(mockMessenger.send(channel, any)) .thenAnswer((Invocation realInvocation) async { return NullableReturnHostApi.codec.encodeMessage([null]); @@ -195,7 +196,7 @@ void main() { test('receive null collection return', () async { final BinaryMessenger mockMessenger = MockBinaryMessenger(); const String channel = - 'dev.flutter.pigeon.flutter_unit_tests.NullableCollectionReturnHostApi.doit'; + 'dev.flutter.pigeon.pigeon_integration_tests.NullableCollectionReturnHostApi.doit'; when(mockMessenger.send(channel, any)) .thenAnswer((Invocation realInvocation) async { return NullableCollectionReturnHostApi.codec @@ -215,7 +216,7 @@ void main() { final Completer resultCompleter = Completer(); unawaited(binding.defaultBinaryMessenger.handlePlatformMessage( - 'dev.flutter.pigeon.flutter_unit_tests.NullableReturnFlutterApi.doit', + 'dev.flutter.pigeon.pigeon_integration_tests.NullableReturnFlutterApi.doit', NullableReturnFlutterApi.codec.encodeMessage([]), (ByteData? data) { resultCompleter.complete(null); @@ -238,7 +239,7 @@ void main() { final Completer?> resultCompleter = Completer?>(); unawaited(binding.defaultBinaryMessenger.handlePlatformMessage( - 'dev.flutter.pigeon.flutter_unit_tests.NullableCollectionReturnFlutterApi.doit', + 'dev.flutter.pigeon.pigeon_integration_tests.NullableCollectionReturnFlutterApi.doit', NullableCollectionReturnFlutterApi.codec.encodeMessage([]), (ByteData? data) { resultCompleter.complete(null); diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/null_safe_test.mocks.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/test/null_safe_test.mocks.dart similarity index 94% rename from packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/null_safe_test.mocks.dart rename to packages/pigeon/platform_tests/shared_test_plugin_code/test/null_safe_test.mocks.dart index c48bb3fdb4a..ce80f9ddf9c 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/null_safe_test.mocks.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/test/null_safe_test.mocks.dart @@ -1,15 +1,18 @@ -// Mocks generated by Mockito 5.4.0 from annotations -// in flutter_unit_tests/test/null_safe_test.dart. +// Mocks generated by Mockito 5.4.1 from annotations +// in shared_test_plugin_code/test/null_safe_test.dart. // Do not manually edit this file. +// @dart=2.19 + // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i3; import 'dart:typed_data' as _i4; import 'dart:ui' as _i5; import 'package:flutter/services.dart' as _i2; -import 'package:flutter_unit_tests/nullable_returns.gen.dart' as _i6; import 'package:mockito/mockito.dart' as _i1; +import 'package:shared_test_plugin_code/src/generated/nullable_returns.gen.dart' + as _i6; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/primitive_test.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/test/primitive_test.dart similarity index 85% rename from packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/primitive_test.dart rename to packages/pigeon/platform_tests/shared_test_plugin_code/test/primitive_test.dart index 27763e3e263..e024f9c60d8 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/primitive_test.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/test/primitive_test.dart @@ -4,9 +4,9 @@ import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:flutter_unit_tests/primitive.gen.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; +import 'package:shared_test_plugin_code/src/generated/primitive.gen.dart'; import 'primitive_test.mocks.dart'; import 'test_util.dart'; @@ -17,7 +17,7 @@ void main() { final BinaryMessenger mockMessenger = MockBinaryMessenger(); echoOneArgument( mockMessenger, - 'dev.flutter.pigeon.flutter_unit_tests.PrimitiveHostApi.anInt', + 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.anInt', PrimitiveHostApi.codec, ); final PrimitiveHostApi api = @@ -30,7 +30,7 @@ void main() { final BinaryMessenger mockMessenger = MockBinaryMessenger(); echoOneArgument( mockMessenger, - 'dev.flutter.pigeon.flutter_unit_tests.PrimitiveHostApi.aBoolList', + 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.aBoolList', PrimitiveHostApi.codec, ); final PrimitiveHostApi api = @@ -44,7 +44,7 @@ void main() { final PrimitiveFlutterApi api = MockPrimitiveFlutterApi(); when(api.aBoolList([true, false])).thenReturn([]); when(mockMessenger.setMessageHandler( - 'dev.flutter.pigeon.flutter_unit_tests.PrimitiveFlutterApi.aBoolList', + 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveFlutterApi.aBoolList', any)) .thenAnswer((Invocation realInvocation) { final MessageHandler? handler = @@ -61,7 +61,7 @@ void main() { final BinaryMessenger mockMessenger = MockBinaryMessenger(); echoOneArgument( mockMessenger, - 'dev.flutter.pigeon.flutter_unit_tests.PrimitiveHostApi.aStringIntMap', + 'dev.flutter.pigeon.pigeon_integration_tests.PrimitiveHostApi.aStringIntMap', PrimitiveHostApi.codec, ); final PrimitiveHostApi api = diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/primitive_test.mocks.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/test/primitive_test.mocks.dart similarity index 95% rename from packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/primitive_test.mocks.dart rename to packages/pigeon/platform_tests/shared_test_plugin_code/test/primitive_test.mocks.dart index 469f9d9bbec..28578ce5208 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/primitive_test.mocks.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/test/primitive_test.mocks.dart @@ -1,15 +1,18 @@ -// Mocks generated by Mockito 5.4.0 from annotations -// in flutter_unit_tests/test/primitive_test.dart. +// Mocks generated by Mockito 5.4.1 from annotations +// in shared_test_plugin_code/test/primitive_test.dart. // Do not manually edit this file. +// @dart=2.19 + // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i3; import 'dart:typed_data' as _i4; import 'dart:ui' as _i5; import 'package:flutter/services.dart' as _i2; -import 'package:flutter_unit_tests/primitive.gen.dart' as _i6; import 'package:mockito/mockito.dart' as _i1; +import 'package:shared_test_plugin_code/src/generated/primitive.gen.dart' + as _i6; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/test_util.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/test/test_util.dart similarity index 100% rename from packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/test_util.dart rename to packages/pigeon/platform_tests/shared_test_plugin_code/test/test_util.dart diff --git a/packages/pigeon/tool/run_tests.dart b/packages/pigeon/tool/run_tests.dart index e593e15e9a3..9b0ce7aecb9 100644 --- a/packages/pigeon/tool/run_tests.dart +++ b/packages/pigeon/tool/run_tests.dart @@ -160,8 +160,6 @@ Future> _modifiedFiles( Future main(List args) async { // Run most tests on Linux, since Linux tends to be the easiest and cheapest. const List linuxHostTests = [ - dartUnitTests, - flutterUnitTests, mockHandlerTests, commandLineTests, androidJavaUnitTests, @@ -198,6 +196,10 @@ Future main(List args) async { // See comments in macOSHostTests: iOSObjCIntegrationTests, iOSSwiftIntegrationTests, + // These are Dart unit tests, which are already run by the normal + // test-dart repo tools command. + dartUnitTests, + flutterUnitTests, ], ]); diff --git a/packages/pigeon/tool/shared/generation.dart b/packages/pigeon/tool/shared/generation.dart index 825f395e23a..3b037304c65 100644 --- a/packages/pigeon/tool/shared/generation.dart +++ b/packages/pigeon/tool/shared/generation.dart @@ -60,6 +60,7 @@ Future generateTestPigeons({required String baseDir}) async { 'background_platform_channels', 'core_tests', 'enum', + 'flutter_unittests', // Only for Dart unit tests in shared_test_plugin_code 'message', 'multiple_arity', 'non_null_fields', diff --git a/packages/pigeon/tool/shared/test_suites.dart b/packages/pigeon/tool/shared/test_suites.dart index 338e4a9b691..658c4c083fa 100644 --- a/packages/pigeon/tool/shared/test_suites.dart +++ b/packages/pigeon/tool/shared/test_suites.dart @@ -187,21 +187,6 @@ Future _runDartUnitTests() async { return exitCode; } -/// Generates multiple dart files based on the jobs defined in [jobs] which is -/// in the format of (key: input pigeon file path, value: output dart file -/// path). -Future _generateDart(Map jobs) async { - for (final MapEntry job in jobs.entries) { - // TODO(gaaclarke): Make this run the jobs in parallel. A bug in Dart - // blocked this (https://github.com/dart-lang/pub/pull/3285). - final int result = await runPigeon(input: job.key, dartOut: job.value); - if (result != 0) { - return result; - } - } - return 0; -} - Future _analyzeFlutterUnitTests(String flutterUnitTestsPath) async { final String messagePath = '$flutterUnitTestsPath/lib/message.gen.dart'; final String messageTestPath = '$flutterUnitTestsPath/test/message_test.dart'; @@ -227,28 +212,7 @@ Future _analyzeFlutterUnitTests(String flutterUnitTestsPath) async { } Future _runFlutterUnitTests() async { - // TODO(stuartmorgan): Migrate Dart unit tests to use the generated output in - // shared_test_plugin_code instead of having multiple copies of generation. - const String flutterUnitTestsPath = - 'platform_tests/flutter_null_safe_unit_tests'; - // Files from the pigeons/ directory to generate output for. - const List inputPigeons = [ - 'flutter_unittests', - 'core_tests', - 'primitive', - 'multiple_arity', - 'non_null_fields', - 'null_fields', - 'nullable_returns', - ]; - final int generateCode = await _generateDart({ - for (final String name in inputPigeons) - 'pigeons/$name.dart': '$flutterUnitTestsPath/lib/$name.gen.dart' - }); - if (generateCode != 0) { - return generateCode; - } - + const String flutterUnitTestsPath = 'platform_tests/shared_test_plugin_code'; final int analyzeCode = await _analyzeFlutterUnitTests(flutterUnitTestsPath); if (analyzeCode != 0) { return analyzeCode;