From 4337cd676649945c056a5ce3868dcd1af64e93d6 Mon Sep 17 00:00:00 2001 From: Ailton Vieira Pinto Filho Date: Sun, 3 Jul 2022 20:05:11 -0300 Subject: [PATCH 01/26] Add SwiftFunction annotation --- packages/pigeon/lib/ast.dart | 8 +- packages/pigeon/lib/pigeon_lib.dart | 33 +++++++ packages/pigeon/lib/swift_generator.dart | 44 +++++++++ packages/pigeon/test/pigeon_lib_test.dart | 46 +++++++++ .../pigeon/test/swift_generator_test.dart | 95 +++++++++++++++++++ 5 files changed, 225 insertions(+), 1 deletion(-) diff --git a/packages/pigeon/lib/ast.dart b/packages/pigeon/lib/ast.dart index faffc7bcd37..b9a5760ef56 100644 --- a/packages/pigeon/lib/ast.dart +++ b/packages/pigeon/lib/ast.dart @@ -30,6 +30,7 @@ class Method extends Node { this.isAsynchronous = false, this.offset, this.objcSelector = '', + this.swiftFunction = '', this.taskQueueType = TaskQueueType.serial, }); @@ -51,6 +52,9 @@ class Method extends Node { /// An override for the generated objc selector (ex. "divideNumber:by:"). String objcSelector; + /// An override for the generated swift function signature (ex. "divideNumber(_:by:)"). + String swiftFunction; + /// Specifies how handlers are dispatched with respect to threading. TaskQueueType taskQueueType; @@ -58,7 +62,9 @@ class Method extends Node { String toString() { final String objcSelectorStr = objcSelector.isEmpty ? '' : ' objcSelector:$objcSelector'; - return '(Method name:$name returnType:$returnType arguments:$arguments isAsynchronous:$isAsynchronous$objcSelectorStr)'; + final String swiftFunctionStr = + swiftFunction.isEmpty ? '' : ' swiftFunction:$swiftFunction'; + return '(Method name:$name returnType:$returnType arguments:$arguments isAsynchronous:$isAsynchronous$objcSelectorStr swiftFuncton:$swiftFunctionStr)'; } } diff --git a/packages/pigeon/lib/pigeon_lib.dart b/packages/pigeon/lib/pigeon_lib.dart index a05dffeba1d..ece4a045bbf 100644 --- a/packages/pigeon/lib/pigeon_lib.dart +++ b/packages/pigeon/lib/pigeon_lib.dart @@ -20,6 +20,7 @@ import 'package:analyzer/error/error.dart' show AnalysisError; import 'package:args/args.dart'; import 'package:path/path.dart' as path; import 'package:pigeon/cpp_generator.dart'; +import 'package:pigeon/functional.dart'; import 'package:pigeon/generator_tools.dart'; import 'package:pigeon/java_generator.dart'; import 'package:pigeon/swift_generator.dart'; @@ -96,6 +97,19 @@ class ObjCSelector { final String value; } +/// Metadata to annotation methods to control the function signature used for swift output. +/// The number of components in the provided signature must match the number of +/// arguments in the annotated method. +/// For example: +/// @SwiftFunction('setValue(_:for:)') double divide(int value, String key); +class SwiftFunction { + /// Constructor. + const SwiftFunction(this.value); + + /// The string representation of the function signature. + final String value; +} + /// Type of TaskQueue which determines how handlers are dispatched for /// HostApi's. enum TaskQueueType { @@ -665,6 +679,17 @@ List _validateAst(Root root, String source) { )); } } + if (method.swiftFunction.isNotEmpty) { + final RegExp signatureRegex = + RegExp('\\w+ *\\((\\w+:){${method.arguments.length}}\\)'); + if (!signatureRegex.hasMatch(method.swiftFunction)) { + result.add(Error( + message: + 'Invalid function signature, expected ${method.arguments.length} arguments.', + lineNumber: _calculateLineNumberNullable(source, method.offset), + )); + } + } if (method.taskQueueType != TaskQueueType.serial && api.location != ApiLocation.host) { result.add(Error( @@ -947,6 +972,13 @@ class _RootBuilder extends dart_ast_visitor.RecursiveAstVisitor { .asNullable() ?.value ?? ''; + final String swiftFunction = _findMetadata(node.metadata, 'SwiftFunction') + ?.arguments + ?.arguments + .first + .asNullable() + ?.value ?? + ''; final dart_ast.ArgumentList? taskQueueArguments = _findMetadata(node.metadata, 'TaskQueue')?.arguments; final String? taskQueueTypeName = taskQueueArguments == null @@ -973,6 +1005,7 @@ class _RootBuilder extends dart_ast_visitor.RecursiveAstVisitor { arguments: arguments, isAsynchronous: isAsynchronous, objcSelector: objcSelector, + swiftFunction: swiftFunction, offset: node.offset, taskQueueType: taskQueueType)); } else if (_currentClass != null) { diff --git a/packages/pigeon/lib/swift_generator.dart b/packages/pigeon/lib/swift_generator.dart index 8a7d6ec09dd..06888b54734 100644 --- a/packages/pigeon/lib/swift_generator.dart +++ b/packages/pigeon/lib/swift_generator.dart @@ -44,6 +44,45 @@ class SwiftOptions { /// Calculates the name of the codec that will be generated for [api]. String _getCodecName(Api api) => '${api.name}Codec'; +/// Returns a new [Method] using the swift function signature from [func], +/// ie the name of function e the strings between the semicolons. +/// Example: +/// f('void add(int x, int y)') -> ['add', 'x', 'y'] +Method _methodWithSwiftFunction(Method func) { + if (func.swiftFunction.isEmpty) { + return func; + } else { + final String argsCapturator = + repeat(r'(\w+):', func.arguments.length).join(); + final RegExp signatureRegex = RegExp(r'(\w+) *\(' + argsCapturator + r'\)'); + final RegExpMatch? match = signatureRegex.firstMatch(func.swiftFunction); + assert(match != null); + + print(match!.groupCount); + + final Iterable customComponents = match + .groups( + List.generate(func.arguments.length, (int index) => index + 2)) + .whereType(); + + return Method( + name: match.group(1)!, + returnType: func.returnType, + arguments: + map2(func.arguments, customComponents, (NamedType t, String u) { + if (u == t.name) { + return t; + } + + return NamedType(name: '$u ${t.name}', type: t.type); + }).toList(), + isAsynchronous: func.isAsynchronous, + offset: func.offset, + taskQueueType: func.taskQueueType, + ); + } +} + /// Writes the codec classwill be used for encoding messages for the [api]. /// Example: /// private class FooHostApiCodecReader: FlutterStandardReader {...} @@ -602,6 +641,11 @@ void generateSwift(SwiftOptions options, Root root, StringSink sink) { for (final Api api in root.apis) { _writeCodec(indent, api, root); indent.addln(''); + + api.methods = api.methods + .map((Method method) => _methodWithSwiftFunction(method)) + .toList(); + writeApi(api, root); } diff --git a/packages/pigeon/test/pigeon_lib_test.dart b/packages/pigeon/test/pigeon_lib_test.dart index da061d026b4..44d066dfd2a 100644 --- a/packages/pigeon/test/pigeon_lib_test.dart +++ b/packages/pigeon/test/pigeon_lib_test.dart @@ -910,6 +910,52 @@ abstract class Api { expect(results.root.apis[0].methods[0].objcSelector, equals('foobar')); }); + test('custom swift invalid function signature', () { + const String code = ''' +@HostApi() +abstract class Api { + @SwiftFunction('subtractValue(_:by:)') + void subtract(int x, int y); +} +'''; + final ParseResults results = _parseSource(code); + expect(results.errors.length, 0); + expect(results.root.apis.length, 1); + expect(results.root.apis[0].methods.length, equals(1)); + expect(results.root.apis[0].methods[0].swiftFunction, + equals('subtractValue(_:by:)')); + }); + + test('custom swift invalid function signature', () { + const String code = ''' +@HostApi() +abstract class Api { + @SwiftFunction('subtractValue(_:by:error:)') + void subtract(int x, int y); +} +'''; + final ParseResults results = _parseSource(code); + expect(results.errors.length, 1); + expect(results.errors[0].lineNumber, 3); + expect(results.errors[0].message, + contains('Invalid function signature, expected 2 arguments')); + }); + + test('custom swift function signature no arguments', () { + const String code = ''' +@HostApi() +abstract class Api { + @SwiftFunction('foobar()') + void initialize(); +} +'''; + final ParseResults results = _parseSource(code); + expect(results.errors.length, 0); + expect(results.root.apis.length, 1); + expect(results.root.apis[0].methods.length, equals(1)); + expect(results.root.apis[0].methods[0].swiftFunction, equals('foobar()')); + }); + test('dart test has copyright', () { final Root root = Root(apis: [], classes: [], enums: []); const PigeonOptions options = PigeonOptions( diff --git a/packages/pigeon/test/swift_generator_test.dart b/packages/pigeon/test/swift_generator_test.dart index 436d291ed61..51e1cd2e789 100644 --- a/packages/pigeon/test/swift_generator_test.dart +++ b/packages/pigeon/test/swift_generator_test.dart @@ -994,4 +994,99 @@ void main() { final String code = sink.toString(); expect(code, contains('var input: String\n')); }); + + test('swift function signature', () { + final Root root = Root( + apis: [ + Api(name: 'Api', location: ApiLocation.host, methods: [ + Method( + name: 'set', + arguments: [ + NamedType( + type: const TypeDeclaration( + baseName: 'int', + isNullable: false, + ), + name: 'value', + offset: null, + ), + NamedType( + type: const TypeDeclaration( + baseName: 'String', + isNullable: false, + ), + name: 'key', + offset: null, + ), + ], + swiftFunction: 'setValue(_:for:)', + returnType: const TypeDeclaration.voidDeclaration(), + isAsynchronous: false, + ) + ]) + ], + classes: [], + enums: [], + ); + final StringBuffer sink = StringBuffer(); + const SwiftOptions swiftOptions = SwiftOptions(); + generateSwift(swiftOptions, root, sink); + final String code = sink.toString(); + expect(code, contains('func setValue(_ value: Int32, for key: String)')); + }); + + test('swift function signature with same name argument', () { + final Root root = Root( + apis: [ + Api(name: 'Api', location: ApiLocation.host, methods: [ + Method( + name: 'set', + arguments: [ + NamedType( + type: const TypeDeclaration( + baseName: 'String', + isNullable: false, + ), + name: 'key', + offset: null, + ), + ], + swiftFunction: 'removeValue(key:)', + returnType: const TypeDeclaration.voidDeclaration(), + isAsynchronous: false, + ) + ]) + ], + classes: [], + enums: [], + ); + final StringBuffer sink = StringBuffer(); + const SwiftOptions swiftOptions = SwiftOptions(); + generateSwift(swiftOptions, root, sink); + final String code = sink.toString(); + expect(code, contains('func removeValue(key: String)')); + }); + + test('swift function signature with no arguments', () { + final Root root = Root( + apis: [ + Api(name: 'Api', location: ApiLocation.host, methods: [ + Method( + name: 'clear', + arguments: [], + swiftFunction: 'removeAll()', + returnType: const TypeDeclaration.voidDeclaration(), + isAsynchronous: false, + ) + ]) + ], + classes: [], + enums: [], + ); + final StringBuffer sink = StringBuffer(); + const SwiftOptions swiftOptions = SwiftOptions(); + generateSwift(swiftOptions, root, sink); + final String code = sink.toString(); + expect(code, contains('func removeAll()')); + }); } From d3eb40d76729b3533d9ba6dfca9e8dde0d9fb5c5 Mon Sep 17 00:00:00 2001 From: Ailton Vieira Pinto Filho Date: Sun, 3 Jul 2022 20:10:39 -0300 Subject: [PATCH 02/26] Bump version to 3.2.4 --- packages/pigeon/CHANGELOG.md | 3 +++ packages/pigeon/lib/generator_tools.dart | 2 +- packages/pigeon/pubspec.yaml | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/pigeon/CHANGELOG.md b/packages/pigeon/CHANGELOG.md index f784aa0ab94..8e08b877ede 100644 --- a/packages/pigeon/CHANGELOG.md +++ b/packages/pigeon/CHANGELOG.md @@ -1,3 +1,6 @@ +## 3.2.4 +* Adds `@SwiftFunction` annotation for specifying custom swift function signature. + ## 3.2.3 * Adds `unnecessary_import` to linter ignore list in generated dart tests. diff --git a/packages/pigeon/lib/generator_tools.dart b/packages/pigeon/lib/generator_tools.dart index 63f63d7e082..ac1ec27519b 100644 --- a/packages/pigeon/lib/generator_tools.dart +++ b/packages/pigeon/lib/generator_tools.dart @@ -9,7 +9,7 @@ import 'dart:mirrors'; import 'ast.dart'; /// The current version of pigeon. This must match the version in pubspec.yaml. -const String pigeonVersion = '3.2.3'; +const String pigeonVersion = '3.2.4'; /// Read all the content from [stdin] to a String. String readStdin() { diff --git a/packages/pigeon/pubspec.yaml b/packages/pigeon/pubspec.yaml index 4826d6c8976..6d811371473 100644 --- a/packages/pigeon/pubspec.yaml +++ b/packages/pigeon/pubspec.yaml @@ -2,7 +2,7 @@ name: pigeon description: Code generator tool to make communication between Flutter and the host platform type-safe and easier. repository: https://github.com/flutter/packages/tree/main/packages/pigeon issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3Apigeon -version: 3.2.3 # This must match the version in lib/generator_tools.dart +version: 3.2.4 # This must match the version in lib/generator_tools.dart environment: sdk: ">=2.12.0 <3.0.0" From 2920bbfdb05332f395e5637f81c73a8ca93b2b02 Mon Sep 17 00:00:00 2001 From: Ailton Vieira Pinto Filho Date: Sun, 3 Jul 2022 20:15:22 -0300 Subject: [PATCH 03/26] Remove unused imports --- packages/pigeon/lib/pigeon_lib.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/pigeon/lib/pigeon_lib.dart b/packages/pigeon/lib/pigeon_lib.dart index ece4a045bbf..55cc91a5bb5 100644 --- a/packages/pigeon/lib/pigeon_lib.dart +++ b/packages/pigeon/lib/pigeon_lib.dart @@ -20,7 +20,6 @@ import 'package:analyzer/error/error.dart' show AnalysisError; import 'package:args/args.dart'; import 'package:path/path.dart' as path; import 'package:pigeon/cpp_generator.dart'; -import 'package:pigeon/functional.dart'; import 'package:pigeon/generator_tools.dart'; import 'package:pigeon/java_generator.dart'; import 'package:pigeon/swift_generator.dart'; From ac02d63bb804fa78b0ae74333ae849a466506e12 Mon Sep 17 00:00:00 2001 From: Ailton Vieira Pinto Filho Date: Tue, 5 Jul 2022 12:45:47 -0300 Subject: [PATCH 04/26] Improve methods map --- packages/pigeon/lib/swift_generator.dart | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/pigeon/lib/swift_generator.dart b/packages/pigeon/lib/swift_generator.dart index 06888b54734..e0b1efa4454 100644 --- a/packages/pigeon/lib/swift_generator.dart +++ b/packages/pigeon/lib/swift_generator.dart @@ -642,9 +642,7 @@ void generateSwift(SwiftOptions options, Root root, StringSink sink) { _writeCodec(indent, api, root); indent.addln(''); - api.methods = api.methods - .map((Method method) => _methodWithSwiftFunction(method)) - .toList(); + api.methods = api.methods.map(_methodWithSwiftFunction).toList(); writeApi(api, root); } From f52ab0c2a15a6f7e3f5a1a1f8b6384dd5f5ea938 Mon Sep 17 00:00:00 2001 From: Ailton Vieira Pinto Filho Date: Fri, 8 Jul 2022 12:39:05 -0300 Subject: [PATCH 05/26] Remove unnecessary print --- packages/pigeon/lib/swift_generator.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/pigeon/lib/swift_generator.dart b/packages/pigeon/lib/swift_generator.dart index e0b1efa4454..1d0c1f35da0 100644 --- a/packages/pigeon/lib/swift_generator.dart +++ b/packages/pigeon/lib/swift_generator.dart @@ -58,8 +58,6 @@ Method _methodWithSwiftFunction(Method func) { final RegExpMatch? match = signatureRegex.firstMatch(func.swiftFunction); assert(match != null); - print(match!.groupCount); - final Iterable customComponents = match .groups( List.generate(func.arguments.length, (int index) => index + 2)) From b5ec8ae36bfe504e9aaf20a07eacd8c6178f1739 Mon Sep 17 00:00:00 2001 From: Ailton Vieira Pinto Filho Date: Sat, 9 Jul 2022 18:10:32 -0300 Subject: [PATCH 06/26] Force cast match of SwiftFunction --- packages/pigeon/lib/swift_generator.dart | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/pigeon/lib/swift_generator.dart b/packages/pigeon/lib/swift_generator.dart index 1d0c1f35da0..420cf172e36 100644 --- a/packages/pigeon/lib/swift_generator.dart +++ b/packages/pigeon/lib/swift_generator.dart @@ -55,8 +55,7 @@ Method _methodWithSwiftFunction(Method func) { final String argsCapturator = repeat(r'(\w+):', func.arguments.length).join(); final RegExp signatureRegex = RegExp(r'(\w+) *\(' + argsCapturator + r'\)'); - final RegExpMatch? match = signatureRegex.firstMatch(func.swiftFunction); - assert(match != null); + final RegExpMatch match = signatureRegex.firstMatch(func.swiftFunction)!; final Iterable customComponents = match .groups( From ac2b51b4f27089d67c044178b0b3cf36f3209dc8 Mon Sep 17 00:00:00 2001 From: Ailton Vieira Pinto Filho Date: Wed, 27 Jul 2022 17:33:32 -0300 Subject: [PATCH 07/26] Update packages/pigeon/lib/pigeon_lib.dart Co-authored-by: gaaclarke <30870216+gaaclarke@users.noreply.github.com> --- packages/pigeon/lib/pigeon_lib.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pigeon/lib/pigeon_lib.dart b/packages/pigeon/lib/pigeon_lib.dart index 55cc91a5bb5..fb90cce71eb 100644 --- a/packages/pigeon/lib/pigeon_lib.dart +++ b/packages/pigeon/lib/pigeon_lib.dart @@ -96,7 +96,7 @@ class ObjCSelector { final String value; } -/// Metadata to annotation methods to control the function signature used for swift output. +/// Metadata to annotate methods to control the signature used for Swift output. /// The number of components in the provided signature must match the number of /// arguments in the annotated method. /// For example: From 5f70ea269aff532465e711cf75685b4d3eef3c56 Mon Sep 17 00:00:00 2001 From: Ailton Vieira Pinto Filho Date: Wed, 27 Jul 2022 17:50:28 -0300 Subject: [PATCH 08/26] Improve documentation of function to parse method with SwiftFunction --- packages/pigeon/lib/swift_generator.dart | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/pigeon/lib/swift_generator.dart b/packages/pigeon/lib/swift_generator.dart index 6a77d5bba94..12cc68a84b1 100644 --- a/packages/pigeon/lib/swift_generator.dart +++ b/packages/pigeon/lib/swift_generator.dart @@ -47,8 +47,10 @@ String _getCodecName(Api api) => '${api.name}Codec'; /// Returns a new [Method] using the swift function signature from [func], /// ie the name of function e the strings between the semicolons. /// Example: -/// f('void add(int x, int y)') -> ['add', 'x', 'y'] -Method _methodWithSwiftFunction(Method func) { +/// _swiftMethod('@SwiftFunction('add(_:with:)') void add(int x, int y)') +/// will return 'void add(int _ x, int with y)' +/// which represents 'func add(_ x: Int32, with y: Int32) -> Void' in Swift. +Method _swiftMethod(Method func) { if (func.swiftFunction.isEmpty) { return func; } else { @@ -639,7 +641,7 @@ void generateSwift(SwiftOptions options, Root root, StringSink sink) { _writeCodec(indent, api, root); indent.addln(''); - api.methods = api.methods.map(_methodWithSwiftFunction).toList(); + api.methods = api.methods.map(_swiftMethod).toList(); writeApi(api, root); } From 9f86539850fb4bd66b439cd8044c3d1f20406208 Mon Sep 17 00:00:00 2001 From: Ailton Vieira Pinto Filho Date: Wed, 31 Aug 2022 12:53:25 -0300 Subject: [PATCH 09/26] Fix some dartdocs --- packages/pigeon/lib/ast.dart | 2 +- packages/pigeon/lib/swift_generator.dart | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/pigeon/lib/ast.dart b/packages/pigeon/lib/ast.dart index ab1865e6877..4bd88cdefc8 100644 --- a/packages/pigeon/lib/ast.dart +++ b/packages/pigeon/lib/ast.dart @@ -66,7 +66,7 @@ class Method extends Node { objcSelector.isEmpty ? '' : ' objcSelector:$objcSelector'; final String swiftFunctionStr = swiftFunction.isEmpty ? '' : ' swiftFunction:$swiftFunction'; - return '(Method name:$name returnType:$returnType arguments:$arguments isAsynchronous:$isAsynchronous$objcSelectorStr swiftFuncton:$swiftFunctionStr)'; + return '(Method name:$name returnType:$returnType arguments:$arguments isAsynchronous:$isAsynchronous$objcSelectorStr$swiftFunctionStr)'; } } diff --git a/packages/pigeon/lib/swift_generator.dart b/packages/pigeon/lib/swift_generator.dart index ce68f8a2b00..c65b550b4f6 100644 --- a/packages/pigeon/lib/swift_generator.dart +++ b/packages/pigeon/lib/swift_generator.dart @@ -44,7 +44,8 @@ class SwiftOptions { String _getCodecName(Api api) => '${api.name}Codec'; /// Returns a new [Method] using the swift function signature from [func], -/// ie the name of function e the strings between the semicolons. +/// i.e., the name of function and the strings between the semicolons. +/// /// Example: /// _swiftMethod('@SwiftFunction('add(_:with:)') void add(int x, int y)') /// will return 'void add(int _ x, int with y)' From d4175a9d74a27cc92fd28be6e9975d862f0d872b Mon Sep 17 00:00:00 2001 From: tarrinneal Date: Tue, 17 Jan 2023 11:59:48 -0800 Subject: [PATCH 10/26] gen --- packages/pigeon/mock_handler_tester/test/message.dart | 2 +- packages/pigeon/mock_handler_tester/test/test.dart | 2 +- .../com/example/alternate_language_test_plugin/CoreTests.java | 2 +- .../alternate_language_test_plugin/ios/Classes/CoreTests.gen.h | 2 +- .../alternate_language_test_plugin/ios/Classes/CoreTests.gen.m | 2 +- .../flutter_null_safe_unit_tests/lib/core_tests.gen.dart | 2 +- .../flutter_null_safe_unit_tests/lib/multiple_arity.gen.dart | 2 +- .../flutter_null_safe_unit_tests/lib/non_null_fields.gen.dart | 2 +- .../flutter_null_safe_unit_tests/lib/null_fields.gen.dart | 2 +- .../flutter_null_safe_unit_tests/lib/null_safe_pigeon.dart | 2 +- .../flutter_null_safe_unit_tests/lib/nullable_returns.gen.dart | 2 +- .../flutter_null_safe_unit_tests/lib/primitive.dart | 2 +- .../lib/src/generated/core_tests.gen.dart | 2 +- .../src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt | 2 +- .../platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift | 2 +- .../test_plugin/macos/Classes/CoreTests.gen.swift | 2 +- .../test_plugin/windows/pigeon/core_tests.gen.cpp | 2 +- .../platform_tests/test_plugin/windows/pigeon/core_tests.gen.h | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) diff --git a/packages/pigeon/mock_handler_tester/test/message.dart b/packages/pigeon/mock_handler_tester/test/message.dart index 0afd3056f49..ae14da49455 100644 --- a/packages/pigeon/mock_handler_tester/test/message.dart +++ b/packages/pigeon/mock_handler_tester/test/message.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 (v6.0.1), do not edit directly. +// Autogenerated from Pigeon (v6.0.2), 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 diff --git a/packages/pigeon/mock_handler_tester/test/test.dart b/packages/pigeon/mock_handler_tester/test/test.dart index 25f5d73b6df..8e395a84df9 100644 --- a/packages/pigeon/mock_handler_tester/test/test.dart +++ b/packages/pigeon/mock_handler_tester/test/test.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 (v6.0.1), do not edit directly. +// Autogenerated from Pigeon (v6.0.2), 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, unnecessary_import // ignore_for_file: avoid_relative_lib_imports diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java index 13367f2b6eb..dd806cce039 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java @@ -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 (v6.0.1), do not edit directly. +// Autogenerated from Pigeon (v6.0.2), do not edit directly. // See also: https://pub.dev/packages/pigeon package com.example.alternate_language_test_plugin; diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h index a5c55a3ddf8..33070675560 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h @@ -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 (v6.0.1), do not edit directly. +// Autogenerated from Pigeon (v6.0.2), do not edit directly. // See also: https://pub.dev/packages/pigeon #import diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m index c8fa7d8a3d2..05f136c3f77 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m @@ -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 (v6.0.1), do not edit directly. +// Autogenerated from Pigeon (v6.0.2), do not edit directly. // See also: https://pub.dev/packages/pigeon #import "CoreTests.gen.h" 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 index 203f02bcf86..061f43aa405 100644 --- 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 @@ -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 (v6.0.1), do not edit directly. +// Autogenerated from Pigeon (v6.0.2), 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 diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/multiple_arity.gen.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/multiple_arity.gen.dart index 76a6a34767e..00936738d72 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/multiple_arity.gen.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/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 (v6.0.1), do not edit directly. +// Autogenerated from Pigeon (v6.0.2), 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 diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/non_null_fields.gen.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/non_null_fields.gen.dart index f316971d1e1..18b405240ec 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/non_null_fields.gen.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/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 (v6.0.1), do not edit directly. +// Autogenerated from Pigeon (v6.0.2), 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 diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_fields.gen.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_fields.gen.dart index 60f9dc42c45..daed06507ed 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_fields.gen.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/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 (v6.0.1), do not edit directly. +// Autogenerated from Pigeon (v6.0.2), 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 diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_safe_pigeon.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_safe_pigeon.dart index 5d7f772885c..65f56b43278 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_safe_pigeon.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_safe_pigeon.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 (v6.0.1), do not edit directly. +// Autogenerated from Pigeon (v6.0.2), 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 diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/nullable_returns.gen.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/nullable_returns.gen.dart index d29b2eb8773..e42611927dd 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/nullable_returns.gen.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/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 (v6.0.1), do not edit directly. +// Autogenerated from Pigeon (v6.0.2), 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 diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.dart index 72c9ea21ca2..68024561868 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.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 (v6.0.1), do not edit directly. +// Autogenerated from Pigeon (v6.0.2), 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 diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart index 203f02bcf86..061f43aa405 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart @@ -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 (v6.0.1), do not edit directly. +// Autogenerated from Pigeon (v6.0.2), 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 diff --git a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt index c5f0ee0fa4f..0b21b17b52f 100644 --- a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt +++ b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt @@ -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 (v6.0.1), do not edit directly. +// Autogenerated from Pigeon (v6.0.2), do not edit directly. // See also: https://pub.dev/packages/pigeon package com.example.test_plugin diff --git a/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift b/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift index 522a9d73343..8745ddb3943 100644 --- a/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift +++ b/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift @@ -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 (v6.0.1), do not edit directly. +// Autogenerated from Pigeon (v6.0.2), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation diff --git a/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift b/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift index 522a9d73343..8745ddb3943 100644 --- a/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift +++ b/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift @@ -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 (v6.0.1), do not edit directly. +// Autogenerated from Pigeon (v6.0.2), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation diff --git a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp index d205dbb0e1f..78aa2ceb8c4 100644 --- a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp +++ b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp @@ -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 (v6.0.1), do not edit directly. +// Autogenerated from Pigeon (v6.0.2), do not edit directly. // See also: https://pub.dev/packages/pigeon #undef _HAS_EXCEPTIONS diff --git a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h index 545a050caf3..541851646dd 100644 --- a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h +++ b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h @@ -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 (v6.0.1), do not edit directly. +// Autogenerated from Pigeon (v6.0.2), do not edit directly. // See also: https://pub.dev/packages/pigeon #ifndef PIGEON_CORE_TESTS_GEN_H_ From 09ebdea0ba8ba5abfa5a665868afd61e8f14691f Mon Sep 17 00:00:00 2001 From: tarrinneal Date: Tue, 17 Jan 2023 12:24:14 -0800 Subject: [PATCH 11/26] analyze --- packages/pigeon/test/swift_generator_test.dart | 6 ------ 1 file changed, 6 deletions(-) diff --git a/packages/pigeon/test/swift_generator_test.dart b/packages/pigeon/test/swift_generator_test.dart index e9186aecd53..1618216d1bb 100644 --- a/packages/pigeon/test/swift_generator_test.dart +++ b/packages/pigeon/test/swift_generator_test.dart @@ -1156,7 +1156,6 @@ void main() { isNullable: false, ), name: 'value', - offset: null, ), NamedType( type: const TypeDeclaration( @@ -1164,12 +1163,10 @@ void main() { isNullable: false, ), name: 'key', - offset: null, ), ], swiftFunction: 'setValue(_:for:)', returnType: const TypeDeclaration.voidDeclaration(), - isAsynchronous: false, ) ]) ], @@ -1197,12 +1194,10 @@ void main() { isNullable: false, ), name: 'key', - offset: null, ), ], swiftFunction: 'removeValue(key:)', returnType: const TypeDeclaration.voidDeclaration(), - isAsynchronous: false, ) ]) ], @@ -1226,7 +1221,6 @@ void main() { arguments: [], swiftFunction: 'removeAll()', returnType: const TypeDeclaration.voidDeclaration(), - isAsynchronous: false, ) ]) ], From 6db9d1b248e6a676c243780f1c70ba3570a60c77 Mon Sep 17 00:00:00 2001 From: Ailton Vieira Pinto Filho Date: Wed, 18 Jan 2023 08:01:12 -0300 Subject: [PATCH 12/26] Improve SwiftFunction application --- packages/pigeon/lib/swift_generator.dart | 169 +++++++++++------- packages/pigeon/pigeons/core_tests.dart | 35 ++++ .../ios/RunnerTests/AllDatatypesTests.swift | 4 +- .../ios/Classes/CoreTests.gen.swift | 108 +++++------ .../test_plugin/ios/Classes/TestPlugin.swift | 40 ++--- .../macos/Classes/CoreTests.gen.swift | 108 +++++------ packages/pigeon/test/pigeon_lib_test.dart | 2 +- 7 files changed, 275 insertions(+), 191 deletions(-) diff --git a/packages/pigeon/lib/swift_generator.dart b/packages/pigeon/lib/swift_generator.dart index f0ead7326c7..43aba2d8576 100644 --- a/packages/pigeon/lib/swift_generator.dart +++ b/packages/pigeon/lib/swift_generator.dart @@ -271,7 +271,6 @@ import FlutterMacOS if (isCustomCodec) { _writeCodec(indent, api, root); } - api.methods = api.methods.map(_swiftMethod).toList(); const List generatedComments = [ ' Generated class from Pigeon that represents Flutter messages that can be called from Swift.' ]; @@ -295,6 +294,9 @@ import FlutterMacOS }); } for (final Method func in api.methods) { + final _SwiftFunctionComponents components = + _SwiftFunctionComponents.fromMethod(func); + final String channelName = makeChannelName(api, func); final String returnType = func.returnType.isVoid ? '' @@ -310,8 +312,15 @@ import FlutterMacOS } else { final Iterable argTypes = func.arguments .map((NamedType e) => _nullsafeSwiftTypeForDartType(e.type)); - final Iterable argLabels = - indexMap(func.arguments, _getArgumentName); + final Iterable argLabels = indexMap(components.arguments, + (int index, _SwiftFunctionArgument argument) { + final String? label = argument.label; + if (label == null) { + return _getArgumentName(index, argument.namedType); + } else { + return label; + } + }); final Iterable argNames = indexMap(func.arguments, _getSafeArgumentName); sendArgument = '[${argNames.join(', ')}] as [Any?]'; @@ -323,10 +332,10 @@ import FlutterMacOS '$label $name: $type').join(', '); if (func.returnType.isVoid) { indent.write( - 'func ${func.name}($argsSignature, completion: @escaping () -> Void) '); + 'func ${components.name}($argsSignature, completion: @escaping () -> Void) '); } else { indent.write( - 'func ${func.name}($argsSignature, completion: @escaping ($returnType) -> Void) '); + 'func ${components.name}($argsSignature, completion: @escaping ($returnType) -> Void) '); } } indent.scoped('{', '}', () { @@ -370,7 +379,6 @@ import FlutterMacOS if (isCustomCodec) { _writeCodec(indent, api, root); } - api.methods = api.methods.map(_swiftMethod).toList(); const List generatedComments = [ ' Generated protocol from Pigeon that represents a handler of messages from Flutter.' ]; @@ -380,17 +388,19 @@ import FlutterMacOS indent.write('protocol $apiName '); indent.scoped('{', '}', () { for (final Method method in api.methods) { - final List argSignature = []; - if (method.arguments.isNotEmpty) { - final Iterable argTypes = method.arguments - .map((NamedType e) => _nullsafeSwiftTypeForDartType(e.type)); - final Iterable argNames = - method.arguments.map((NamedType e) => e.name); - argSignature.addAll( - map2(argTypes, argNames, (String argType, String argName) { - return '$argName: $argType'; - })); - } + final _SwiftFunctionComponents components = + _SwiftFunctionComponents.fromMethod(method); + final List argSignature = + components.arguments.map((_SwiftFunctionArgument argument) { + final String? label = argument.label; + final String name = argument.name; + final String type = _nullsafeSwiftTypeForDartType(argument.type); + if (label != null) { + return '$label $name: $type'; + } else { + return '$name: $type'; + } + }).toList(); final String returnType = method.returnType.isVoid ? '' @@ -400,12 +410,12 @@ import FlutterMacOS if (method.isAsynchronous) { argSignature.add('completion: @escaping ($returnType) -> Void'); - indent.writeln('func ${method.name}(${argSignature.join(', ')})'); + indent.writeln('func ${components.name}(${argSignature.join(', ')})'); } else if (method.returnType.isVoid) { - indent.writeln('func ${method.name}(${argSignature.join(', ')})'); + indent.writeln('func ${components.name}(${argSignature.join(', ')})'); } else { indent.writeln( - 'func ${method.name}(${argSignature.join(', ')}) -> $returnType'); + 'func ${components.name}(${argSignature.join(', ')}) -> $returnType'); } } }); @@ -429,6 +439,9 @@ import FlutterMacOS 'static func setUp(binaryMessenger: FlutterBinaryMessenger, api: $apiName?) '); indent.scoped('{', '}', () { for (final Method method in api.methods) { + final _SwiftFunctionComponents components = + _SwiftFunctionComponents.fromMethod(method); + final String channelName = makeChannelName(api, method); final String varChannelName = '${method.name}Channel'; addDocumentationComments( @@ -443,18 +456,20 @@ import FlutterMacOS method.arguments.isNotEmpty ? 'message' : '_'; indent.scoped('{ $messageVarName, reply in', '}', () { final List methodArgument = []; - if (method.arguments.isNotEmpty) { + if (components.arguments.isNotEmpty) { indent.writeln('let args = message as! [Any?]'); - enumerate(method.arguments, (int index, NamedType arg) { - final String argName = _getSafeArgumentName(index, arg); + enumerate(components.arguments, + (int index, _SwiftFunctionArgument arg) { + final String argName = + _getSafeArgumentName(index, arg.namedType); final String argIndex = 'args[$index]'; indent.writeln( 'let $argName = ${_castForceUnwrap(argIndex, arg.type, root)}'); - methodArgument.add('${arg.name}: $argName'); + methodArgument.add('${arg.label ?? arg.name}: $argName'); }); } final String call = - 'api.${method.name}(${methodArgument.join(', ')})'; + 'api.${components.name}(${methodArgument.join(', ')})'; if (method.isAsynchronous) { indent.write('$call '); if (method.returnType.isVoid) { @@ -696,41 +711,75 @@ String _nullsafeSwiftTypeForDartType(TypeDeclaration type) { return '${_swiftTypeForDartType(type)}$nullSafe'; } -/// Returns a new [Method] using the swift function signature from [func], -/// i.e., the name of function and the strings between the semicolons. -/// -/// Example: -/// _swiftMethod('@SwiftFunction('add(_:with:)') void add(int x, int y)') -/// will return 'void add(int _ x, int with y)' -/// which represents 'func add(_ x: Int32, with y: Int32) -> Void' in Swift. -Method _swiftMethod(Method func) { - if (func.swiftFunction.isEmpty) { - return func; - } else { - final String argsCapturator = - repeat(r'(\w+):', func.arguments.length).join(); - final RegExp signatureRegex = RegExp(r'(\w+) *\(' + argsCapturator + r'\)'); - final RegExpMatch match = signatureRegex.firstMatch(func.swiftFunction)!; - - final Iterable customComponents = match - .groups( - List.generate(func.arguments.length, (int index) => index + 2)) - .whereType(); - - return Method( - name: match.group(1)!, - returnType: func.returnType, - arguments: - map2(func.arguments, customComponents, (NamedType t, String u) { - if (u == t.name) { - return t; - } +class _SwiftFunctionArgument { + _SwiftFunctionArgument({ + required this.name, + this.label, + required this.type, + required this.namedType, + }); - return NamedType(name: '$u ${t.name}', type: t.type); - }).toList(), - isAsynchronous: func.isAsynchronous, - offset: func.offset, - taskQueueType: func.taskQueueType, - ); + final String name; + final String? label; + final TypeDeclaration type; + final NamedType namedType; +} + +class _SwiftFunctionComponents { + _SwiftFunctionComponents._({ + required this.name, + required this.arguments, + required this.returnType, + required this.method, + }); + + factory _SwiftFunctionComponents.fromMethod(Method method) { + if (method.swiftFunction.isEmpty) { + return _SwiftFunctionComponents._( + name: method.name, + returnType: method.returnType, + arguments: method.arguments + .map((e) => _SwiftFunctionArgument( + name: e.name, + type: e.type, + namedType: e, + )) + .toList(), + method: method, + ); + } else { + final String argsCapturator = + repeat(r'(\w+):', method.arguments.length).join(); + final RegExp signatureRegex = + RegExp(r'(\w+) *\(' + argsCapturator + r'\)'); + final RegExpMatch match = + signatureRegex.firstMatch(method.swiftFunction)!; + + final Iterable customComponents = match + .groups(List.generate( + method.arguments.length, (int index) => index + 2)) + .whereType(); + + return _SwiftFunctionComponents._( + name: match.group(1)!, + returnType: method.returnType, + arguments: map2( + method.arguments, + customComponents, + (NamedType t, String u) => _SwiftFunctionArgument( + name: t.name, + label: u == t.name ? null : u, + type: t.type, + namedType: t, + ), + ).toList(), + method: method, + ); + } } + + final String name; + final List<_SwiftFunctionArgument> arguments; + final TypeDeclaration returnType; + final Method method; } diff --git a/packages/pigeon/pigeons/core_tests.dart b/packages/pigeon/pigeons/core_tests.dart index 1699b0f49df..8fb9ed86fc9 100644 --- a/packages/pigeon/pigeons/core_tests.dart +++ b/packages/pigeon/pigeons/core_tests.dart @@ -96,10 +96,12 @@ abstract class HostIntegrationCoreApi { /// Returns the passed object, to test serialization and deserialization. @ObjCSelector('echoAllTypes:') + @SwiftFunction('echo(allTypes:)') AllTypes echoAllTypes(AllTypes everything); /// Returns the passed object, to test serialization and deserialization. @ObjCSelector('echoAllNullableTypes:') + @SwiftFunction('echo(allNullableTypes:)') AllNullableTypes? echoAllNullableTypes(AllNullableTypes? everything); /// Returns an error, to test error handling. @@ -107,26 +109,32 @@ abstract class HostIntegrationCoreApi { /// Returns passed in int. @ObjCSelector('echoInt:') + @SwiftFunction('echo(int:)') int echoInt(int anInt); /// Returns passed in double. @ObjCSelector('echoDouble:') + @SwiftFunction('echo(double:)') double echoDouble(double aDouble); /// Returns the passed in boolean. @ObjCSelector('echoBool:') + @SwiftFunction('echo(bool:)') bool echoBool(bool aBool); /// Returns the passed in string. @ObjCSelector('echoString:') + @SwiftFunction('echo(string:)') String echoString(String aString); /// Returns the passed in Uint8List. @ObjCSelector('echoUint8List:') + @SwiftFunction('echo(uint8List:)') Uint8List echoUint8List(Uint8List aUint8List); /// Returns the passed in generic Object. @ObjCSelector('echoObject:') + @SwiftFunction('echo(object:)') Object echoObject(Object anObject); // ========== Syncronous nullable method tests ========== @@ -134,40 +142,49 @@ abstract class HostIntegrationCoreApi { /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. @ObjCSelector('extractNestedNullableStringFrom:') + @SwiftFunction('extractNestedNullableString(from:)') String? extractNestedNullableString(AllNullableTypesWrapper wrapper); /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. @ObjCSelector('createNestedObjectWithNullableString:') + @SwiftFunction('createNestedObject(with:)') AllNullableTypesWrapper createNestedNullableString(String? nullableString); /// Returns passed in arguments of multiple types. @ObjCSelector('sendMultipleNullableTypesABool:anInt:aString:') + @SwiftFunction('sendMultipleNullableTypes(aBool:anInt:aString:)') AllNullableTypes sendMultipleNullableTypes( bool? aNullableBool, int? aNullableInt, String? aNullableString); /// Returns passed in int. @ObjCSelector('echoNullableInt:') + @SwiftFunction('echo(nullableInt:)') int? echoNullableInt(int? aNullableInt); /// Returns passed in double. @ObjCSelector('echoNullableDouble:') + @SwiftFunction('echo(nullableDouble:)') double? echoNullableDouble(double? aNullableDouble); /// Returns the passed in boolean. @ObjCSelector('echoNullableBool:') + @SwiftFunction('echo(nullableBool:)') bool? echoNullableBool(bool? aNullableBool); /// Returns the passed in string. @ObjCSelector('echoNullableString:') + @SwiftFunction('echo(nullableString:)') String? echoNullableString(String? aNullableString); /// Returns the passed in Uint8List. @ObjCSelector('echoNullableUint8List:') + @SwiftFunction('echo(nullableUint8List:)') Uint8List? echoNullableUint8List(Uint8List? aNullableUint8List); /// Returns the passed in generic Object. @ObjCSelector('echoNullableObject:') + @SwiftFunction('echo(nullableObject:)') Object? echoNullableObject(Object? aNullableObject); // ========== Asyncronous method tests ========== @@ -180,6 +197,7 @@ abstract class HostIntegrationCoreApi { /// Returns the passed string asynchronously. @async @ObjCSelector('echoAsyncString:') + @SwiftFunction('echoAsync(string:)') String echoAsyncString(String aString); // ========== Flutter API test wrappers ========== @@ -189,6 +207,7 @@ abstract class HostIntegrationCoreApi { @async @ObjCSelector('callFlutterEchoString:') + @SwiftFunction('callFlutterEcho(string:)') String callFlutterEchoString(String aString); // TODO(stuartmorgan): Add callFlutterEchoAllTypes and the associated test @@ -209,16 +228,19 @@ abstract class FlutterIntegrationCoreApi { /// Returns the passed object, to test serialization and deserialization. @ObjCSelector('echoAllTypes:') + @SwiftFunction('echo(allTypes:)') AllTypes echoAllTypes(AllTypes everything); /// Returns the passed object, to test serialization and deserialization. @ObjCSelector('echoAllNullableTypes:') + @SwiftFunction('echo(allNullableTypes:)') AllNullableTypes echoAllNullableTypes(AllNullableTypes everything); /// Returns passed in arguments of multiple types. /// /// Tests multiple-arity FlutterApi handling. @ObjCSelector('sendMultipleNullableTypesABool:anInt:aString:') + @SwiftFunction('sendMultipleNullableTypes(aBool:anInt:aString:)') AllNullableTypes sendMultipleNullableTypes( bool? aNullableBool, int? aNullableInt, String? aNullableString); @@ -226,26 +248,32 @@ abstract class FlutterIntegrationCoreApi { /// Returns the passed boolean, to test serialization and deserialization. @ObjCSelector('echoBool:') + @SwiftFunction('echo(bool:)') bool echoBool(bool aBool); /// Returns the passed int, to test serialization and deserialization. @ObjCSelector('echoInt:') + @SwiftFunction('echo(int:)') int echoInt(int anInt); /// Returns the passed double, to test serialization and deserialization. @ObjCSelector('echoDouble:') + @SwiftFunction('echo(double:)') double echoDouble(double aDouble); /// Returns the passed string, to test serialization and deserialization. @ObjCSelector('echoString:') + @SwiftFunction('echo(string:)') String echoString(String aString); /// Returns the passed byte list, to test serialization and deserialization. @ObjCSelector('echoUint8List:') + @SwiftFunction('echo(uint8List:)') Uint8List echoUint8List(Uint8List aList); /// Returns the passed list, to test serialization and deserialization. @ObjCSelector('echoList:') + @SwiftFunction('echo(list:)') List echoList(List aList); /// Returns the passed map, to test serialization and deserialization. @@ -256,30 +284,37 @@ abstract class FlutterIntegrationCoreApi { /// Returns the passed boolean, to test serialization and deserialization. @ObjCSelector('echoNullableBool:') + @SwiftFunction('echo(nullableBool:)') bool? echoNullableBool(bool? aBool); /// Returns the passed int, to test serialization and deserialization. @ObjCSelector('echoNullableInt:') + @SwiftFunction('echo(nullableInt:)') int? echoNullableInt(int? anInt); /// Returns the passed double, to test serialization and deserialization. @ObjCSelector('echoNullableDouble:') + @SwiftFunction('echo(nullableDouble:)') double? echoNullableDouble(double? aDouble); /// Returns the passed string, to test serialization and deserialization. @ObjCSelector('echoNullableString:') + @SwiftFunction('echo(nullableString:)') String? echoNullableString(String? aString); /// Returns the passed byte list, to test serialization and deserialization. @ObjCSelector('echoNullableUint8List:') + @SwiftFunction('echo(nullableUint8List:)') Uint8List? echoNullableUint8List(Uint8List? aList); /// Returns the passed list, to test serialization and deserialization. @ObjCSelector('echoNullableList:') + @SwiftFunction('echo(nullableList:)') List? echoNullableList(List? aList); /// Returns the passed map, to test serialization and deserialization. @ObjCSelector('echoNullableMap:') + @SwiftFunction('echo(nullableMap:)') Map echoNullableMap(Map aMap); } diff --git a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/AllDatatypesTests.swift b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/AllDatatypesTests.swift index ac439ca8710..3187a03f5d4 100644 --- a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/AllDatatypesTests.swift +++ b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/AllDatatypesTests.swift @@ -15,7 +15,7 @@ class AllDatatypesTests: XCTestCase { let expectation = XCTestExpectation(description: "callback") - api.echoAllNullableTypes(everything: everything) { result in + api.echo(allNullableTypes: everything) { result in XCTAssertNil(result.aNullableBool) XCTAssertNil(result.aNullableInt) XCTAssertNil(result.aNullableDouble) @@ -57,7 +57,7 @@ class AllDatatypesTests: XCTestCase { let expectation = XCTestExpectation(description: "callback") - api.echoAllNullableTypes(everything: everything) { result in + api.echo(allNullableTypes: everything) { result in XCTAssertEqual(result.aNullableBool, everything.aNullableBool) XCTAssertEqual(result.aNullableInt, everything.aNullableInt) XCTAssertEqual(result.aNullableDouble, everything.aNullableDouble) diff --git a/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift b/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift index 8745ddb3943..eeb438d7107 100644 --- a/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift +++ b/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift @@ -238,50 +238,50 @@ protocol HostIntegrationCoreApi { /// test basic calling. func noop() /// Returns the passed object, to test serialization and deserialization. - func echoAllTypes(everything: AllTypes) -> AllTypes + func echo(allTypes everything: AllTypes) -> AllTypes /// Returns the passed object, to test serialization and deserialization. - func echoAllNullableTypes(everything: AllNullableTypes?) -> AllNullableTypes? + func echo(allNullableTypes everything: AllNullableTypes?) -> AllNullableTypes? /// Returns an error, to test error handling. func throwError() /// Returns passed in int. - func echoInt(anInt: Int32) -> Int32 + func echo(int anInt: Int32) -> Int32 /// Returns passed in double. - func echoDouble(aDouble: Double) -> Double + func echo(double aDouble: Double) -> Double /// Returns the passed in boolean. - func echoBool(aBool: Bool) -> Bool + func echo(bool aBool: Bool) -> Bool /// Returns the passed in string. - func echoString(aString: String) -> String + func echo(string aString: String) -> String /// Returns the passed in Uint8List. - func echoUint8List(aUint8List: FlutterStandardTypedData) -> FlutterStandardTypedData + func echo(uint8List aUint8List: FlutterStandardTypedData) -> FlutterStandardTypedData /// Returns the passed in generic Object. - func echoObject(anObject: Any) -> Any + func echo(object anObject: Any) -> Any /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. - func extractNestedNullableString(wrapper: AllNullableTypesWrapper) -> String? + func extractNestedNullableString(from wrapper: AllNullableTypesWrapper) -> String? /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. - func createNestedNullableString(nullableString: String?) -> AllNullableTypesWrapper + func createNestedObject(with nullableString: String?) -> AllNullableTypesWrapper /// Returns passed in arguments of multiple types. - func sendMultipleNullableTypes(aNullableBool: Bool?, aNullableInt: Int32?, aNullableString: String?) -> AllNullableTypes + func sendMultipleNullableTypes(aBool aNullableBool: Bool?, anInt aNullableInt: Int32?, aString aNullableString: String?) -> AllNullableTypes /// Returns passed in int. - func echoNullableInt(aNullableInt: Int32?) -> Int32? + func echo(nullableInt aNullableInt: Int32?) -> Int32? /// Returns passed in double. - func echoNullableDouble(aNullableDouble: Double?) -> Double? + func echo(nullableDouble aNullableDouble: Double?) -> Double? /// Returns the passed in boolean. - func echoNullableBool(aNullableBool: Bool?) -> Bool? + func echo(nullableBool aNullableBool: Bool?) -> Bool? /// Returns the passed in string. - func echoNullableString(aNullableString: String?) -> String? + func echo(nullableString aNullableString: String?) -> String? /// Returns the passed in Uint8List. - func echoNullableUint8List(aNullableUint8List: FlutterStandardTypedData?) -> FlutterStandardTypedData? + func echo(nullableUint8List aNullableUint8List: FlutterStandardTypedData?) -> FlutterStandardTypedData? /// Returns the passed in generic Object. - func echoNullableObject(aNullableObject: Any?) -> Any? + func echo(nullableObject aNullableObject: Any?) -> Any? /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. func noopAsync(completion: @escaping () -> Void) /// Returns the passed string asynchronously. - func echoAsyncString(aString: String, completion: @escaping (String) -> Void) + func echoAsync(string aString: String, completion: @escaping (String) -> Void) func callFlutterNoop(completion: @escaping () -> Void) - func callFlutterEchoString(aString: String, completion: @escaping (String) -> Void) + func callFlutterEcho(string aString: String, completion: @escaping (String) -> Void) } /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. @@ -307,7 +307,7 @@ class HostIntegrationCoreApiSetup { echoAllTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let everythingArg = args[0] as! AllTypes - let result = api.echoAllTypes(everything: everythingArg) + let result = api.echo(allTypes: everythingArg) reply(wrapResult(result)) } } else { @@ -319,7 +319,7 @@ class HostIntegrationCoreApiSetup { echoAllNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let everythingArg = args[0] as? AllNullableTypes - let result = api.echoAllNullableTypes(everything: everythingArg) + let result = api.echo(allNullableTypes: everythingArg) reply(wrapResult(result)) } } else { @@ -341,7 +341,7 @@ class HostIntegrationCoreApiSetup { echoIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anIntArg = args[0] as! Int32 - let result = api.echoInt(anInt: anIntArg) + let result = api.echo(int: anIntArg) reply(wrapResult(result)) } } else { @@ -353,7 +353,7 @@ class HostIntegrationCoreApiSetup { echoDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aDoubleArg = args[0] as! Double - let result = api.echoDouble(aDouble: aDoubleArg) + let result = api.echo(double: aDoubleArg) reply(wrapResult(result)) } } else { @@ -365,7 +365,7 @@ class HostIntegrationCoreApiSetup { echoBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aBoolArg = args[0] as! Bool - let result = api.echoBool(aBool: aBoolArg) + let result = api.echo(bool: aBoolArg) reply(wrapResult(result)) } } else { @@ -377,7 +377,7 @@ class HostIntegrationCoreApiSetup { echoStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg = args[0] as! String - let result = api.echoString(aString: aStringArg) + let result = api.echo(string: aStringArg) reply(wrapResult(result)) } } else { @@ -389,7 +389,7 @@ class HostIntegrationCoreApiSetup { echoUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aUint8ListArg = args[0] as! FlutterStandardTypedData - let result = api.echoUint8List(aUint8List: aUint8ListArg) + let result = api.echo(uint8List: aUint8ListArg) reply(wrapResult(result)) } } else { @@ -401,7 +401,7 @@ class HostIntegrationCoreApiSetup { echoObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anObjectArg = args[0]! - let result = api.echoObject(anObject: anObjectArg) + let result = api.echo(object: anObjectArg) reply(wrapResult(result)) } } else { @@ -414,7 +414,7 @@ class HostIntegrationCoreApiSetup { extractNestedNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let wrapperArg = args[0] as! AllNullableTypesWrapper - let result = api.extractNestedNullableString(wrapper: wrapperArg) + let result = api.extractNestedNullableString(from: wrapperArg) reply(wrapResult(result)) } } else { @@ -427,7 +427,7 @@ class HostIntegrationCoreApiSetup { createNestedNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let nullableStringArg = args[0] as? String - let result = api.createNestedNullableString(nullableString: nullableStringArg) + let result = api.createNestedObject(with: nullableStringArg) reply(wrapResult(result)) } } else { @@ -441,7 +441,7 @@ class HostIntegrationCoreApiSetup { let aNullableBoolArg = args[0] as? Bool let aNullableIntArg = args[1] as? Int32 let aNullableStringArg = args[2] as? String - let result = api.sendMultipleNullableTypes(aNullableBool: aNullableBoolArg, aNullableInt: aNullableIntArg, aNullableString: aNullableStringArg) + let result = api.sendMultipleNullableTypes(aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg) reply(wrapResult(result)) } } else { @@ -453,7 +453,7 @@ class HostIntegrationCoreApiSetup { echoNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableIntArg = args[0] as? Int32 - let result = api.echoNullableInt(aNullableInt: aNullableIntArg) + let result = api.echo(nullableInt: aNullableIntArg) reply(wrapResult(result)) } } else { @@ -465,7 +465,7 @@ class HostIntegrationCoreApiSetup { echoNullableDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableDoubleArg = args[0] as? Double - let result = api.echoNullableDouble(aNullableDouble: aNullableDoubleArg) + let result = api.echo(nullableDouble: aNullableDoubleArg) reply(wrapResult(result)) } } else { @@ -477,7 +477,7 @@ class HostIntegrationCoreApiSetup { echoNullableBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableBoolArg = args[0] as? Bool - let result = api.echoNullableBool(aNullableBool: aNullableBoolArg) + let result = api.echo(nullableBool: aNullableBoolArg) reply(wrapResult(result)) } } else { @@ -489,7 +489,7 @@ class HostIntegrationCoreApiSetup { echoNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableStringArg = args[0] as? String - let result = api.echoNullableString(aNullableString: aNullableStringArg) + let result = api.echo(nullableString: aNullableStringArg) reply(wrapResult(result)) } } else { @@ -501,7 +501,7 @@ class HostIntegrationCoreApiSetup { echoNullableUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableUint8ListArg = args[0] as? FlutterStandardTypedData - let result = api.echoNullableUint8List(aNullableUint8List: aNullableUint8ListArg) + let result = api.echo(nullableUint8List: aNullableUint8ListArg) reply(wrapResult(result)) } } else { @@ -513,7 +513,7 @@ class HostIntegrationCoreApiSetup { echoNullableObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableObjectArg = args[0] - let result = api.echoNullableObject(aNullableObject: aNullableObjectArg) + let result = api.echo(nullableObject: aNullableObjectArg) reply(wrapResult(result)) } } else { @@ -537,7 +537,7 @@ class HostIntegrationCoreApiSetup { echoAsyncStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg = args[0] as! String - api.echoAsyncString(aString: aStringArg) { result in + api.echoAsync(string: aStringArg) { result in reply(wrapResult(result)) } } @@ -559,7 +559,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg = args[0] as! String - api.callFlutterEchoString(aString: aStringArg) { result in + api.callFlutterEcho(string: aStringArg) { result in reply(wrapResult(result)) } } @@ -635,7 +635,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed object, to test serialization and deserialization. - func echoAllTypes(everything everythingArg: AllTypes, completion: @escaping (AllTypes) -> Void) { + func echo(allTypes everythingArg: AllTypes, completion: @escaping (AllTypes) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllTypes", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([everythingArg] as [Any?]) { response in let result = response as! AllTypes @@ -643,7 +643,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed object, to test serialization and deserialization. - func echoAllNullableTypes(everything everythingArg: AllNullableTypes, completion: @escaping (AllNullableTypes) -> Void) { + func echo(allNullableTypes everythingArg: AllNullableTypes, completion: @escaping (AllNullableTypes) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([everythingArg] as [Any?]) { response in let result = response as! AllNullableTypes @@ -653,7 +653,7 @@ class FlutterIntegrationCoreApi { /// Returns passed in arguments of multiple types. /// /// Tests multiple-arity FlutterApi handling. - func sendMultipleNullableTypes(aNullableBool aNullableBoolArg: Bool?, aNullableInt aNullableIntArg: Int32?, aNullableString aNullableStringArg: String?, completion: @escaping (AllNullableTypes) -> Void) { + func sendMultipleNullableTypes(aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int32?, aString aNullableStringArg: String?, completion: @escaping (AllNullableTypes) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.sendMultipleNullableTypes", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aNullableBoolArg, aNullableIntArg, aNullableStringArg] as [Any?]) { response in let result = response as! AllNullableTypes @@ -661,7 +661,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed boolean, to test serialization and deserialization. - func echoBool(aBool aBoolArg: Bool, completion: @escaping (Bool) -> Void) { + func echo(bool aBoolArg: Bool, completion: @escaping (Bool) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoBool", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aBoolArg] as [Any?]) { response in let result = response as! Bool @@ -669,7 +669,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed int, to test serialization and deserialization. - func echoInt(anInt anIntArg: Int32, completion: @escaping (Int32) -> Void) { + func echo(int anIntArg: Int32, completion: @escaping (Int32) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoInt", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anIntArg] as [Any?]) { response in let result = response as! Int32 @@ -677,7 +677,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed double, to test serialization and deserialization. - func echoDouble(aDouble aDoubleArg: Double, completion: @escaping (Double) -> Void) { + func echo(double aDoubleArg: Double, completion: @escaping (Double) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoDouble", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aDoubleArg] as [Any?]) { response in let result = response as! Double @@ -685,7 +685,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed string, to test serialization and deserialization. - func echoString(aString aStringArg: String, completion: @escaping (String) -> Void) { + func echo(string aStringArg: String, completion: @escaping (String) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoString", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in let result = response as! String @@ -693,7 +693,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed byte list, to test serialization and deserialization. - func echoUint8List(aList aListArg: FlutterStandardTypedData, completion: @escaping (FlutterStandardTypedData) -> Void) { + func echo(uint8List aListArg: FlutterStandardTypedData, completion: @escaping (FlutterStandardTypedData) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoUint8List", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in let result = response as! FlutterStandardTypedData @@ -701,7 +701,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed list, to test serialization and deserialization. - func echoList(aList aListArg: [Any?], completion: @escaping ([Any?]) -> Void) { + func echo(list aListArg: [Any?], completion: @escaping ([Any?]) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoList", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in let result = response as! [Any?] @@ -717,7 +717,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed boolean, to test serialization and deserialization. - func echoNullableBool(aBool aBoolArg: Bool?, completion: @escaping (Bool?) -> Void) { + func echo(nullableBool aBoolArg: Bool?, completion: @escaping (Bool?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableBool", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aBoolArg] as [Any?]) { response in let result = response as? Bool @@ -725,7 +725,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed int, to test serialization and deserialization. - func echoNullableInt(anInt anIntArg: Int32?, completion: @escaping (Int32?) -> Void) { + func echo(nullableInt anIntArg: Int32?, completion: @escaping (Int32?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableInt", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anIntArg] as [Any?]) { response in let result = response as? Int32 @@ -733,7 +733,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed double, to test serialization and deserialization. - func echoNullableDouble(aDouble aDoubleArg: Double?, completion: @escaping (Double?) -> Void) { + func echo(nullableDouble aDoubleArg: Double?, completion: @escaping (Double?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableDouble", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aDoubleArg] as [Any?]) { response in let result = response as? Double @@ -741,7 +741,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed string, to test serialization and deserialization. - func echoNullableString(aString aStringArg: String?, completion: @escaping (String?) -> Void) { + func echo(nullableString aStringArg: String?, completion: @escaping (String?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableString", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in let result = response as? String @@ -749,7 +749,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed byte list, to test serialization and deserialization. - func echoNullableUint8List(aList aListArg: FlutterStandardTypedData?, completion: @escaping (FlutterStandardTypedData?) -> Void) { + func echo(nullableUint8List aListArg: FlutterStandardTypedData?, completion: @escaping (FlutterStandardTypedData?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableUint8List", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in let result = response as? FlutterStandardTypedData @@ -757,7 +757,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed list, to test serialization and deserialization. - func echoNullableList(aList aListArg: [Any?]?, completion: @escaping ([Any?]?) -> Void) { + func echo(nullableList aListArg: [Any?]?, completion: @escaping ([Any?]?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in let result = response as? [Any?] @@ -765,7 +765,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed map, to test serialization and deserialization. - func echoNullableMap(aMap aMapArg: [String?: Any?], completion: @escaping ([String?: Any?]) -> Void) { + func echo(nullableMap aMapArg: [String?: Any?], completion: @escaping ([String?: Any?]) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aMapArg] as [Any?]) { response in let result = response as! [String?: Any?] diff --git a/packages/pigeon/platform_tests/test_plugin/ios/Classes/TestPlugin.swift b/packages/pigeon/platform_tests/test_plugin/ios/Classes/TestPlugin.swift index 7170f5f18a9..beb3f74ecca 100644 --- a/packages/pigeon/platform_tests/test_plugin/ios/Classes/TestPlugin.swift +++ b/packages/pigeon/platform_tests/test_plugin/ios/Classes/TestPlugin.swift @@ -26,11 +26,11 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { func noop() { } - func echoAllTypes(everything: AllTypes) -> AllTypes { + func echo(allTypes everything: AllTypes) -> AllTypes { return everything } - func echoAllNullableTypes(everything: AllNullableTypes?) -> AllNullableTypes? { + func echo(allNullableTypes everything: AllNullableTypes?) -> AllNullableTypes? { return everything } @@ -39,64 +39,64 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { // https://github.com/flutter/flutter/issues/112483 } - func echoInt(anInt: Int32) -> Int32 { + func echo(int anInt: Int32) -> Int32 { return anInt } - func echoDouble(aDouble: Double) -> Double { + func echo(double aDouble: Double) -> Double { return aDouble } - func echoBool(aBool: Bool) -> Bool { + func echo(bool aBool: Bool) -> Bool { return aBool } - func echoString(aString: String) -> String { + func echo(string aString: String) -> String { return aString } - func echoUint8List(aUint8List: FlutterStandardTypedData) -> FlutterStandardTypedData { + func echo(uint8List aUint8List: FlutterStandardTypedData) -> FlutterStandardTypedData { return aUint8List } - func echoObject(anObject: Any) -> Any { + func echo(object anObject: Any) -> Any { return anObject } - func extractNestedNullableString(wrapper: AllNullableTypesWrapper) -> String? { + func extractNestedNullableString(from wrapper: AllNullableTypesWrapper) -> String? { return wrapper.values.aNullableString; } - func createNestedNullableString(nullableString: String?) -> AllNullableTypesWrapper { + func createNestedObject(with nullableString: String?) -> AllNullableTypesWrapper { return AllNullableTypesWrapper(values: AllNullableTypes(aNullableString: nullableString)) } - func sendMultipleNullableTypes(aNullableBool: Bool?, aNullableInt: Int32?, aNullableString: String?) -> AllNullableTypes { + func sendMultipleNullableTypes(aBool aNullableBool: Bool?, anInt aNullableInt: Int32?, aString aNullableString: String?) -> AllNullableTypes { let someThings = AllNullableTypes(aNullableBool: aNullableBool, aNullableInt: aNullableInt, aNullableString: aNullableString) return someThings } - func echoNullableInt(aNullableInt: Int32?) -> Int32? { + func echo(nullableInt aNullableInt: Int32?) -> Int32? { return aNullableInt } - func echoNullableDouble(aNullableDouble: Double?) -> Double? { + func echo(nullableDouble aNullableDouble: Double?) -> Double? { return aNullableDouble } - func echoNullableBool(aNullableBool: Bool?) -> Bool? { + func echo(nullableBool aNullableBool: Bool?) -> Bool? { return aNullableBool } - func echoNullableString(aNullableString: String?) -> String? { + func echo(nullableString aNullableString: String?) -> String? { return aNullableString } - func echoNullableUint8List(aNullableUint8List: FlutterStandardTypedData?) -> FlutterStandardTypedData? { + func echo(nullableUint8List aNullableUint8List: FlutterStandardTypedData?) -> FlutterStandardTypedData? { return aNullableUint8List } - func echoNullableObject(aNullableObject: Any?) -> Any? { + func echo(nullableObject aNullableObject: Any?) -> Any? { return aNullableObject } @@ -104,7 +104,7 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { completion() } - func echoAsyncString(aString: String, completion: @escaping (String) -> Void) { + func echoAsync(string aString: String, completion: @escaping (String) -> Void) { completion(aString) } @@ -114,8 +114,8 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { } } - func callFlutterEchoString(aString: String, completion: @escaping (String) -> Void) { - flutterAPI.echoString(aString: aString) { flutterString in + func callFlutterEcho(string aString: String, completion: @escaping (String) -> Void) { + flutterAPI.echo(string: aString) { flutterString in completion(flutterString) } } diff --git a/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift b/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift index 8745ddb3943..eeb438d7107 100644 --- a/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift +++ b/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift @@ -238,50 +238,50 @@ protocol HostIntegrationCoreApi { /// test basic calling. func noop() /// Returns the passed object, to test serialization and deserialization. - func echoAllTypes(everything: AllTypes) -> AllTypes + func echo(allTypes everything: AllTypes) -> AllTypes /// Returns the passed object, to test serialization and deserialization. - func echoAllNullableTypes(everything: AllNullableTypes?) -> AllNullableTypes? + func echo(allNullableTypes everything: AllNullableTypes?) -> AllNullableTypes? /// Returns an error, to test error handling. func throwError() /// Returns passed in int. - func echoInt(anInt: Int32) -> Int32 + func echo(int anInt: Int32) -> Int32 /// Returns passed in double. - func echoDouble(aDouble: Double) -> Double + func echo(double aDouble: Double) -> Double /// Returns the passed in boolean. - func echoBool(aBool: Bool) -> Bool + func echo(bool aBool: Bool) -> Bool /// Returns the passed in string. - func echoString(aString: String) -> String + func echo(string aString: String) -> String /// Returns the passed in Uint8List. - func echoUint8List(aUint8List: FlutterStandardTypedData) -> FlutterStandardTypedData + func echo(uint8List aUint8List: FlutterStandardTypedData) -> FlutterStandardTypedData /// Returns the passed in generic Object. - func echoObject(anObject: Any) -> Any + func echo(object anObject: Any) -> Any /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. - func extractNestedNullableString(wrapper: AllNullableTypesWrapper) -> String? + func extractNestedNullableString(from wrapper: AllNullableTypesWrapper) -> String? /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. - func createNestedNullableString(nullableString: String?) -> AllNullableTypesWrapper + func createNestedObject(with nullableString: String?) -> AllNullableTypesWrapper /// Returns passed in arguments of multiple types. - func sendMultipleNullableTypes(aNullableBool: Bool?, aNullableInt: Int32?, aNullableString: String?) -> AllNullableTypes + func sendMultipleNullableTypes(aBool aNullableBool: Bool?, anInt aNullableInt: Int32?, aString aNullableString: String?) -> AllNullableTypes /// Returns passed in int. - func echoNullableInt(aNullableInt: Int32?) -> Int32? + func echo(nullableInt aNullableInt: Int32?) -> Int32? /// Returns passed in double. - func echoNullableDouble(aNullableDouble: Double?) -> Double? + func echo(nullableDouble aNullableDouble: Double?) -> Double? /// Returns the passed in boolean. - func echoNullableBool(aNullableBool: Bool?) -> Bool? + func echo(nullableBool aNullableBool: Bool?) -> Bool? /// Returns the passed in string. - func echoNullableString(aNullableString: String?) -> String? + func echo(nullableString aNullableString: String?) -> String? /// Returns the passed in Uint8List. - func echoNullableUint8List(aNullableUint8List: FlutterStandardTypedData?) -> FlutterStandardTypedData? + func echo(nullableUint8List aNullableUint8List: FlutterStandardTypedData?) -> FlutterStandardTypedData? /// Returns the passed in generic Object. - func echoNullableObject(aNullableObject: Any?) -> Any? + func echo(nullableObject aNullableObject: Any?) -> Any? /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. func noopAsync(completion: @escaping () -> Void) /// Returns the passed string asynchronously. - func echoAsyncString(aString: String, completion: @escaping (String) -> Void) + func echoAsync(string aString: String, completion: @escaping (String) -> Void) func callFlutterNoop(completion: @escaping () -> Void) - func callFlutterEchoString(aString: String, completion: @escaping (String) -> Void) + func callFlutterEcho(string aString: String, completion: @escaping (String) -> Void) } /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. @@ -307,7 +307,7 @@ class HostIntegrationCoreApiSetup { echoAllTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let everythingArg = args[0] as! AllTypes - let result = api.echoAllTypes(everything: everythingArg) + let result = api.echo(allTypes: everythingArg) reply(wrapResult(result)) } } else { @@ -319,7 +319,7 @@ class HostIntegrationCoreApiSetup { echoAllNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let everythingArg = args[0] as? AllNullableTypes - let result = api.echoAllNullableTypes(everything: everythingArg) + let result = api.echo(allNullableTypes: everythingArg) reply(wrapResult(result)) } } else { @@ -341,7 +341,7 @@ class HostIntegrationCoreApiSetup { echoIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anIntArg = args[0] as! Int32 - let result = api.echoInt(anInt: anIntArg) + let result = api.echo(int: anIntArg) reply(wrapResult(result)) } } else { @@ -353,7 +353,7 @@ class HostIntegrationCoreApiSetup { echoDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aDoubleArg = args[0] as! Double - let result = api.echoDouble(aDouble: aDoubleArg) + let result = api.echo(double: aDoubleArg) reply(wrapResult(result)) } } else { @@ -365,7 +365,7 @@ class HostIntegrationCoreApiSetup { echoBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aBoolArg = args[0] as! Bool - let result = api.echoBool(aBool: aBoolArg) + let result = api.echo(bool: aBoolArg) reply(wrapResult(result)) } } else { @@ -377,7 +377,7 @@ class HostIntegrationCoreApiSetup { echoStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg = args[0] as! String - let result = api.echoString(aString: aStringArg) + let result = api.echo(string: aStringArg) reply(wrapResult(result)) } } else { @@ -389,7 +389,7 @@ class HostIntegrationCoreApiSetup { echoUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aUint8ListArg = args[0] as! FlutterStandardTypedData - let result = api.echoUint8List(aUint8List: aUint8ListArg) + let result = api.echo(uint8List: aUint8ListArg) reply(wrapResult(result)) } } else { @@ -401,7 +401,7 @@ class HostIntegrationCoreApiSetup { echoObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anObjectArg = args[0]! - let result = api.echoObject(anObject: anObjectArg) + let result = api.echo(object: anObjectArg) reply(wrapResult(result)) } } else { @@ -414,7 +414,7 @@ class HostIntegrationCoreApiSetup { extractNestedNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let wrapperArg = args[0] as! AllNullableTypesWrapper - let result = api.extractNestedNullableString(wrapper: wrapperArg) + let result = api.extractNestedNullableString(from: wrapperArg) reply(wrapResult(result)) } } else { @@ -427,7 +427,7 @@ class HostIntegrationCoreApiSetup { createNestedNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let nullableStringArg = args[0] as? String - let result = api.createNestedNullableString(nullableString: nullableStringArg) + let result = api.createNestedObject(with: nullableStringArg) reply(wrapResult(result)) } } else { @@ -441,7 +441,7 @@ class HostIntegrationCoreApiSetup { let aNullableBoolArg = args[0] as? Bool let aNullableIntArg = args[1] as? Int32 let aNullableStringArg = args[2] as? String - let result = api.sendMultipleNullableTypes(aNullableBool: aNullableBoolArg, aNullableInt: aNullableIntArg, aNullableString: aNullableStringArg) + let result = api.sendMultipleNullableTypes(aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg) reply(wrapResult(result)) } } else { @@ -453,7 +453,7 @@ class HostIntegrationCoreApiSetup { echoNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableIntArg = args[0] as? Int32 - let result = api.echoNullableInt(aNullableInt: aNullableIntArg) + let result = api.echo(nullableInt: aNullableIntArg) reply(wrapResult(result)) } } else { @@ -465,7 +465,7 @@ class HostIntegrationCoreApiSetup { echoNullableDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableDoubleArg = args[0] as? Double - let result = api.echoNullableDouble(aNullableDouble: aNullableDoubleArg) + let result = api.echo(nullableDouble: aNullableDoubleArg) reply(wrapResult(result)) } } else { @@ -477,7 +477,7 @@ class HostIntegrationCoreApiSetup { echoNullableBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableBoolArg = args[0] as? Bool - let result = api.echoNullableBool(aNullableBool: aNullableBoolArg) + let result = api.echo(nullableBool: aNullableBoolArg) reply(wrapResult(result)) } } else { @@ -489,7 +489,7 @@ class HostIntegrationCoreApiSetup { echoNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableStringArg = args[0] as? String - let result = api.echoNullableString(aNullableString: aNullableStringArg) + let result = api.echo(nullableString: aNullableStringArg) reply(wrapResult(result)) } } else { @@ -501,7 +501,7 @@ class HostIntegrationCoreApiSetup { echoNullableUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableUint8ListArg = args[0] as? FlutterStandardTypedData - let result = api.echoNullableUint8List(aNullableUint8List: aNullableUint8ListArg) + let result = api.echo(nullableUint8List: aNullableUint8ListArg) reply(wrapResult(result)) } } else { @@ -513,7 +513,7 @@ class HostIntegrationCoreApiSetup { echoNullableObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableObjectArg = args[0] - let result = api.echoNullableObject(aNullableObject: aNullableObjectArg) + let result = api.echo(nullableObject: aNullableObjectArg) reply(wrapResult(result)) } } else { @@ -537,7 +537,7 @@ class HostIntegrationCoreApiSetup { echoAsyncStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg = args[0] as! String - api.echoAsyncString(aString: aStringArg) { result in + api.echoAsync(string: aStringArg) { result in reply(wrapResult(result)) } } @@ -559,7 +559,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg = args[0] as! String - api.callFlutterEchoString(aString: aStringArg) { result in + api.callFlutterEcho(string: aStringArg) { result in reply(wrapResult(result)) } } @@ -635,7 +635,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed object, to test serialization and deserialization. - func echoAllTypes(everything everythingArg: AllTypes, completion: @escaping (AllTypes) -> Void) { + func echo(allTypes everythingArg: AllTypes, completion: @escaping (AllTypes) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllTypes", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([everythingArg] as [Any?]) { response in let result = response as! AllTypes @@ -643,7 +643,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed object, to test serialization and deserialization. - func echoAllNullableTypes(everything everythingArg: AllNullableTypes, completion: @escaping (AllNullableTypes) -> Void) { + func echo(allNullableTypes everythingArg: AllNullableTypes, completion: @escaping (AllNullableTypes) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([everythingArg] as [Any?]) { response in let result = response as! AllNullableTypes @@ -653,7 +653,7 @@ class FlutterIntegrationCoreApi { /// Returns passed in arguments of multiple types. /// /// Tests multiple-arity FlutterApi handling. - func sendMultipleNullableTypes(aNullableBool aNullableBoolArg: Bool?, aNullableInt aNullableIntArg: Int32?, aNullableString aNullableStringArg: String?, completion: @escaping (AllNullableTypes) -> Void) { + func sendMultipleNullableTypes(aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int32?, aString aNullableStringArg: String?, completion: @escaping (AllNullableTypes) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.sendMultipleNullableTypes", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aNullableBoolArg, aNullableIntArg, aNullableStringArg] as [Any?]) { response in let result = response as! AllNullableTypes @@ -661,7 +661,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed boolean, to test serialization and deserialization. - func echoBool(aBool aBoolArg: Bool, completion: @escaping (Bool) -> Void) { + func echo(bool aBoolArg: Bool, completion: @escaping (Bool) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoBool", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aBoolArg] as [Any?]) { response in let result = response as! Bool @@ -669,7 +669,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed int, to test serialization and deserialization. - func echoInt(anInt anIntArg: Int32, completion: @escaping (Int32) -> Void) { + func echo(int anIntArg: Int32, completion: @escaping (Int32) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoInt", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anIntArg] as [Any?]) { response in let result = response as! Int32 @@ -677,7 +677,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed double, to test serialization and deserialization. - func echoDouble(aDouble aDoubleArg: Double, completion: @escaping (Double) -> Void) { + func echo(double aDoubleArg: Double, completion: @escaping (Double) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoDouble", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aDoubleArg] as [Any?]) { response in let result = response as! Double @@ -685,7 +685,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed string, to test serialization and deserialization. - func echoString(aString aStringArg: String, completion: @escaping (String) -> Void) { + func echo(string aStringArg: String, completion: @escaping (String) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoString", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in let result = response as! String @@ -693,7 +693,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed byte list, to test serialization and deserialization. - func echoUint8List(aList aListArg: FlutterStandardTypedData, completion: @escaping (FlutterStandardTypedData) -> Void) { + func echo(uint8List aListArg: FlutterStandardTypedData, completion: @escaping (FlutterStandardTypedData) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoUint8List", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in let result = response as! FlutterStandardTypedData @@ -701,7 +701,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed list, to test serialization and deserialization. - func echoList(aList aListArg: [Any?], completion: @escaping ([Any?]) -> Void) { + func echo(list aListArg: [Any?], completion: @escaping ([Any?]) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoList", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in let result = response as! [Any?] @@ -717,7 +717,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed boolean, to test serialization and deserialization. - func echoNullableBool(aBool aBoolArg: Bool?, completion: @escaping (Bool?) -> Void) { + func echo(nullableBool aBoolArg: Bool?, completion: @escaping (Bool?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableBool", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aBoolArg] as [Any?]) { response in let result = response as? Bool @@ -725,7 +725,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed int, to test serialization and deserialization. - func echoNullableInt(anInt anIntArg: Int32?, completion: @escaping (Int32?) -> Void) { + func echo(nullableInt anIntArg: Int32?, completion: @escaping (Int32?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableInt", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anIntArg] as [Any?]) { response in let result = response as? Int32 @@ -733,7 +733,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed double, to test serialization and deserialization. - func echoNullableDouble(aDouble aDoubleArg: Double?, completion: @escaping (Double?) -> Void) { + func echo(nullableDouble aDoubleArg: Double?, completion: @escaping (Double?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableDouble", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aDoubleArg] as [Any?]) { response in let result = response as? Double @@ -741,7 +741,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed string, to test serialization and deserialization. - func echoNullableString(aString aStringArg: String?, completion: @escaping (String?) -> Void) { + func echo(nullableString aStringArg: String?, completion: @escaping (String?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableString", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in let result = response as? String @@ -749,7 +749,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed byte list, to test serialization and deserialization. - func echoNullableUint8List(aList aListArg: FlutterStandardTypedData?, completion: @escaping (FlutterStandardTypedData?) -> Void) { + func echo(nullableUint8List aListArg: FlutterStandardTypedData?, completion: @escaping (FlutterStandardTypedData?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableUint8List", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in let result = response as? FlutterStandardTypedData @@ -757,7 +757,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed list, to test serialization and deserialization. - func echoNullableList(aList aListArg: [Any?]?, completion: @escaping ([Any?]?) -> Void) { + func echo(nullableList aListArg: [Any?]?, completion: @escaping ([Any?]?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in let result = response as? [Any?] @@ -765,7 +765,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed map, to test serialization and deserialization. - func echoNullableMap(aMap aMapArg: [String?: Any?], completion: @escaping ([String?: Any?]) -> Void) { + func echo(nullableMap aMapArg: [String?: Any?], completion: @escaping ([String?: Any?]) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aMapArg] as [Any?]) { response in let result = response as! [String?: Any?] diff --git a/packages/pigeon/test/pigeon_lib_test.dart b/packages/pigeon/test/pigeon_lib_test.dart index 2877638c875..fd71be54ad9 100644 --- a/packages/pigeon/test/pigeon_lib_test.dart +++ b/packages/pigeon/test/pigeon_lib_test.dart @@ -931,7 +931,7 @@ abstract class Api { expect(results.root.apis[0].methods[0].objcSelector, equals('foobar')); }); - test('custom swift invalid function signature', () { + test('custom swift valid function signature', () { const String code = ''' @HostApi() abstract class Api { From 399e4ae2882f7222fb1fa78c0e159d70c5920de0 Mon Sep 17 00:00:00 2001 From: Ailton Vieira Pinto Filho Date: Wed, 18 Jan 2023 08:21:28 -0300 Subject: [PATCH 13/26] Add type annotation --- packages/pigeon/lib/swift_generator.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pigeon/lib/swift_generator.dart b/packages/pigeon/lib/swift_generator.dart index 43aba2d8576..5cb4aa680f0 100644 --- a/packages/pigeon/lib/swift_generator.dart +++ b/packages/pigeon/lib/swift_generator.dart @@ -739,7 +739,7 @@ class _SwiftFunctionComponents { name: method.name, returnType: method.returnType, arguments: method.arguments - .map((e) => _SwiftFunctionArgument( + .map((NamedType e) => _SwiftFunctionArgument( name: e.name, type: e.type, namedType: e, From 608b5ef67f6c9b4d1abf91f1b3087336aea32c09 Mon Sep 17 00:00:00 2001 From: tarrinneal Date: Wed, 18 Jan 2023 10:19:36 -0800 Subject: [PATCH 14/26] format --- .../mock_handler_tester/test/message.dart | 53 +- .../pigeon/mock_handler_tester/test/test.dart | 39 +- .../CoreTests.java | 1714 +++++++----- .../ios/Classes/CoreTests.gen.h | 219 +- .../ios/Classes/CoreTests.gen.m | 968 +++---- .../lib/core_tests.gen.dart | 211 +- .../lib/multiple_arity.gen.dart | 13 +- .../lib/non_null_fields.gen.dart | 52 +- .../lib/null_fields.gen.dart | 38 +- .../lib/null_safe_pigeon.dart | 27 +- .../lib/nullable_returns.gen.dart | 27 +- .../lib/primitive.dart | 59 +- .../lib/src/generated/core_tests.gen.dart | 211 +- .../windows/pigeon/core_tests.gen.cpp | 2424 ++++++++++------- .../windows/pigeon/core_tests.gen.h | 218 +- 15 files changed, 3731 insertions(+), 2542 deletions(-) diff --git a/packages/pigeon/mock_handler_tester/test/message.dart b/packages/pigeon/mock_handler_tester/test/message.dart index 8dea3d31967..cad4e02e903 100644 --- a/packages/pigeon/mock_handler_tester/test/message.dart +++ b/packages/pigeon/mock_handler_tester/test/message.dart @@ -1,7 +1,7 @@ // 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 (v6.0.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 @@ -125,6 +125,7 @@ class MessageNested { ); } } + class _MessageApiCodec extends StandardMessageCodec { const _MessageApiCodec(); @override @@ -143,16 +144,14 @@ class _MessageApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return MessageSearchReply.decode(readValue(buffer)!); - - case 129: + + case 129: return MessageSearchRequest.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -177,8 +176,7 @@ class MessageApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.MessageApi.initialize', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -223,6 +221,7 @@ class MessageApi { } } } + class _MessageNestedApiCodec extends StandardMessageCodec { const _MessageNestedApiCodec(); @override @@ -244,19 +243,17 @@ class _MessageNestedApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return MessageNested.decode(readValue(buffer)!); - - case 129: + + case 129: return MessageSearchReply.decode(readValue(buffer)!); - - case 130: + + case 130: return MessageSearchRequest.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -302,6 +299,7 @@ class MessageNestedApi { } } } + class _MessageFlutterSearchApiCodec extends StandardMessageCodec { const _MessageFlutterSearchApiCodec(); @override @@ -320,16 +318,14 @@ class _MessageFlutterSearchApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return MessageSearchReply.decode(readValue(buffer)!); - - case 129: + + case 129: return MessageSearchRequest.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -341,7 +337,8 @@ abstract class MessageFlutterSearchApi { /// This comment is to test method documentation comments. MessageSearchReply search(MessageSearchRequest request); - static void setup(MessageFlutterSearchApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(MessageFlutterSearchApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.MessageFlutterSearchApi.search', codec, @@ -351,10 +348,12 @@ abstract class MessageFlutterSearchApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.MessageFlutterSearchApi.search was null.'); + 'Argument for dev.flutter.pigeon.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.MessageFlutterSearchApi.search was null, expected non-null MessageSearchRequest.'); + final MessageSearchRequest? arg_request = + (args[0] as MessageSearchRequest?); + assert(arg_request != null, + 'Argument for dev.flutter.pigeon.MessageFlutterSearchApi.search was null, expected non-null MessageSearchRequest.'); final MessageSearchReply output = api.search(arg_request!); return output; }); diff --git a/packages/pigeon/mock_handler_tester/test/test.dart b/packages/pigeon/mock_handler_tester/test/test.dart index 5da9e1db737..dd1df05774f 100644 --- a/packages/pigeon/mock_handler_tester/test/test.dart +++ b/packages/pigeon/mock_handler_tester/test/test.dart @@ -1,7 +1,7 @@ // 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 (v6.0.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, unnecessary_import @@ -32,16 +32,14 @@ class _TestHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return MessageSearchReply.decode(readValue(buffer)!); - - case 129: + + case 129: return MessageSearchRequest.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -84,10 +82,12 @@ abstract class TestHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.MessageApi.search was null.'); + 'Argument for dev.flutter.pigeon.MessageApi.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.MessageApi.search was null, expected non-null MessageSearchRequest.'); + final MessageSearchRequest? arg_request = + (args[0] as MessageSearchRequest?); + assert(arg_request != null, + 'Argument for dev.flutter.pigeon.MessageApi.search was null, expected non-null MessageSearchRequest.'); final MessageSearchReply output = api.search(arg_request!); return [output]; }); @@ -117,19 +117,17 @@ class _TestNestedApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return MessageNested.decode(readValue(buffer)!); - - case 129: + + case 129: return MessageSearchReply.decode(readValue(buffer)!); - - case 130: + + case 130: return MessageSearchRequest.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -153,10 +151,11 @@ abstract class TestNestedApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.MessageNestedApi.search was null.'); + 'Argument for dev.flutter.pigeon.MessageNestedApi.search was null.'); final List args = (message as List?)!; final MessageNested? arg_nested = (args[0] as MessageNested?); - assert(arg_nested != null, 'Argument for dev.flutter.pigeon.MessageNestedApi.search was null, expected non-null MessageNested.'); + assert(arg_nested != null, + 'Argument for dev.flutter.pigeon.MessageNestedApi.search was null, expected non-null MessageNested.'); final MessageSearchReply output = api.search(arg_nested!); return [output]; }); diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java index 29f84f92ac5..a0b058a13d9 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java @@ -1,11 +1,12 @@ // 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 (v6.0.4), do not edit directly. // See also: https://pub.dev/packages/pigeon package com.example.alternate_language_test_plugin; + import android.util.Log; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -15,21 +16,22 @@ import io.flutter.plugin.common.StandardMessageCodec; import java.io.ByteArrayOutputStream; import java.nio.ByteBuffer; -import java.util.Arrays; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Map; -import java.util.HashMap; /** Generated class from Pigeon. */ @SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression"}) public class CoreTests { - @NonNull private static ArrayList wrapError(@NonNull Throwable exception) { + @NonNull + private static ArrayList wrapError(@NonNull Throwable exception) { ArrayList errorList = new ArrayList<>(3); errorList.add(exception.toString()); errorList.add(exception.getClass().getSimpleName()); - errorList.add("Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); + errorList.add( + "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); return errorList; } @@ -39,6 +41,7 @@ public enum AnEnum { THREE(2); private final int index; + private AnEnum(final int index) { this.index = index; } @@ -47,7 +50,11 @@ private AnEnum(final int index) { /** Generated class from Pigeon that represents data sent in messages. */ public static class AllTypes { private @NonNull Boolean aBool; - public @NonNull Boolean getABool() { return aBool; } + + public @NonNull Boolean getABool() { + return aBool; + } + public void setABool(@NonNull Boolean setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"aBool\" is null."); @@ -56,7 +63,11 @@ public void setABool(@NonNull Boolean setterArg) { } private @NonNull Long anInt; - public @NonNull Long getAnInt() { return anInt; } + + public @NonNull Long getAnInt() { + return anInt; + } + public void setAnInt(@NonNull Long setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"anInt\" is null."); @@ -65,7 +76,11 @@ public void setAnInt(@NonNull Long setterArg) { } private @NonNull Double aDouble; - public @NonNull Double getADouble() { return aDouble; } + + public @NonNull Double getADouble() { + return aDouble; + } + public void setADouble(@NonNull Double setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"aDouble\" is null."); @@ -74,7 +89,11 @@ public void setADouble(@NonNull Double setterArg) { } private @NonNull byte[] aByteArray; - public @NonNull byte[] getAByteArray() { return aByteArray; } + + public @NonNull byte[] getAByteArray() { + return aByteArray; + } + public void setAByteArray(@NonNull byte[] setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"aByteArray\" is null."); @@ -83,7 +102,11 @@ public void setAByteArray(@NonNull byte[] setterArg) { } private @NonNull int[] a4ByteArray; - public @NonNull int[] getA4ByteArray() { return a4ByteArray; } + + public @NonNull int[] getA4ByteArray() { + return a4ByteArray; + } + public void setA4ByteArray(@NonNull int[] setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"a4ByteArray\" is null."); @@ -92,7 +115,11 @@ public void setA4ByteArray(@NonNull int[] setterArg) { } private @NonNull long[] a8ByteArray; - public @NonNull long[] getA8ByteArray() { return a8ByteArray; } + + public @NonNull long[] getA8ByteArray() { + return a8ByteArray; + } + public void setA8ByteArray(@NonNull long[] setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"a8ByteArray\" is null."); @@ -101,7 +128,11 @@ public void setA8ByteArray(@NonNull long[] setterArg) { } private @NonNull double[] aFloatArray; - public @NonNull double[] getAFloatArray() { return aFloatArray; } + + public @NonNull double[] getAFloatArray() { + return aFloatArray; + } + public void setAFloatArray(@NonNull double[] setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"aFloatArray\" is null."); @@ -110,7 +141,11 @@ public void setAFloatArray(@NonNull double[] setterArg) { } private @NonNull List aList; - public @NonNull List getAList() { return aList; } + + public @NonNull List getAList() { + return aList; + } + public void setAList(@NonNull List setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"aList\" is null."); @@ -119,7 +154,11 @@ public void setAList(@NonNull List setterArg) { } private @NonNull Map aMap; - public @NonNull Map getAMap() { return aMap; } + + public @NonNull Map getAMap() { + return aMap; + } + public void setAMap(@NonNull Map setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"aMap\" is null."); @@ -128,7 +167,11 @@ public void setAMap(@NonNull Map setterArg) { } private @NonNull AnEnum anEnum; - public @NonNull AnEnum getAnEnum() { return anEnum; } + + public @NonNull AnEnum getAnEnum() { + return anEnum; + } + public void setAnEnum(@NonNull AnEnum setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"anEnum\" is null."); @@ -137,7 +180,11 @@ public void setAnEnum(@NonNull AnEnum setterArg) { } private @NonNull String aString; - public @NonNull String getAString() { return aString; } + + public @NonNull String getAString() { + return aString; + } + public void setAString(@NonNull String setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"aString\" is null."); @@ -145,64 +192,87 @@ public void setAString(@NonNull String setterArg) { this.aString = setterArg; } - /**Constructor is private to enforce null safety; use Builder. */ + /** Constructor is private to enforce null safety; use Builder. */ private AllTypes() {} + public static final class Builder { private @Nullable Boolean aBool; + public @NonNull Builder setABool(@NonNull Boolean setterArg) { this.aBool = setterArg; return this; } + private @Nullable Long anInt; + public @NonNull Builder setAnInt(@NonNull Long setterArg) { this.anInt = setterArg; return this; } + private @Nullable Double aDouble; + public @NonNull Builder setADouble(@NonNull Double setterArg) { this.aDouble = setterArg; return this; } + private @Nullable byte[] aByteArray; + public @NonNull Builder setAByteArray(@NonNull byte[] setterArg) { this.aByteArray = setterArg; return this; } + private @Nullable int[] a4ByteArray; + public @NonNull Builder setA4ByteArray(@NonNull int[] setterArg) { this.a4ByteArray = setterArg; return this; } + private @Nullable long[] a8ByteArray; + public @NonNull Builder setA8ByteArray(@NonNull long[] setterArg) { this.a8ByteArray = setterArg; return this; } + private @Nullable double[] aFloatArray; + public @NonNull Builder setAFloatArray(@NonNull double[] setterArg) { this.aFloatArray = setterArg; return this; } + private @Nullable List aList; + public @NonNull Builder setAList(@NonNull List setterArg) { this.aList = setterArg; return this; } + private @Nullable Map aMap; + public @NonNull Builder setAMap(@NonNull Map setterArg) { this.aMap = setterArg; return this; } + private @Nullable AnEnum anEnum; + public @NonNull Builder setAnEnum(@NonNull AnEnum setterArg) { this.anEnum = setterArg; return this; } + private @Nullable String aString; + public @NonNull Builder setAString(@NonNull String setterArg) { this.aString = setterArg; return this; } + public @NonNull AllTypes build() { AllTypes pigeonReturn = new AllTypes(); pigeonReturn.setABool(aBool); @@ -219,7 +289,9 @@ public static final class Builder { return pigeonReturn; } } - @NonNull ArrayList toList() { + + @NonNull + ArrayList toList() { ArrayList toListResult = new ArrayList(11); toListResult.add(aBool); toListResult.add(anInt); @@ -234,30 +306,32 @@ public static final class Builder { toListResult.add(aString); return toListResult; } + static @NonNull AllTypes fromList(@NonNull ArrayList list) { AllTypes pigeonResult = new AllTypes(); Object aBool = list.get(0); - pigeonResult.setABool((Boolean)aBool); + pigeonResult.setABool((Boolean) aBool); Object anInt = list.get(1); - pigeonResult.setAnInt((anInt == null) ? null : ((anInt instanceof Integer) ? (Integer)anInt : (Long)anInt)); + pigeonResult.setAnInt( + (anInt == null) ? null : ((anInt instanceof Integer) ? (Integer) anInt : (Long) anInt)); Object aDouble = list.get(2); - pigeonResult.setADouble((Double)aDouble); + pigeonResult.setADouble((Double) aDouble); Object aByteArray = list.get(3); - pigeonResult.setAByteArray((byte[])aByteArray); + pigeonResult.setAByteArray((byte[]) aByteArray); Object a4ByteArray = list.get(4); - pigeonResult.setA4ByteArray((int[])a4ByteArray); + pigeonResult.setA4ByteArray((int[]) a4ByteArray); Object a8ByteArray = list.get(5); - pigeonResult.setA8ByteArray((long[])a8ByteArray); + pigeonResult.setA8ByteArray((long[]) a8ByteArray); Object aFloatArray = list.get(6); - pigeonResult.setAFloatArray((double[])aFloatArray); + pigeonResult.setAFloatArray((double[]) aFloatArray); Object aList = list.get(7); - pigeonResult.setAList((List)aList); + pigeonResult.setAList((List) aList); Object aMap = list.get(8); - pigeonResult.setAMap((Map)aMap); + pigeonResult.setAMap((Map) aMap); Object anEnum = list.get(9); - pigeonResult.setAnEnum(anEnum == null ? null : AnEnum.values()[(int)anEnum]); + pigeonResult.setAnEnum(anEnum == null ? null : AnEnum.values()[(int) anEnum]); Object aString = list.get(10); - pigeonResult.setAString((String)aString); + pigeonResult.setAString((String) aString); return pigeonResult; } } @@ -265,160 +339,245 @@ public static final class Builder { /** Generated class from Pigeon that represents data sent in messages. */ public static class AllNullableTypes { private @Nullable Boolean aNullableBool; - public @Nullable Boolean getANullableBool() { return aNullableBool; } + + public @Nullable Boolean getANullableBool() { + return aNullableBool; + } + public void setANullableBool(@Nullable Boolean setterArg) { this.aNullableBool = setterArg; } private @Nullable Long aNullableInt; - public @Nullable Long getANullableInt() { return aNullableInt; } + + public @Nullable Long getANullableInt() { + return aNullableInt; + } + public void setANullableInt(@Nullable Long setterArg) { this.aNullableInt = setterArg; } private @Nullable Double aNullableDouble; - public @Nullable Double getANullableDouble() { return aNullableDouble; } + + public @Nullable Double getANullableDouble() { + return aNullableDouble; + } + public void setANullableDouble(@Nullable Double setterArg) { this.aNullableDouble = setterArg; } private @Nullable byte[] aNullableByteArray; - public @Nullable byte[] getANullableByteArray() { return aNullableByteArray; } + + public @Nullable byte[] getANullableByteArray() { + return aNullableByteArray; + } + public void setANullableByteArray(@Nullable byte[] setterArg) { this.aNullableByteArray = setterArg; } private @Nullable int[] aNullable4ByteArray; - public @Nullable int[] getANullable4ByteArray() { return aNullable4ByteArray; } + + public @Nullable int[] getANullable4ByteArray() { + return aNullable4ByteArray; + } + public void setANullable4ByteArray(@Nullable int[] setterArg) { this.aNullable4ByteArray = setterArg; } private @Nullable long[] aNullable8ByteArray; - public @Nullable long[] getANullable8ByteArray() { return aNullable8ByteArray; } + + public @Nullable long[] getANullable8ByteArray() { + return aNullable8ByteArray; + } + public void setANullable8ByteArray(@Nullable long[] setterArg) { this.aNullable8ByteArray = setterArg; } private @Nullable double[] aNullableFloatArray; - public @Nullable double[] getANullableFloatArray() { return aNullableFloatArray; } + + public @Nullable double[] getANullableFloatArray() { + return aNullableFloatArray; + } + public void setANullableFloatArray(@Nullable double[] setterArg) { this.aNullableFloatArray = setterArg; } private @Nullable List aNullableList; - public @Nullable List getANullableList() { return aNullableList; } + + public @Nullable List getANullableList() { + return aNullableList; + } + public void setANullableList(@Nullable List setterArg) { this.aNullableList = setterArg; } private @Nullable Map aNullableMap; - public @Nullable Map getANullableMap() { return aNullableMap; } + + public @Nullable Map getANullableMap() { + return aNullableMap; + } + public void setANullableMap(@Nullable Map setterArg) { this.aNullableMap = setterArg; } private @Nullable List> nullableNestedList; - public @Nullable List> getNullableNestedList() { return nullableNestedList; } + + public @Nullable List> getNullableNestedList() { + return nullableNestedList; + } + public void setNullableNestedList(@Nullable List> setterArg) { this.nullableNestedList = setterArg; } private @Nullable Map nullableMapWithAnnotations; - public @Nullable Map getNullableMapWithAnnotations() { return nullableMapWithAnnotations; } + + public @Nullable Map getNullableMapWithAnnotations() { + return nullableMapWithAnnotations; + } + public void setNullableMapWithAnnotations(@Nullable Map setterArg) { this.nullableMapWithAnnotations = setterArg; } private @Nullable Map nullableMapWithObject; - public @Nullable Map getNullableMapWithObject() { return nullableMapWithObject; } + + public @Nullable Map getNullableMapWithObject() { + return nullableMapWithObject; + } + public void setNullableMapWithObject(@Nullable Map setterArg) { this.nullableMapWithObject = setterArg; } private @Nullable AnEnum aNullableEnum; - public @Nullable AnEnum getANullableEnum() { return aNullableEnum; } + + public @Nullable AnEnum getANullableEnum() { + return aNullableEnum; + } + public void setANullableEnum(@Nullable AnEnum setterArg) { this.aNullableEnum = setterArg; } private @Nullable String aNullableString; - public @Nullable String getANullableString() { return aNullableString; } + + public @Nullable String getANullableString() { + return aNullableString; + } + public void setANullableString(@Nullable String setterArg) { this.aNullableString = setterArg; } public static final class Builder { private @Nullable Boolean aNullableBool; + public @NonNull Builder setANullableBool(@Nullable Boolean setterArg) { this.aNullableBool = setterArg; return this; } + private @Nullable Long aNullableInt; + public @NonNull Builder setANullableInt(@Nullable Long setterArg) { this.aNullableInt = setterArg; return this; } + private @Nullable Double aNullableDouble; + public @NonNull Builder setANullableDouble(@Nullable Double setterArg) { this.aNullableDouble = setterArg; return this; } + private @Nullable byte[] aNullableByteArray; + public @NonNull Builder setANullableByteArray(@Nullable byte[] setterArg) { this.aNullableByteArray = setterArg; return this; } + private @Nullable int[] aNullable4ByteArray; + public @NonNull Builder setANullable4ByteArray(@Nullable int[] setterArg) { this.aNullable4ByteArray = setterArg; return this; } + private @Nullable long[] aNullable8ByteArray; + public @NonNull Builder setANullable8ByteArray(@Nullable long[] setterArg) { this.aNullable8ByteArray = setterArg; return this; } + private @Nullable double[] aNullableFloatArray; + public @NonNull Builder setANullableFloatArray(@Nullable double[] setterArg) { this.aNullableFloatArray = setterArg; return this; } + private @Nullable List aNullableList; + public @NonNull Builder setANullableList(@Nullable List setterArg) { this.aNullableList = setterArg; return this; } + private @Nullable Map aNullableMap; + public @NonNull Builder setANullableMap(@Nullable Map setterArg) { this.aNullableMap = setterArg; return this; } + private @Nullable List> nullableNestedList; + public @NonNull Builder setNullableNestedList(@Nullable List> setterArg) { this.nullableNestedList = setterArg; return this; } + private @Nullable Map nullableMapWithAnnotations; - public @NonNull Builder setNullableMapWithAnnotations(@Nullable Map setterArg) { + + public @NonNull Builder setNullableMapWithAnnotations( + @Nullable Map setterArg) { this.nullableMapWithAnnotations = setterArg; return this; } + private @Nullable Map nullableMapWithObject; + public @NonNull Builder setNullableMapWithObject(@Nullable Map setterArg) { this.nullableMapWithObject = setterArg; return this; } + private @Nullable AnEnum aNullableEnum; + public @NonNull Builder setANullableEnum(@Nullable AnEnum setterArg) { this.aNullableEnum = setterArg; return this; } + private @Nullable String aNullableString; + public @NonNull Builder setANullableString(@Nullable String setterArg) { this.aNullableString = setterArg; return this; } + public @NonNull AllNullableTypes build() { AllNullableTypes pigeonReturn = new AllNullableTypes(); pigeonReturn.setANullableBool(aNullableBool); @@ -438,7 +597,9 @@ public static final class Builder { return pigeonReturn; } } - @NonNull ArrayList toList() { + + @NonNull + ArrayList toList() { ArrayList toListResult = new ArrayList(14); toListResult.add(aNullableBool); toListResult.add(aNullableInt); @@ -456,36 +617,41 @@ public static final class Builder { toListResult.add(aNullableString); return toListResult; } + static @NonNull AllNullableTypes fromList(@NonNull ArrayList list) { AllNullableTypes pigeonResult = new AllNullableTypes(); Object aNullableBool = list.get(0); - pigeonResult.setANullableBool((Boolean)aNullableBool); + pigeonResult.setANullableBool((Boolean) aNullableBool); Object aNullableInt = list.get(1); - pigeonResult.setANullableInt((aNullableInt == null) ? null : ((aNullableInt instanceof Integer) ? (Integer)aNullableInt : (Long)aNullableInt)); + pigeonResult.setANullableInt( + (aNullableInt == null) + ? null + : ((aNullableInt instanceof Integer) ? (Integer) aNullableInt : (Long) aNullableInt)); Object aNullableDouble = list.get(2); - pigeonResult.setANullableDouble((Double)aNullableDouble); + pigeonResult.setANullableDouble((Double) aNullableDouble); Object aNullableByteArray = list.get(3); - pigeonResult.setANullableByteArray((byte[])aNullableByteArray); + pigeonResult.setANullableByteArray((byte[]) aNullableByteArray); Object aNullable4ByteArray = list.get(4); - pigeonResult.setANullable4ByteArray((int[])aNullable4ByteArray); + pigeonResult.setANullable4ByteArray((int[]) aNullable4ByteArray); Object aNullable8ByteArray = list.get(5); - pigeonResult.setANullable8ByteArray((long[])aNullable8ByteArray); + pigeonResult.setANullable8ByteArray((long[]) aNullable8ByteArray); Object aNullableFloatArray = list.get(6); - pigeonResult.setANullableFloatArray((double[])aNullableFloatArray); + pigeonResult.setANullableFloatArray((double[]) aNullableFloatArray); Object aNullableList = list.get(7); - pigeonResult.setANullableList((List)aNullableList); + pigeonResult.setANullableList((List) aNullableList); Object aNullableMap = list.get(8); - pigeonResult.setANullableMap((Map)aNullableMap); + pigeonResult.setANullableMap((Map) aNullableMap); Object nullableNestedList = list.get(9); - pigeonResult.setNullableNestedList((List>)nullableNestedList); + pigeonResult.setNullableNestedList((List>) nullableNestedList); Object nullableMapWithAnnotations = list.get(10); - pigeonResult.setNullableMapWithAnnotations((Map)nullableMapWithAnnotations); + pigeonResult.setNullableMapWithAnnotations((Map) nullableMapWithAnnotations); Object nullableMapWithObject = list.get(11); - pigeonResult.setNullableMapWithObject((Map)nullableMapWithObject); + pigeonResult.setNullableMapWithObject((Map) nullableMapWithObject); Object aNullableEnum = list.get(12); - pigeonResult.setANullableEnum(aNullableEnum == null ? null : AnEnum.values()[(int)aNullableEnum]); + pigeonResult.setANullableEnum( + aNullableEnum == null ? null : AnEnum.values()[(int) aNullableEnum]); Object aNullableString = list.get(13); - pigeonResult.setANullableString((String)aNullableString); + pigeonResult.setANullableString((String) aNullableString); return pigeonResult; } } @@ -493,7 +659,11 @@ public static final class Builder { /** Generated class from Pigeon that represents data sent in messages. */ public static class AllNullableTypesWrapper { private @NonNull AllNullableTypes values; - public @NonNull AllNullableTypes getValues() { return values; } + + public @NonNull AllNullableTypes getValues() { + return values; + } + public void setValues(@NonNull AllNullableTypes setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"values\" is null."); @@ -501,1006 +671,1204 @@ public void setValues(@NonNull AllNullableTypes setterArg) { this.values = setterArg; } - /**Constructor is private to enforce null safety; use Builder. */ + /** Constructor is private to enforce null safety; use Builder. */ private AllNullableTypesWrapper() {} + public static final class Builder { private @Nullable AllNullableTypes values; + public @NonNull Builder setValues(@NonNull AllNullableTypes setterArg) { this.values = setterArg; return this; } + public @NonNull AllNullableTypesWrapper build() { AllNullableTypesWrapper pigeonReturn = new AllNullableTypesWrapper(); pigeonReturn.setValues(values); return pigeonReturn; } } - @NonNull ArrayList toList() { + + @NonNull + ArrayList toList() { ArrayList toListResult = new ArrayList(1); toListResult.add((values == null) ? null : values.toList()); return toListResult; } + static @NonNull AllNullableTypesWrapper fromList(@NonNull ArrayList list) { AllNullableTypesWrapper pigeonResult = new AllNullableTypesWrapper(); Object values = list.get(0); - pigeonResult.setValues((values == null) ? null : AllNullableTypes.fromList((ArrayList)values)); + pigeonResult.setValues( + (values == null) ? null : AllNullableTypes.fromList((ArrayList) values)); return pigeonResult; } } public interface Result { void success(T result); + void error(Throwable error); } + private static class HostIntegrationCoreApiCodec extends StandardMessageCodec { public static final HostIntegrationCoreApiCodec INSTANCE = new HostIntegrationCoreApiCodec(); + private HostIntegrationCoreApiCodec() {} + @Override protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { switch (type) { - case (byte)128: + case (byte) 128: return AllNullableTypes.fromList((ArrayList) readValue(buffer)); - - case (byte)129: + + case (byte) 129: return AllNullableTypesWrapper.fromList((ArrayList) readValue(buffer)); - - case (byte)130: + + case (byte) 130: return AllTypes.fromList((ArrayList) readValue(buffer)); - - default: + + default: return super.readValueOfType(type, buffer); - } } + @Override - protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { + protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { if (value instanceof AllNullableTypes) { stream.write(128); writeValue(stream, ((AllNullableTypes) value).toList()); - } else - if (value instanceof AllNullableTypesWrapper) { + } else if (value instanceof AllNullableTypesWrapper) { stream.write(129); writeValue(stream, ((AllNullableTypesWrapper) value).toList()); - } else - if (value instanceof AllTypes) { + } else if (value instanceof AllTypes) { stream.write(130); writeValue(stream, ((AllTypes) value).toList()); - } else -{ + } else { super.writeValue(stream, value); } } } /** - * The core interface that each host language plugin must implement in - * platform_test integration tests. + * The core interface that each host language plugin must implement in platform_test integration + * tests. * - * Generated interface from Pigeon that represents a handler of messages from Flutter. + *

Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface HostIntegrationCoreApi { /** - * A no-op function taking no arguments and returning no value, to sanity - * test basic calling. + * A no-op function taking no arguments and returning no value, to sanity test basic calling. */ void noop(); /** Returns the passed object, to test serialization and deserialization. */ - @NonNull AllTypes echoAllTypes(@NonNull AllTypes everything); + @NonNull + AllTypes echoAllTypes(@NonNull AllTypes everything); /** Returns the passed object, to test serialization and deserialization. */ - @Nullable AllNullableTypes echoAllNullableTypes(@Nullable AllNullableTypes everything); + @Nullable + AllNullableTypes echoAllNullableTypes(@Nullable AllNullableTypes everything); /** Returns an error, to test error handling. */ void throwError(); /** Returns passed in int. */ - @NonNull Long echoInt(@NonNull Long anInt); + @NonNull + Long echoInt(@NonNull Long anInt); /** Returns passed in double. */ - @NonNull Double echoDouble(@NonNull Double aDouble); + @NonNull + Double echoDouble(@NonNull Double aDouble); /** Returns the passed in boolean. */ - @NonNull Boolean echoBool(@NonNull Boolean aBool); + @NonNull + Boolean echoBool(@NonNull Boolean aBool); /** Returns the passed in string. */ - @NonNull String echoString(@NonNull String aString); + @NonNull + String echoString(@NonNull String aString); /** Returns the passed in Uint8List. */ - @NonNull byte[] echoUint8List(@NonNull byte[] aUint8List); + @NonNull + byte[] echoUint8List(@NonNull byte[] aUint8List); /** Returns the passed in generic Object. */ - @NonNull Object echoObject(@NonNull Object anObject); + @NonNull + Object echoObject(@NonNull Object anObject); /** - * Returns the inner `aString` value from the wrapped object, to test - * sending of nested objects. + * Returns the inner `aString` value from the wrapped object, to test sending of nested objects. */ - @Nullable String extractNestedNullableString(@NonNull AllNullableTypesWrapper wrapper); + @Nullable + String extractNestedNullableString(@NonNull AllNullableTypesWrapper wrapper); /** - * Returns the inner `aString` value from the wrapped object, to test - * sending of nested objects. + * Returns the inner `aString` value from the wrapped object, to test sending of nested objects. */ - @NonNull AllNullableTypesWrapper createNestedNullableString(@Nullable String nullableString); + @NonNull + AllNullableTypesWrapper createNestedNullableString(@Nullable String nullableString); /** Returns passed in arguments of multiple types. */ - @NonNull AllNullableTypes sendMultipleNullableTypes(@Nullable Boolean aNullableBool, @Nullable Long aNullableInt, @Nullable String aNullableString); + @NonNull + AllNullableTypes sendMultipleNullableTypes( + @Nullable Boolean aNullableBool, + @Nullable Long aNullableInt, + @Nullable String aNullableString); /** Returns passed in int. */ - @Nullable Long echoNullableInt(@Nullable Long aNullableInt); + @Nullable + Long echoNullableInt(@Nullable Long aNullableInt); /** Returns passed in double. */ - @Nullable Double echoNullableDouble(@Nullable Double aNullableDouble); + @Nullable + Double echoNullableDouble(@Nullable Double aNullableDouble); /** Returns the passed in boolean. */ - @Nullable Boolean echoNullableBool(@Nullable Boolean aNullableBool); + @Nullable + Boolean echoNullableBool(@Nullable Boolean aNullableBool); /** Returns the passed in string. */ - @Nullable String echoNullableString(@Nullable String aNullableString); + @Nullable + String echoNullableString(@Nullable String aNullableString); /** Returns the passed in Uint8List. */ - @Nullable byte[] echoNullableUint8List(@Nullable byte[] aNullableUint8List); + @Nullable + byte[] echoNullableUint8List(@Nullable byte[] aNullableUint8List); /** Returns the passed in generic Object. */ - @Nullable Object echoNullableObject(@Nullable Object aNullableObject); + @Nullable + Object echoNullableObject(@Nullable Object aNullableObject); /** - * A no-op function taking no arguments and returning no value, to sanity - * test basic asynchronous calling. + * A no-op function taking no arguments and returning no value, to sanity test basic + * asynchronous calling. */ void noopAsync(Result result); /** Returns the passed string asynchronously. */ void echoAsyncString(@NonNull String aString, Result result); + void callFlutterNoop(Result result); + void callFlutterEchoString(@NonNull String aString, Result result); /** The codec used by HostIntegrationCoreApi. */ static MessageCodec getCodec() { - return HostIntegrationCoreApiCodec.INSTANCE; } - /**Sets up an instance of `HostIntegrationCoreApi` to handle messages through the `binaryMessenger`. */ + return HostIntegrationCoreApiCodec.INSTANCE; + } + /** + * Sets up an instance of `HostIntegrationCoreApi` to handle messages through the + * `binaryMessenger`. + */ static void setup(BinaryMessenger binaryMessenger, HostIntegrationCoreApi api) { { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.noop", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.noop", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - api.noop(); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + api.noop(); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAllTypes", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoAllTypes", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - AllTypes everythingArg = (AllTypes)args.get(0); - if (everythingArg == null) { - throw new NullPointerException("everythingArg unexpectedly null."); - } - AllTypes output = api.echoAllTypes(everythingArg); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + AllTypes everythingArg = (AllTypes) args.get(0); + if (everythingArg == null) { + throw new NullPointerException("everythingArg unexpectedly null."); + } + AllTypes output = api.echoAllTypes(everythingArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAllNullableTypes", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoAllNullableTypes", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - AllNullableTypes everythingArg = (AllNullableTypes)args.get(0); - AllNullableTypes output = api.echoAllNullableTypes(everythingArg); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + AllNullableTypes everythingArg = (AllNullableTypes) args.get(0); + AllNullableTypes output = api.echoAllNullableTypes(everythingArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.throwError", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.throwError", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - api.throwError(); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + api.throwError(); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoInt", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoInt", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number anIntArg = (Number)args.get(0); - if (anIntArg == null) { - throw new NullPointerException("anIntArg unexpectedly null."); - } - Long output = api.echoInt((anIntArg == null) ? null : anIntArg.longValue()); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number anIntArg = (Number) args.get(0); + if (anIntArg == null) { + throw new NullPointerException("anIntArg unexpectedly null."); + } + Long output = api.echoInt((anIntArg == null) ? null : anIntArg.longValue()); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoDouble", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoDouble", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Double aDoubleArg = (Double)args.get(0); - if (aDoubleArg == null) { - throw new NullPointerException("aDoubleArg unexpectedly null."); - } - Double output = api.echoDouble(aDoubleArg); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Double aDoubleArg = (Double) args.get(0); + if (aDoubleArg == null) { + throw new NullPointerException("aDoubleArg unexpectedly null."); + } + Double output = api.echoDouble(aDoubleArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoBool", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoBool", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Boolean aBoolArg = (Boolean)args.get(0); - if (aBoolArg == null) { - throw new NullPointerException("aBoolArg unexpectedly null."); - } - Boolean output = api.echoBool(aBoolArg); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Boolean aBoolArg = (Boolean) args.get(0); + if (aBoolArg == null) { + throw new NullPointerException("aBoolArg unexpectedly null."); + } + Boolean output = api.echoBool(aBoolArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoString", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoString", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - String aStringArg = (String)args.get(0); - if (aStringArg == null) { - throw new NullPointerException("aStringArg unexpectedly null."); - } - String output = api.echoString(aStringArg); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String aStringArg = (String) args.get(0); + if (aStringArg == null) { + throw new NullPointerException("aStringArg unexpectedly null."); + } + String output = api.echoString(aStringArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoUint8List", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoUint8List", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - byte[] aUint8ListArg = (byte[])args.get(0); - if (aUint8ListArg == null) { - throw new NullPointerException("aUint8ListArg unexpectedly null."); - } - byte[] output = api.echoUint8List(aUint8ListArg); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + byte[] aUint8ListArg = (byte[]) args.get(0); + if (aUint8ListArg == null) { + throw new NullPointerException("aUint8ListArg unexpectedly null."); + } + byte[] output = api.echoUint8List(aUint8ListArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoObject", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoObject", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Object anObjectArg = args.get(0); - if (anObjectArg == null) { - throw new NullPointerException("anObjectArg unexpectedly null."); - } - Object output = api.echoObject(anObjectArg); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Object anObjectArg = args.get(0); + if (anObjectArg == null) { + throw new NullPointerException("anObjectArg unexpectedly null."); + } + Object output = api.echoObject(anObjectArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.extractNestedNullableString", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.extractNestedNullableString", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - AllNullableTypesWrapper wrapperArg = (AllNullableTypesWrapper)args.get(0); - if (wrapperArg == null) { - throw new NullPointerException("wrapperArg unexpectedly null."); - } - String output = api.extractNestedNullableString(wrapperArg); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + AllNullableTypesWrapper wrapperArg = (AllNullableTypesWrapper) args.get(0); + if (wrapperArg == null) { + throw new NullPointerException("wrapperArg unexpectedly null."); + } + String output = api.extractNestedNullableString(wrapperArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.createNestedNullableString", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.createNestedNullableString", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - String nullableStringArg = (String)args.get(0); - AllNullableTypesWrapper output = api.createNestedNullableString(nullableStringArg); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String nullableStringArg = (String) args.get(0); + AllNullableTypesWrapper output = + api.createNestedNullableString(nullableStringArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.sendMultipleNullableTypes", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.sendMultipleNullableTypes", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Boolean aNullableBoolArg = (Boolean)args.get(0); - Number aNullableIntArg = (Number)args.get(1); - String aNullableStringArg = (String)args.get(2); - AllNullableTypes output = api.sendMultipleNullableTypes(aNullableBoolArg, (aNullableIntArg == null) ? null : aNullableIntArg.longValue(), aNullableStringArg); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Boolean aNullableBoolArg = (Boolean) args.get(0); + Number aNullableIntArg = (Number) args.get(1); + String aNullableStringArg = (String) args.get(2); + AllNullableTypes output = + api.sendMultipleNullableTypes( + aNullableBoolArg, + (aNullableIntArg == null) ? null : aNullableIntArg.longValue(), + aNullableStringArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableInt", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableInt", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number aNullableIntArg = (Number)args.get(0); - Long output = api.echoNullableInt((aNullableIntArg == null) ? null : aNullableIntArg.longValue()); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number aNullableIntArg = (Number) args.get(0); + Long output = + api.echoNullableInt( + (aNullableIntArg == null) ? null : aNullableIntArg.longValue()); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableDouble", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableDouble", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Double aNullableDoubleArg = (Double)args.get(0); - Double output = api.echoNullableDouble(aNullableDoubleArg); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Double aNullableDoubleArg = (Double) args.get(0); + Double output = api.echoNullableDouble(aNullableDoubleArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableBool", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableBool", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Boolean aNullableBoolArg = (Boolean)args.get(0); - Boolean output = api.echoNullableBool(aNullableBoolArg); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Boolean aNullableBoolArg = (Boolean) args.get(0); + Boolean output = api.echoNullableBool(aNullableBoolArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableString", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableString", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - String aNullableStringArg = (String)args.get(0); - String output = api.echoNullableString(aNullableStringArg); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String aNullableStringArg = (String) args.get(0); + String output = api.echoNullableString(aNullableStringArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableUint8List", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableUint8List", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - byte[] aNullableUint8ListArg = (byte[])args.get(0); - byte[] output = api.echoNullableUint8List(aNullableUint8ListArg); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + byte[] aNullableUint8ListArg = (byte[]) args.get(0); + byte[] output = api.echoNullableUint8List(aNullableUint8ListArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableObject", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableObject", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Object aNullableObjectArg = args.get(0); - Object output = api.echoNullableObject(aNullableObjectArg); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Object aNullableObjectArg = args.get(0); + Object output = api.echoNullableObject(aNullableObjectArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.noopAsync", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.noopAsync", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - Result resultCallback = new Result() { - public void success(Void result) { - wrapped.add(0, null); - reply.reply(wrapped); - } - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + Result resultCallback = + new Result() { + public void success(Void result) { + wrapped.add(0, null); + reply.reply(wrapped); + } + + public void error(Throwable error) { + ArrayList wrappedError = wrapError(error); + reply.reply(wrappedError); + } + }; + + api.noopAsync(resultCallback); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); reply.reply(wrappedError); } - }; - - api.noopAsync(resultCallback); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - reply.reply(wrappedError); - } - }); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncString", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncString", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - String aStringArg = (String)args.get(0); - if (aStringArg == null) { - throw new NullPointerException("aStringArg unexpectedly null."); - } - Result resultCallback = new Result() { - public void success(String result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String aStringArg = (String) args.get(0); + if (aStringArg == null) { + throw new NullPointerException("aStringArg unexpectedly null."); + } + Result resultCallback = + new Result() { + public void success(String result) { + wrapped.add(0, result); + reply.reply(wrapped); + } + + public void error(Throwable error) { + ArrayList wrappedError = wrapError(error); + reply.reply(wrappedError); + } + }; + + api.echoAsyncString(aStringArg, resultCallback); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); reply.reply(wrappedError); } - }; - - api.echoAsyncString(aStringArg, resultCallback); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - reply.reply(wrappedError); - } - }); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterNoop", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterNoop", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - Result resultCallback = new Result() { - public void success(Void result) { - wrapped.add(0, null); - reply.reply(wrapped); - } - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + Result resultCallback = + new Result() { + public void success(Void result) { + wrapped.add(0, null); + reply.reply(wrapped); + } + + public void error(Throwable error) { + ArrayList wrappedError = wrapError(error); + reply.reply(wrappedError); + } + }; + + api.callFlutterNoop(resultCallback); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); reply.reply(wrappedError); } - }; - - api.callFlutterNoop(resultCallback); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - reply.reply(wrappedError); - } - }); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoString", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoString", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - String aStringArg = (String)args.get(0); - if (aStringArg == null) { - throw new NullPointerException("aStringArg unexpectedly null."); - } - Result resultCallback = new Result() { - public void success(String result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String aStringArg = (String) args.get(0); + if (aStringArg == null) { + throw new NullPointerException("aStringArg unexpectedly null."); + } + Result resultCallback = + new Result() { + public void success(String result) { + wrapped.add(0, result); + reply.reply(wrapped); + } + + public void error(Throwable error) { + ArrayList wrappedError = wrapError(error); + reply.reply(wrappedError); + } + }; + + api.callFlutterEchoString(aStringArg, resultCallback); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); reply.reply(wrappedError); } - }; - - api.callFlutterEchoString(aStringArg, resultCallback); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - reply.reply(wrappedError); - } - }); + }); } else { channel.setMessageHandler(null); } } } } + private static class FlutterIntegrationCoreApiCodec extends StandardMessageCodec { - public static final FlutterIntegrationCoreApiCodec INSTANCE = new FlutterIntegrationCoreApiCodec(); + public static final FlutterIntegrationCoreApiCodec INSTANCE = + new FlutterIntegrationCoreApiCodec(); + private FlutterIntegrationCoreApiCodec() {} + @Override protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { switch (type) { - case (byte)128: + case (byte) 128: return AllNullableTypes.fromList((ArrayList) readValue(buffer)); - - case (byte)129: + + case (byte) 129: return AllNullableTypesWrapper.fromList((ArrayList) readValue(buffer)); - - case (byte)130: + + case (byte) 130: return AllTypes.fromList((ArrayList) readValue(buffer)); - - default: + + default: return super.readValueOfType(type, buffer); - } } + @Override - protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { + protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { if (value instanceof AllNullableTypes) { stream.write(128); writeValue(stream, ((AllNullableTypes) value).toList()); - } else - if (value instanceof AllNullableTypesWrapper) { + } else if (value instanceof AllNullableTypesWrapper) { stream.write(129); writeValue(stream, ((AllNullableTypesWrapper) value).toList()); - } else - if (value instanceof AllTypes) { + } else if (value instanceof AllTypes) { stream.write(130); writeValue(stream, ((AllTypes) value).toList()); - } else -{ + } else { super.writeValue(stream, value); } } } /** - * The core interface that the Dart platform_test code implements for host - * integration tests to call into. + * The core interface that the Dart platform_test code implements for host integration tests to + * call into. * - * Generated class from Pigeon that represents Flutter messages that can be called from Java. + *

Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class FlutterIntegrationCoreApi { private final BinaryMessenger binaryMessenger; - public FlutterIntegrationCoreApi(BinaryMessenger argBinaryMessenger){ + + public FlutterIntegrationCoreApi(BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } + public interface Reply { void reply(T reply); } /** The codec used by FlutterIntegrationCoreApi. */ static MessageCodec getCodec() { - return FlutterIntegrationCoreApiCodec.INSTANCE; + return FlutterIntegrationCoreApiCodec.INSTANCE; } /** - * A no-op function taking no arguments and returning no value, to sanity - * test basic calling. + * A no-op function taking no arguments and returning no value, to sanity test basic calling. */ public void noop(Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.noop", getCodec()); - channel.send(null, channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.noop", getCodec()); + channel.send( + null, + channelReply -> { + callback.reply(null); + }); } /** Returns the passed object, to test serialization and deserialization. */ public void echoAllTypes(@NonNull AllTypes everythingArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllTypes", getCodec()); - channel.send(new ArrayList(Collections.singletonList(everythingArg)), channelReply -> { - @SuppressWarnings("ConstantConditions") - AllTypes output = (AllTypes)channelReply; - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllTypes", + getCodec()); + channel.send( + new ArrayList(Collections.singletonList(everythingArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + AllTypes output = (AllTypes) channelReply; + callback.reply(output); + }); } /** Returns the passed object, to test serialization and deserialization. */ - public void echoAllNullableTypes(@NonNull AllNullableTypes everythingArg, Reply callback) { + public void echoAllNullableTypes( + @NonNull AllNullableTypes everythingArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes", getCodec()); - channel.send(new ArrayList(Collections.singletonList(everythingArg)), channelReply -> { - @SuppressWarnings("ConstantConditions") - AllNullableTypes output = (AllNullableTypes)channelReply; - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes", + getCodec()); + channel.send( + new ArrayList(Collections.singletonList(everythingArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + AllNullableTypes output = (AllNullableTypes) channelReply; + callback.reply(output); + }); } /** * Returns passed in arguments of multiple types. * - * Tests multiple-arity FlutterApi handling. + *

Tests multiple-arity FlutterApi handling. */ - public void sendMultipleNullableTypes(@Nullable Boolean aNullableBoolArg, @Nullable Long aNullableIntArg, @Nullable String aNullableStringArg, Reply callback) { + public void sendMultipleNullableTypes( + @Nullable Boolean aNullableBoolArg, + @Nullable Long aNullableIntArg, + @Nullable String aNullableStringArg, + Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.sendMultipleNullableTypes", getCodec()); - channel.send(new ArrayList(Arrays.asList(aNullableBoolArg, aNullableIntArg, aNullableStringArg)), channelReply -> { - @SuppressWarnings("ConstantConditions") - AllNullableTypes output = (AllNullableTypes)channelReply; - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.sendMultipleNullableTypes", + getCodec()); + channel.send( + new ArrayList( + Arrays.asList(aNullableBoolArg, aNullableIntArg, aNullableStringArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + AllNullableTypes output = (AllNullableTypes) channelReply; + callback.reply(output); + }); } /** Returns the passed boolean, to test serialization and deserialization. */ public void echoBool(@NonNull Boolean aBoolArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoBool", getCodec()); - channel.send(new ArrayList(Collections.singletonList(aBoolArg)), channelReply -> { - @SuppressWarnings("ConstantConditions") - Boolean output = (Boolean)channelReply; - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoBool", getCodec()); + channel.send( + new ArrayList(Collections.singletonList(aBoolArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + Boolean output = (Boolean) channelReply; + callback.reply(output); + }); } /** Returns the passed int, to test serialization and deserialization. */ public void echoInt(@NonNull Long anIntArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoInt", getCodec()); - channel.send(new ArrayList(Collections.singletonList(anIntArg)), channelReply -> { - @SuppressWarnings("ConstantConditions") - Long output = channelReply == null ? null : ((Number)channelReply).longValue(); - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoInt", getCodec()); + channel.send( + new ArrayList(Collections.singletonList(anIntArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + Long output = channelReply == null ? null : ((Number) channelReply).longValue(); + callback.reply(output); + }); } /** Returns the passed double, to test serialization and deserialization. */ public void echoDouble(@NonNull Double aDoubleArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoDouble", getCodec()); - channel.send(new ArrayList(Collections.singletonList(aDoubleArg)), channelReply -> { - @SuppressWarnings("ConstantConditions") - Double output = (Double)channelReply; - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoDouble", + getCodec()); + channel.send( + new ArrayList(Collections.singletonList(aDoubleArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + Double output = (Double) channelReply; + callback.reply(output); + }); } /** Returns the passed string, to test serialization and deserialization. */ public void echoString(@NonNull String aStringArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoString", getCodec()); - channel.send(new ArrayList(Collections.singletonList(aStringArg)), channelReply -> { - @SuppressWarnings("ConstantConditions") - String output = (String)channelReply; - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoString", + getCodec()); + channel.send( + new ArrayList(Collections.singletonList(aStringArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + String output = (String) channelReply; + callback.reply(output); + }); } /** Returns the passed byte list, to test serialization and deserialization. */ public void echoUint8List(@NonNull byte[] aListArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoUint8List", getCodec()); - channel.send(new ArrayList(Collections.singletonList(aListArg)), channelReply -> { - @SuppressWarnings("ConstantConditions") - byte[] output = (byte[])channelReply; - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoUint8List", + getCodec()); + channel.send( + new ArrayList(Collections.singletonList(aListArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + byte[] output = (byte[]) channelReply; + callback.reply(output); + }); } /** Returns the passed list, to test serialization and deserialization. */ public void echoList(@NonNull List aListArg, Reply> callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoList", getCodec()); - channel.send(new ArrayList(Collections.singletonList(aListArg)), channelReply -> { - @SuppressWarnings("ConstantConditions") - List output = (List)channelReply; - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoList", getCodec()); + channel.send( + new ArrayList(Collections.singletonList(aListArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + List output = (List) channelReply; + callback.reply(output); + }); } /** Returns the passed map, to test serialization and deserialization. */ public void echoMap(@NonNull Map aMapArg, Reply> callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoMap", getCodec()); - channel.send(new ArrayList(Collections.singletonList(aMapArg)), channelReply -> { - @SuppressWarnings("ConstantConditions") - Map output = (Map)channelReply; - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoMap", getCodec()); + channel.send( + new ArrayList(Collections.singletonList(aMapArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + Map output = (Map) channelReply; + callback.reply(output); + }); } /** Returns the passed boolean, to test serialization and deserialization. */ public void echoNullableBool(@Nullable Boolean aBoolArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableBool", getCodec()); - channel.send(new ArrayList(Collections.singletonList(aBoolArg)), channelReply -> { - @SuppressWarnings("ConstantConditions") - Boolean output = (Boolean)channelReply; - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableBool", + getCodec()); + channel.send( + new ArrayList(Collections.singletonList(aBoolArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + Boolean output = (Boolean) channelReply; + callback.reply(output); + }); } /** Returns the passed int, to test serialization and deserialization. */ public void echoNullableInt(@Nullable Long anIntArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableInt", getCodec()); - channel.send(new ArrayList(Collections.singletonList(anIntArg)), channelReply -> { - @SuppressWarnings("ConstantConditions") - Long output = channelReply == null ? null : ((Number)channelReply).longValue(); - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableInt", + getCodec()); + channel.send( + new ArrayList(Collections.singletonList(anIntArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + Long output = channelReply == null ? null : ((Number) channelReply).longValue(); + callback.reply(output); + }); } /** Returns the passed double, to test serialization and deserialization. */ public void echoNullableDouble(@Nullable Double aDoubleArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableDouble", getCodec()); - channel.send(new ArrayList(Collections.singletonList(aDoubleArg)), channelReply -> { - @SuppressWarnings("ConstantConditions") - Double output = (Double)channelReply; - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableDouble", + getCodec()); + channel.send( + new ArrayList(Collections.singletonList(aDoubleArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + Double output = (Double) channelReply; + callback.reply(output); + }); } /** Returns the passed string, to test serialization and deserialization. */ public void echoNullableString(@Nullable String aStringArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableString", getCodec()); - channel.send(new ArrayList(Collections.singletonList(aStringArg)), channelReply -> { - @SuppressWarnings("ConstantConditions") - String output = (String)channelReply; - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableString", + getCodec()); + channel.send( + new ArrayList(Collections.singletonList(aStringArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + String output = (String) channelReply; + callback.reply(output); + }); } /** Returns the passed byte list, to test serialization and deserialization. */ public void echoNullableUint8List(@Nullable byte[] aListArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableUint8List", getCodec()); - channel.send(new ArrayList(Collections.singletonList(aListArg)), channelReply -> { - @SuppressWarnings("ConstantConditions") - byte[] output = (byte[])channelReply; - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableUint8List", + getCodec()); + channel.send( + new ArrayList(Collections.singletonList(aListArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + byte[] output = (byte[]) channelReply; + callback.reply(output); + }); } /** Returns the passed list, to test serialization and deserialization. */ public void echoNullableList(@Nullable List aListArg, Reply> callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList", getCodec()); - channel.send(new ArrayList(Collections.singletonList(aListArg)), channelReply -> { - @SuppressWarnings("ConstantConditions") - List output = (List)channelReply; - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList", + getCodec()); + channel.send( + new ArrayList(Collections.singletonList(aListArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + List output = (List) channelReply; + callback.reply(output); + }); } /** Returns the passed map, to test serialization and deserialization. */ - public void echoNullableMap(@NonNull Map aMapArg, Reply> callback) { + public void echoNullableMap( + @NonNull Map aMapArg, Reply> callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap", getCodec()); - channel.send(new ArrayList(Collections.singletonList(aMapArg)), channelReply -> { - @SuppressWarnings("ConstantConditions") - Map output = (Map)channelReply; - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap", + getCodec()); + channel.send( + new ArrayList(Collections.singletonList(aMapArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + Map output = (Map) channelReply; + callback.reply(output); + }); } } /** * An API that can be implemented for minimal, compile-only tests. * - * Generated interface from Pigeon that represents a handler of messages from Flutter. + *

Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface HostTrivialApi { void noop(); /** The codec used by HostTrivialApi. */ static MessageCodec getCodec() { - return new StandardMessageCodec(); } - /**Sets up an instance of `HostTrivialApi` to handle messages through the `binaryMessenger`. */ + return new StandardMessageCodec(); + } + /** Sets up an instance of `HostTrivialApi` to handle messages through the `binaryMessenger`. */ static void setup(BinaryMessenger binaryMessenger, HostTrivialApi api) { { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostTrivialApi.noop", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.HostTrivialApi.noop", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - api.noop(); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + api.noop(); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h index 482f2c13722..1f7196621ec 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h @@ -1,7 +1,7 @@ // 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 (v6.0.4), do not edit directly. // See also: https://pub.dev/packages/pigeon @@ -28,65 +28,67 @@ typedef NS_ENUM(NSUInteger, AnEnum) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithABool:(NSNumber *)aBool - anInt:(NSNumber *)anInt - aDouble:(NSNumber *)aDouble - aByteArray:(FlutterStandardTypedData *)aByteArray - a4ByteArray:(FlutterStandardTypedData *)a4ByteArray - a8ByteArray:(FlutterStandardTypedData *)a8ByteArray - aFloatArray:(FlutterStandardTypedData *)aFloatArray - aList:(NSArray *)aList - aMap:(NSDictionary *)aMap - anEnum:(AnEnum)anEnum - aString:(NSString *)aString; -@property(nonatomic, strong) NSNumber * aBool; -@property(nonatomic, strong) NSNumber * anInt; -@property(nonatomic, strong) NSNumber * aDouble; -@property(nonatomic, strong) FlutterStandardTypedData * aByteArray; -@property(nonatomic, strong) FlutterStandardTypedData * a4ByteArray; -@property(nonatomic, strong) FlutterStandardTypedData * a8ByteArray; -@property(nonatomic, strong) FlutterStandardTypedData * aFloatArray; -@property(nonatomic, strong) NSArray * aList; -@property(nonatomic, strong) NSDictionary * aMap; + anInt:(NSNumber *)anInt + aDouble:(NSNumber *)aDouble + aByteArray:(FlutterStandardTypedData *)aByteArray + a4ByteArray:(FlutterStandardTypedData *)a4ByteArray + a8ByteArray:(FlutterStandardTypedData *)a8ByteArray + aFloatArray:(FlutterStandardTypedData *)aFloatArray + aList:(NSArray *)aList + aMap:(NSDictionary *)aMap + anEnum:(AnEnum)anEnum + aString:(NSString *)aString; +@property(nonatomic, strong) NSNumber *aBool; +@property(nonatomic, strong) NSNumber *anInt; +@property(nonatomic, strong) NSNumber *aDouble; +@property(nonatomic, strong) FlutterStandardTypedData *aByteArray; +@property(nonatomic, strong) FlutterStandardTypedData *a4ByteArray; +@property(nonatomic, strong) FlutterStandardTypedData *a8ByteArray; +@property(nonatomic, strong) FlutterStandardTypedData *aFloatArray; +@property(nonatomic, strong) NSArray *aList; +@property(nonatomic, strong) NSDictionary *aMap; @property(nonatomic, assign) AnEnum anEnum; -@property(nonatomic, copy) NSString * aString; +@property(nonatomic, copy) NSString *aString; @end @interface AllNullableTypes : NSObject + (instancetype)makeWithANullableBool:(nullable NSNumber *)aNullableBool - aNullableInt:(nullable NSNumber *)aNullableInt - aNullableDouble:(nullable NSNumber *)aNullableDouble - aNullableByteArray:(nullable FlutterStandardTypedData *)aNullableByteArray - aNullable4ByteArray:(nullable FlutterStandardTypedData *)aNullable4ByteArray - aNullable8ByteArray:(nullable FlutterStandardTypedData *)aNullable8ByteArray - aNullableFloatArray:(nullable FlutterStandardTypedData *)aNullableFloatArray - aNullableList:(nullable NSArray *)aNullableList - aNullableMap:(nullable NSDictionary *)aNullableMap - nullableNestedList:(nullable NSArray *> *)nullableNestedList - nullableMapWithAnnotations:(nullable NSDictionary *)nullableMapWithAnnotations - nullableMapWithObject:(nullable NSDictionary *)nullableMapWithObject - aNullableEnum:(AnEnum)aNullableEnum - aNullableString:(nullable NSString *)aNullableString; -@property(nonatomic, strong, nullable) NSNumber * aNullableBool; -@property(nonatomic, strong, nullable) NSNumber * aNullableInt; -@property(nonatomic, strong, nullable) NSNumber * aNullableDouble; -@property(nonatomic, strong, nullable) FlutterStandardTypedData * aNullableByteArray; -@property(nonatomic, strong, nullable) FlutterStandardTypedData * aNullable4ByteArray; -@property(nonatomic, strong, nullable) FlutterStandardTypedData * aNullable8ByteArray; -@property(nonatomic, strong, nullable) FlutterStandardTypedData * aNullableFloatArray; -@property(nonatomic, strong, nullable) NSArray * aNullableList; -@property(nonatomic, strong, nullable) NSDictionary * aNullableMap; -@property(nonatomic, strong, nullable) NSArray *> * nullableNestedList; -@property(nonatomic, strong, nullable) NSDictionary * nullableMapWithAnnotations; -@property(nonatomic, strong, nullable) NSDictionary * nullableMapWithObject; + aNullableInt:(nullable NSNumber *)aNullableInt + aNullableDouble:(nullable NSNumber *)aNullableDouble + aNullableByteArray:(nullable FlutterStandardTypedData *)aNullableByteArray + aNullable4ByteArray:(nullable FlutterStandardTypedData *)aNullable4ByteArray + aNullable8ByteArray:(nullable FlutterStandardTypedData *)aNullable8ByteArray + aNullableFloatArray:(nullable FlutterStandardTypedData *)aNullableFloatArray + aNullableList:(nullable NSArray *)aNullableList + aNullableMap:(nullable NSDictionary *)aNullableMap + nullableNestedList:(nullable NSArray *> *)nullableNestedList + nullableMapWithAnnotations: + (nullable NSDictionary *)nullableMapWithAnnotations + nullableMapWithObject:(nullable NSDictionary *)nullableMapWithObject + aNullableEnum:(AnEnum)aNullableEnum + aNullableString:(nullable NSString *)aNullableString; +@property(nonatomic, strong, nullable) NSNumber *aNullableBool; +@property(nonatomic, strong, nullable) NSNumber *aNullableInt; +@property(nonatomic, strong, nullable) NSNumber *aNullableDouble; +@property(nonatomic, strong, nullable) FlutterStandardTypedData *aNullableByteArray; +@property(nonatomic, strong, nullable) FlutterStandardTypedData *aNullable4ByteArray; +@property(nonatomic, strong, nullable) FlutterStandardTypedData *aNullable8ByteArray; +@property(nonatomic, strong, nullable) FlutterStandardTypedData *aNullableFloatArray; +@property(nonatomic, strong, nullable) NSArray *aNullableList; +@property(nonatomic, strong, nullable) NSDictionary *aNullableMap; +@property(nonatomic, strong, nullable) NSArray *> *nullableNestedList; +@property(nonatomic, strong, nullable) + NSDictionary *nullableMapWithAnnotations; +@property(nonatomic, strong, nullable) NSDictionary *nullableMapWithObject; @property(nonatomic, assign) AnEnum aNullableEnum; -@property(nonatomic, copy, nullable) NSString * aNullableString; +@property(nonatomic, copy, nullable) NSString *aNullableString; @end @interface AllNullableTypesWrapper : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithValues:(AllNullableTypes *)values; -@property(nonatomic, strong) AllNullableTypes * values; +@property(nonatomic, strong) AllNullableTypes *values; @end /// The codec used by HostIntegrationCoreApi. @@ -101,9 +103,11 @@ NSObject *HostIntegrationCoreApiGetCodec(void); /// Returns the passed object, to test serialization and deserialization. /// /// @return `nil` only when `error != nil`. -- (nullable AllTypes *)echoAllTypes:(AllTypes *)everything error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable AllTypes *)echoAllTypes:(AllTypes *)everything + error:(FlutterError *_Nullable *_Nonnull)error; /// Returns the passed object, to test serialization and deserialization. -- (nullable AllNullableTypes *)echoAllNullableTypes:(nullable AllNullableTypes *)everything error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable AllNullableTypes *)echoAllNullableTypes:(nullable AllNullableTypes *)everything + error:(FlutterError *_Nullable *_Nonnull)error; /// Returns an error, to test error handling. - (void)throwErrorWithError:(FlutterError *_Nullable *_Nonnull)error; /// Returns passed in int. @@ -113,7 +117,8 @@ NSObject *HostIntegrationCoreApiGetCodec(void); /// Returns passed in double. /// /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)echoDouble:(NSNumber *)aDouble error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSNumber *)echoDouble:(NSNumber *)aDouble + error:(FlutterError *_Nullable *_Nonnull)error; /// Returns the passed in boolean. /// /// @return `nil` only when `error != nil`. @@ -121,49 +126,68 @@ NSObject *HostIntegrationCoreApiGetCodec(void); /// Returns the passed in string. /// /// @return `nil` only when `error != nil`. -- (nullable NSString *)echoString:(NSString *)aString error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSString *)echoString:(NSString *)aString + error:(FlutterError *_Nullable *_Nonnull)error; /// Returns the passed in Uint8List. /// /// @return `nil` only when `error != nil`. -- (nullable FlutterStandardTypedData *)echoUint8List:(FlutterStandardTypedData *)aUint8List error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable FlutterStandardTypedData *)echoUint8List:(FlutterStandardTypedData *)aUint8List + error:(FlutterError *_Nullable *_Nonnull)error; /// Returns the passed in generic Object. /// /// @return `nil` only when `error != nil`. - (nullable id)echoObject:(id)anObject error:(FlutterError *_Nullable *_Nonnull)error; /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. -- (nullable NSString *)extractNestedNullableStringFrom:(AllNullableTypesWrapper *)wrapper error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSString *)extractNestedNullableStringFrom:(AllNullableTypesWrapper *)wrapper + error:(FlutterError *_Nullable *_Nonnull)error; /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. /// /// @return `nil` only when `error != nil`. -- (nullable AllNullableTypesWrapper *)createNestedObjectWithNullableString:(nullable NSString *)nullableString error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable AllNullableTypesWrapper *) + createNestedObjectWithNullableString:(nullable NSString *)nullableString + error:(FlutterError *_Nullable *_Nonnull)error; /// Returns passed in arguments of multiple types. /// /// @return `nil` only when `error != nil`. -- (nullable AllNullableTypes *)sendMultipleNullableTypesABool:(nullable NSNumber *)aNullableBool anInt:(nullable NSNumber *)aNullableInt aString:(nullable NSString *)aNullableString error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable AllNullableTypes *)sendMultipleNullableTypesABool:(nullable NSNumber *)aNullableBool + anInt:(nullable NSNumber *)aNullableInt + aString:(nullable NSString *)aNullableString + error:(FlutterError *_Nullable *_Nonnull) + error; /// Returns passed in int. -- (nullable NSNumber *)echoNullableInt:(nullable NSNumber *)aNullableInt error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSNumber *)echoNullableInt:(nullable NSNumber *)aNullableInt + error:(FlutterError *_Nullable *_Nonnull)error; /// Returns passed in double. -- (nullable NSNumber *)echoNullableDouble:(nullable NSNumber *)aNullableDouble error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSNumber *)echoNullableDouble:(nullable NSNumber *)aNullableDouble + error:(FlutterError *_Nullable *_Nonnull)error; /// Returns the passed in boolean. -- (nullable NSNumber *)echoNullableBool:(nullable NSNumber *)aNullableBool error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSNumber *)echoNullableBool:(nullable NSNumber *)aNullableBool + error:(FlutterError *_Nullable *_Nonnull)error; /// Returns the passed in string. -- (nullable NSString *)echoNullableString:(nullable NSString *)aNullableString error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSString *)echoNullableString:(nullable NSString *)aNullableString + error:(FlutterError *_Nullable *_Nonnull)error; /// Returns the passed in Uint8List. -- (nullable FlutterStandardTypedData *)echoNullableUint8List:(nullable FlutterStandardTypedData *)aNullableUint8List error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable FlutterStandardTypedData *) + echoNullableUint8List:(nullable FlutterStandardTypedData *)aNullableUint8List + error:(FlutterError *_Nullable *_Nonnull)error; /// Returns the passed in generic Object. -- (nullable id)echoNullableObject:(nullable id)aNullableObject error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable id)echoNullableObject:(nullable id)aNullableObject + error:(FlutterError *_Nullable *_Nonnull)error; /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. -- (void)noopAsyncWithCompletion:(void(^)(FlutterError *_Nullable))completion; +- (void)noopAsyncWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Returns the passed string asynchronously. -- (void)echoAsyncString:(NSString *)aString completion:(void(^)(NSString *_Nullable, FlutterError *_Nullable))completion; -- (void)callFlutterNoopWithCompletion:(void(^)(FlutterError *_Nullable))completion; -- (void)callFlutterEchoString:(NSString *)aString completion:(void(^)(NSString *_Nullable, FlutterError *_Nullable))completion; +- (void)echoAsyncString:(NSString *)aString + completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; +- (void)callFlutterNoopWithCompletion:(void (^)(FlutterError *_Nullable))completion; +- (void)callFlutterEchoString:(NSString *)aString + completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; @end -extern void HostIntegrationCoreApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void HostIntegrationCoreApiSetup(id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FlutterIntegrationCoreApi. NSObject *FlutterIntegrationCoreApiGetCodec(void); @@ -174,43 +198,65 @@ NSObject *FlutterIntegrationCoreApiGetCodec(void); - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; /// A no-op function taking no arguments and returning no value, to sanity /// test basic calling. -- (void)noopWithCompletion:(void(^)(NSError *_Nullable))completion; +- (void)noopWithCompletion:(void (^)(NSError *_Nullable))completion; /// Returns the passed object, to test serialization and deserialization. -- (void)echoAllTypes:(AllTypes *)everything completion:(void(^)(AllTypes *_Nullable, NSError *_Nullable))completion; +- (void)echoAllTypes:(AllTypes *)everything + completion:(void (^)(AllTypes *_Nullable, NSError *_Nullable))completion; /// Returns the passed object, to test serialization and deserialization. -- (void)echoAllNullableTypes:(AllNullableTypes *)everything completion:(void(^)(AllNullableTypes *_Nullable, NSError *_Nullable))completion; +- (void)echoAllNullableTypes:(AllNullableTypes *)everything + completion:(void (^)(AllNullableTypes *_Nullable, NSError *_Nullable))completion; /// Returns passed in arguments of multiple types. /// /// Tests multiple-arity FlutterApi handling. -- (void)sendMultipleNullableTypesABool:(nullable NSNumber *)aNullableBool anInt:(nullable NSNumber *)aNullableInt aString:(nullable NSString *)aNullableString completion:(void(^)(AllNullableTypes *_Nullable, NSError *_Nullable))completion; +- (void)sendMultipleNullableTypesABool:(nullable NSNumber *)aNullableBool + anInt:(nullable NSNumber *)aNullableInt + aString:(nullable NSString *)aNullableString + completion:(void (^)(AllNullableTypes *_Nullable, + NSError *_Nullable))completion; /// Returns the passed boolean, to test serialization and deserialization. -- (void)echoBool:(NSNumber *)aBool completion:(void(^)(NSNumber *_Nullable, NSError *_Nullable))completion; +- (void)echoBool:(NSNumber *)aBool + completion:(void (^)(NSNumber *_Nullable, NSError *_Nullable))completion; /// Returns the passed int, to test serialization and deserialization. -- (void)echoInt:(NSNumber *)anInt completion:(void(^)(NSNumber *_Nullable, NSError *_Nullable))completion; +- (void)echoInt:(NSNumber *)anInt + completion:(void (^)(NSNumber *_Nullable, NSError *_Nullable))completion; /// Returns the passed double, to test serialization and deserialization. -- (void)echoDouble:(NSNumber *)aDouble completion:(void(^)(NSNumber *_Nullable, NSError *_Nullable))completion; +- (void)echoDouble:(NSNumber *)aDouble + completion:(void (^)(NSNumber *_Nullable, NSError *_Nullable))completion; /// Returns the passed string, to test serialization and deserialization. -- (void)echoString:(NSString *)aString completion:(void(^)(NSString *_Nullable, NSError *_Nullable))completion; +- (void)echoString:(NSString *)aString + completion:(void (^)(NSString *_Nullable, NSError *_Nullable))completion; /// Returns the passed byte list, to test serialization and deserialization. -- (void)echoUint8List:(FlutterStandardTypedData *)aList completion:(void(^)(FlutterStandardTypedData *_Nullable, NSError *_Nullable))completion; +- (void)echoUint8List:(FlutterStandardTypedData *)aList + completion:(void (^)(FlutterStandardTypedData *_Nullable, NSError *_Nullable))completion; /// Returns the passed list, to test serialization and deserialization. -- (void)echoList:(NSArray *)aList completion:(void(^)(NSArray *_Nullable, NSError *_Nullable))completion; +- (void)echoList:(NSArray *)aList + completion:(void (^)(NSArray *_Nullable, NSError *_Nullable))completion; /// Returns the passed map, to test serialization and deserialization. -- (void)echoMap:(NSDictionary *)aMap completion:(void(^)(NSDictionary *_Nullable, NSError *_Nullable))completion; +- (void)echoMap:(NSDictionary *)aMap + completion:(void (^)(NSDictionary *_Nullable, NSError *_Nullable))completion; /// Returns the passed boolean, to test serialization and deserialization. -- (void)echoNullableBool:(nullable NSNumber *)aBool completion:(void(^)(NSNumber *_Nullable, NSError *_Nullable))completion; +- (void)echoNullableBool:(nullable NSNumber *)aBool + completion:(void (^)(NSNumber *_Nullable, NSError *_Nullable))completion; /// Returns the passed int, to test serialization and deserialization. -- (void)echoNullableInt:(nullable NSNumber *)anInt completion:(void(^)(NSNumber *_Nullable, NSError *_Nullable))completion; +- (void)echoNullableInt:(nullable NSNumber *)anInt + completion:(void (^)(NSNumber *_Nullable, NSError *_Nullable))completion; /// Returns the passed double, to test serialization and deserialization. -- (void)echoNullableDouble:(nullable NSNumber *)aDouble completion:(void(^)(NSNumber *_Nullable, NSError *_Nullable))completion; +- (void)echoNullableDouble:(nullable NSNumber *)aDouble + completion:(void (^)(NSNumber *_Nullable, NSError *_Nullable))completion; /// Returns the passed string, to test serialization and deserialization. -- (void)echoNullableString:(nullable NSString *)aString completion:(void(^)(NSString *_Nullable, NSError *_Nullable))completion; +- (void)echoNullableString:(nullable NSString *)aString + completion:(void (^)(NSString *_Nullable, NSError *_Nullable))completion; /// Returns the passed byte list, to test serialization and deserialization. -- (void)echoNullableUint8List:(nullable FlutterStandardTypedData *)aList completion:(void(^)(FlutterStandardTypedData *_Nullable, NSError *_Nullable))completion; +- (void)echoNullableUint8List:(nullable FlutterStandardTypedData *)aList + completion:(void (^)(FlutterStandardTypedData *_Nullable, + NSError *_Nullable))completion; /// Returns the passed list, to test serialization and deserialization. -- (void)echoNullableList:(nullable NSArray *)aList completion:(void(^)(NSArray *_Nullable, NSError *_Nullable))completion; +- (void)echoNullableList:(nullable NSArray *)aList + completion:(void (^)(NSArray *_Nullable, NSError *_Nullable))completion; /// Returns the passed map, to test serialization and deserialization. -- (void)echoNullableMap:(NSDictionary *)aMap completion:(void(^)(NSDictionary *_Nullable, NSError *_Nullable))completion; +- (void)echoNullableMap:(NSDictionary *)aMap + completion: + (void (^)(NSDictionary *_Nullable, NSError *_Nullable))completion; @end /// The codec used by HostTrivialApi. @@ -221,6 +267,7 @@ NSObject *HostTrivialApiGetCodec(void); - (void)noopWithError:(FlutterError *_Nullable *_Nonnull)error; @end -extern void HostTrivialApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void HostTrivialApiSetup(id binaryMessenger, + NSObject *_Nullable api); NS_ASSUME_NONNULL_END diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m index c6da6c7edca..b92f59f74e2 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m @@ -1,7 +1,7 @@ // 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 (v6.0.4), do not edit directly. // See also: https://pub.dev/packages/pigeon @@ -14,20 +14,21 @@ static NSArray *wrapResult(id result, FlutterError *error) { if (error) { - return @[ error.code ?: [NSNull null], error.message ?: [NSNull null], error.details ?: [NSNull null] ]; + return @[ + error.code ?: [NSNull null], error.message ?: [NSNull null], error.details ?: [NSNull null] + ]; } - return @[ result ?: [NSNull null] ]; + return @[ result ?: [NSNull null] ]; } -static id GetNullableObject(NSDictionary* dict, id key) { +static id GetNullableObject(NSDictionary *dict, id key) { id result = dict[key]; return (result == [NSNull null]) ? nil : result; } -static id GetNullableObjectAtIndex(NSArray* array, NSInteger key) { +static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { id result = array[key]; return (result == [NSNull null]) ? nil : result; } - @interface AllTypes () + (AllTypes *)fromList:(NSArray *)list; + (nullable AllTypes *)nullableFromList:(NSArray *)list; @@ -46,20 +47,19 @@ + (nullable AllNullableTypesWrapper *)nullableFromList:(NSArray *)list; - (NSArray *)toList; @end - @implementation AllTypes + (instancetype)makeWithABool:(NSNumber *)aBool - anInt:(NSNumber *)anInt - aDouble:(NSNumber *)aDouble - aByteArray:(FlutterStandardTypedData *)aByteArray - a4ByteArray:(FlutterStandardTypedData *)a4ByteArray - a8ByteArray:(FlutterStandardTypedData *)a8ByteArray - aFloatArray:(FlutterStandardTypedData *)aFloatArray - aList:(NSArray *)aList - aMap:(NSDictionary *)aMap - anEnum:(AnEnum)anEnum - aString:(NSString *)aString { - AllTypes* pigeonResult = [[AllTypes alloc] init]; + anInt:(NSNumber *)anInt + aDouble:(NSNumber *)aDouble + aByteArray:(FlutterStandardTypedData *)aByteArray + a4ByteArray:(FlutterStandardTypedData *)a4ByteArray + a8ByteArray:(FlutterStandardTypedData *)a8ByteArray + aFloatArray:(FlutterStandardTypedData *)aFloatArray + aList:(NSArray *)aList + aMap:(NSDictionary *)aMap + anEnum:(AnEnum)anEnum + aString:(NSString *)aString { + AllTypes *pigeonResult = [[AllTypes alloc] init]; pigeonResult.aBool = aBool; pigeonResult.anInt = anInt; pigeonResult.aDouble = aDouble; @@ -98,7 +98,9 @@ + (AllTypes *)fromList:(NSArray *)list { NSAssert(pigeonResult.aString != nil, @""); return pigeonResult; } -+ (nullable AllTypes *)nullableFromList:(NSArray *)list { return (list) ? [AllTypes fromList:list] : nil; } ++ (nullable AllTypes *)nullableFromList:(NSArray *)list { + return (list) ? [AllTypes fromList:list] : nil; +} - (NSArray *)toList { return @[ (self.aBool ?: [NSNull null]), @@ -118,20 +120,21 @@ - (NSArray *)toList { @implementation AllNullableTypes + (instancetype)makeWithANullableBool:(nullable NSNumber *)aNullableBool - aNullableInt:(nullable NSNumber *)aNullableInt - aNullableDouble:(nullable NSNumber *)aNullableDouble - aNullableByteArray:(nullable FlutterStandardTypedData *)aNullableByteArray - aNullable4ByteArray:(nullable FlutterStandardTypedData *)aNullable4ByteArray - aNullable8ByteArray:(nullable FlutterStandardTypedData *)aNullable8ByteArray - aNullableFloatArray:(nullable FlutterStandardTypedData *)aNullableFloatArray - aNullableList:(nullable NSArray *)aNullableList - aNullableMap:(nullable NSDictionary *)aNullableMap - nullableNestedList:(nullable NSArray *> *)nullableNestedList - nullableMapWithAnnotations:(nullable NSDictionary *)nullableMapWithAnnotations - nullableMapWithObject:(nullable NSDictionary *)nullableMapWithObject - aNullableEnum:(AnEnum)aNullableEnum - aNullableString:(nullable NSString *)aNullableString { - AllNullableTypes* pigeonResult = [[AllNullableTypes alloc] init]; + aNullableInt:(nullable NSNumber *)aNullableInt + aNullableDouble:(nullable NSNumber *)aNullableDouble + aNullableByteArray:(nullable FlutterStandardTypedData *)aNullableByteArray + aNullable4ByteArray:(nullable FlutterStandardTypedData *)aNullable4ByteArray + aNullable8ByteArray:(nullable FlutterStandardTypedData *)aNullable8ByteArray + aNullableFloatArray:(nullable FlutterStandardTypedData *)aNullableFloatArray + aNullableList:(nullable NSArray *)aNullableList + aNullableMap:(nullable NSDictionary *)aNullableMap + nullableNestedList:(nullable NSArray *> *)nullableNestedList + nullableMapWithAnnotations: + (nullable NSDictionary *)nullableMapWithAnnotations + nullableMapWithObject:(nullable NSDictionary *)nullableMapWithObject + aNullableEnum:(AnEnum)aNullableEnum + aNullableString:(nullable NSString *)aNullableString { + AllNullableTypes *pigeonResult = [[AllNullableTypes alloc] init]; pigeonResult.aNullableBool = aNullableBool; pigeonResult.aNullableInt = aNullableInt; pigeonResult.aNullableDouble = aNullableDouble; @@ -166,7 +169,9 @@ + (AllNullableTypes *)fromList:(NSArray *)list { pigeonResult.aNullableString = GetNullableObjectAtIndex(list, 13); return pigeonResult; } -+ (nullable AllNullableTypes *)nullableFromList:(NSArray *)list { return (list) ? [AllNullableTypes fromList:list] : nil; } ++ (nullable AllNullableTypes *)nullableFromList:(NSArray *)list { + return (list) ? [AllNullableTypes fromList:list] : nil; +} - (NSArray *)toList { return @[ (self.aNullableBool ?: [NSNull null]), @@ -189,7 +194,7 @@ - (NSArray *)toList { @implementation AllNullableTypesWrapper + (instancetype)makeWithValues:(AllNullableTypes *)values { - AllNullableTypesWrapper* pigeonResult = [[AllNullableTypesWrapper alloc] init]; + AllNullableTypesWrapper *pigeonResult = [[AllNullableTypesWrapper alloc] init]; pigeonResult.values = values; return pigeonResult; } @@ -199,7 +204,9 @@ + (AllNullableTypesWrapper *)fromList:(NSArray *)list { NSAssert(pigeonResult.values != nil, @""); return pigeonResult; } -+ (nullable AllNullableTypesWrapper *)nullableFromList:(NSArray *)list { return (list) ? [AllNullableTypesWrapper fromList:list] : nil; } ++ (nullable AllNullableTypesWrapper *)nullableFromList:(NSArray *)list { + return (list) ? [AllNullableTypesWrapper fromList:list] : nil; +} - (NSArray *)toList { return @[ (self.values ? [self.values toList] : [NSNull null]), @@ -210,21 +217,19 @@ - (NSArray *)toList { @interface HostIntegrationCoreApiCodecReader : FlutterStandardReader @end @implementation HostIntegrationCoreApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [AllNullableTypes fromList:[self readValue]]; - - case 129: + + case 129: return [AllNullableTypesWrapper fromList:[self readValue]]; - - case 130: + + case 130: return [AllTypes fromList:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -232,21 +237,17 @@ - (nullable id)readValueOfType:(UInt8)type @interface HostIntegrationCoreApiCodecWriter : FlutterStandardWriter @end @implementation HostIntegrationCoreApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[AllNullableTypes class]]) { [self writeByte:128]; [self writeValue:[value toList]]; - } else - if ([value isKindOfClass:[AllNullableTypesWrapper class]]) { + } else if ([value isKindOfClass:[AllNullableTypesWrapper class]]) { [self writeByte:129]; [self writeValue:[value toList]]; - } else - if ([value isKindOfClass:[AllTypes class]]) { + } else if ([value isKindOfClass:[AllTypes class]]) { [self writeByte:130]; [self writeValue:[value toList]]; - } else -{ + } else { [super writeValue:value]; } } @@ -263,47 +264,50 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { } @end - NSObject *HostIntegrationCoreApiGetCodec() { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - HostIntegrationCoreApiCodecReaderWriter *readerWriter = [[HostIntegrationCoreApiCodecReaderWriter alloc] init]; + HostIntegrationCoreApiCodecReaderWriter *readerWriter = + [[HostIntegrationCoreApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void HostIntegrationCoreApiSetup(id binaryMessenger, NSObject *api) { - /// A no-op function taking no arguments and returning no value, to sanity +void HostIntegrationCoreApiSetup(id binaryMessenger, + NSObject *api) { + /// A no-op function taking no arguments and returning no value, to sanity /// test basic calling. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.noop" + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.noop" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(noopWithError:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(noopWithError:)", api); + NSCAssert([api respondsToSelector:@selector(noopWithError:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(noopWithError:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { FlutterError *error; [api noopWithError:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns the passed object, to test serialization and deserialization. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoAllTypes" + /// Returns the passed object, to test serialization and deserialization. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoAllTypes" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(echoAllTypes:error:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoAllTypes:error:)", api); + NSCAssert( + [api respondsToSelector:@selector(echoAllTypes:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoAllTypes:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; AllTypes *arg_everything = GetNullableObjectAtIndex(args, 0); @@ -311,20 +315,21 @@ void HostIntegrationCoreApiSetup(id binaryMessenger, NSO AllTypes *output = [api echoAllTypes:arg_everything error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns the passed object, to test serialization and deserialization. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoAllNullableTypes" + /// Returns the passed object, to test serialization and deserialization. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoAllNullableTypes" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(echoAllNullableTypes:error:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoAllNullableTypes:error:)", api); + NSCAssert([api respondsToSelector:@selector(echoAllNullableTypes:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to " + @"@selector(echoAllNullableTypes:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; AllNullableTypes *arg_everything = GetNullableObjectAtIndex(args, 0); @@ -332,39 +337,40 @@ void HostIntegrationCoreApiSetup(id binaryMessenger, NSO AllNullableTypes *output = [api echoAllNullableTypes:arg_everything error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns an error, to test error handling. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.throwError" + /// Returns an error, to test error handling. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.throwError" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(throwErrorWithError:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(throwErrorWithError:)", api); + NSCAssert( + [api respondsToSelector:@selector(throwErrorWithError:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(throwErrorWithError:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { FlutterError *error; [api throwErrorWithError:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns passed in int. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoInt" + /// Returns passed in int. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoInt" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(echoInt:error:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoInt:error:)", api); + NSCAssert([api respondsToSelector:@selector(echoInt:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoInt:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_anInt = GetNullableObjectAtIndex(args, 0); @@ -372,20 +378,20 @@ void HostIntegrationCoreApiSetup(id binaryMessenger, NSO NSNumber *output = [api echoInt:arg_anInt error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns passed in double. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoDouble" + /// Returns passed in double. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoDouble" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(echoDouble:error:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoDouble:error:)", api); + NSCAssert([api respondsToSelector:@selector(echoDouble:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoDouble:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_aDouble = GetNullableObjectAtIndex(args, 0); @@ -393,20 +399,20 @@ void HostIntegrationCoreApiSetup(id binaryMessenger, NSO NSNumber *output = [api echoDouble:arg_aDouble error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns the passed in boolean. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoBool" + /// Returns the passed in boolean. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoBool" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(echoBool:error:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoBool:error:)", api); + NSCAssert([api respondsToSelector:@selector(echoBool:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoBool:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_aBool = GetNullableObjectAtIndex(args, 0); @@ -414,20 +420,20 @@ void HostIntegrationCoreApiSetup(id binaryMessenger, NSO NSNumber *output = [api echoBool:arg_aBool error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns the passed in string. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoString" + /// Returns the passed in string. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoString" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(echoString:error:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoString:error:)", api); + NSCAssert([api respondsToSelector:@selector(echoString:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoString:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_aString = GetNullableObjectAtIndex(args, 0); @@ -435,20 +441,21 @@ void HostIntegrationCoreApiSetup(id binaryMessenger, NSO NSString *output = [api echoString:arg_aString error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns the passed in Uint8List. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoUint8List" + /// Returns the passed in Uint8List. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoUint8List" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(echoUint8List:error:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoUint8List:error:)", api); + NSCAssert( + [api respondsToSelector:@selector(echoUint8List:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoUint8List:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FlutterStandardTypedData *arg_aUint8List = GetNullableObjectAtIndex(args, 0); @@ -456,20 +463,20 @@ void HostIntegrationCoreApiSetup(id binaryMessenger, NSO FlutterStandardTypedData *output = [api echoUint8List:arg_aUint8List error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns the passed in generic Object. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoObject" + /// Returns the passed in generic Object. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoObject" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(echoObject:error:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoObject:error:)", api); + NSCAssert([api respondsToSelector:@selector(echoObject:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoObject:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; id arg_anObject = GetNullableObjectAtIndex(args, 0); @@ -477,21 +484,22 @@ void HostIntegrationCoreApiSetup(id binaryMessenger, NSO id output = [api echoObject:arg_anObject error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns the inner `aString` value from the wrapped object, to test + /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.extractNestedNullableString" + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.extractNestedNullableString" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(extractNestedNullableStringFrom:error:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(extractNestedNullableStringFrom:error:)", api); + NSCAssert([api respondsToSelector:@selector(extractNestedNullableStringFrom:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to " + @"@selector(extractNestedNullableStringFrom:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; AllNullableTypesWrapper *arg_wrapper = GetNullableObjectAtIndex(args, 0); @@ -499,65 +507,73 @@ void HostIntegrationCoreApiSetup(id binaryMessenger, NSO NSString *output = [api extractNestedNullableStringFrom:arg_wrapper error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns the inner `aString` value from the wrapped object, to test + /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.createNestedNullableString" + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.createNestedNullableString" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createNestedObjectWithNullableString:error:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(createNestedObjectWithNullableString:error:)", api); + NSCAssert([api respondsToSelector:@selector(createNestedObjectWithNullableString:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to " + @"@selector(createNestedObjectWithNullableString:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_nullableString = GetNullableObjectAtIndex(args, 0); FlutterError *error; - AllNullableTypesWrapper *output = [api createNestedObjectWithNullableString:arg_nullableString error:&error]; + AllNullableTypesWrapper *output = + [api createNestedObjectWithNullableString:arg_nullableString error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns passed in arguments of multiple types. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.sendMultipleNullableTypes" + /// Returns passed in arguments of multiple types. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.sendMultipleNullableTypes" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(sendMultipleNullableTypesABool:anInt:aString:error:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(sendMultipleNullableTypesABool:anInt:aString:error:)", api); + NSCAssert([api respondsToSelector:@selector(sendMultipleNullableTypesABool: + anInt:aString:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to " + @"@selector(sendMultipleNullableTypesABool:anInt:aString:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_aNullableBool = GetNullableObjectAtIndex(args, 0); NSNumber *arg_aNullableInt = GetNullableObjectAtIndex(args, 1); NSString *arg_aNullableString = GetNullableObjectAtIndex(args, 2); FlutterError *error; - AllNullableTypes *output = [api sendMultipleNullableTypesABool:arg_aNullableBool anInt:arg_aNullableInt aString:arg_aNullableString error:&error]; + AllNullableTypes *output = [api sendMultipleNullableTypesABool:arg_aNullableBool + anInt:arg_aNullableInt + aString:arg_aNullableString + error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns passed in int. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableInt" + /// Returns passed in int. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableInt" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(echoNullableInt:error:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoNullableInt:error:)", api); + NSCAssert( + [api respondsToSelector:@selector(echoNullableInt:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoNullableInt:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_aNullableInt = GetNullableObjectAtIndex(args, 0); @@ -565,20 +581,21 @@ void HostIntegrationCoreApiSetup(id binaryMessenger, NSO NSNumber *output = [api echoNullableInt:arg_aNullableInt error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns passed in double. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableDouble" + /// Returns passed in double. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableDouble" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(echoNullableDouble:error:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoNullableDouble:error:)", api); + NSCAssert([api respondsToSelector:@selector(echoNullableDouble:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to " + @"@selector(echoNullableDouble:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_aNullableDouble = GetNullableObjectAtIndex(args, 0); @@ -586,20 +603,21 @@ void HostIntegrationCoreApiSetup(id binaryMessenger, NSO NSNumber *output = [api echoNullableDouble:arg_aNullableDouble error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns the passed in boolean. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableBool" + /// Returns the passed in boolean. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableBool" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(echoNullableBool:error:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoNullableBool:error:)", api); + NSCAssert( + [api respondsToSelector:@selector(echoNullableBool:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoNullableBool:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_aNullableBool = GetNullableObjectAtIndex(args, 0); @@ -607,20 +625,21 @@ void HostIntegrationCoreApiSetup(id binaryMessenger, NSO NSNumber *output = [api echoNullableBool:arg_aNullableBool error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns the passed in string. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableString" + /// Returns the passed in string. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableString" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(echoNullableString:error:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoNullableString:error:)", api); + NSCAssert([api respondsToSelector:@selector(echoNullableString:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to " + @"@selector(echoNullableString:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_aNullableString = GetNullableObjectAtIndex(args, 0); @@ -628,41 +647,44 @@ void HostIntegrationCoreApiSetup(id binaryMessenger, NSO NSString *output = [api echoNullableString:arg_aNullableString error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns the passed in Uint8List. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableUint8List" + /// Returns the passed in Uint8List. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableUint8List" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(echoNullableUint8List:error:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoNullableUint8List:error:)", api); + NSCAssert([api respondsToSelector:@selector(echoNullableUint8List:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to " + @"@selector(echoNullableUint8List:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FlutterStandardTypedData *arg_aNullableUint8List = GetNullableObjectAtIndex(args, 0); FlutterError *error; - FlutterStandardTypedData *output = [api echoNullableUint8List:arg_aNullableUint8List error:&error]; + FlutterStandardTypedData *output = [api echoNullableUint8List:arg_aNullableUint8List + error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns the passed in generic Object. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableObject" + /// Returns the passed in generic Object. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableObject" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(echoNullableObject:error:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoNullableObject:error:)", api); + NSCAssert([api respondsToSelector:@selector(echoNullableObject:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to " + @"@selector(echoNullableObject:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; id arg_aNullableObject = GetNullableObjectAtIndex(args, 0); @@ -670,87 +692,92 @@ void HostIntegrationCoreApiSetup(id binaryMessenger, NSO id output = [api echoNullableObject:arg_aNullableObject error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// A no-op function taking no arguments and returning no value, to sanity + /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.noopAsync" + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.noopAsync" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(noopAsyncWithCompletion:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(noopAsyncWithCompletion:)", api); + NSCAssert( + [api respondsToSelector:@selector(noopAsyncWithCompletion:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(noopAsyncWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api noopAsyncWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); }]; }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns the passed string asynchronously. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncString" + /// Returns the passed string asynchronously. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncString" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(echoAsyncString:completion:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoAsyncString:completion:)", api); + NSCAssert([api respondsToSelector:@selector(echoAsyncString:completion:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to " + @"@selector(echoAsyncString:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_aString = GetNullableObjectAtIndex(args, 0); - [api echoAsyncString:arg_aString completion:^(NSString *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api echoAsyncString:arg_aString + completion:^(NSString *_Nullable output, FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterNoop" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterNoop" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterNoopWithCompletion:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(callFlutterNoopWithCompletion:)", api); + NSCAssert([api respondsToSelector:@selector(callFlutterNoopWithCompletion:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to " + @"@selector(callFlutterNoopWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api callFlutterNoopWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); }]; }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoString" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoString" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoString:completion:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(callFlutterEchoString:completion:)", api); + NSCAssert([api respondsToSelector:@selector(callFlutterEchoString:completion:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to " + @"@selector(callFlutterEchoString:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_aString = GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoString:arg_aString completion:^(NSString *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api callFlutterEchoString:arg_aString + completion:^(NSString *_Nullable output, FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -758,21 +785,19 @@ void HostIntegrationCoreApiSetup(id binaryMessenger, NSO @interface FlutterIntegrationCoreApiCodecReader : FlutterStandardReader @end @implementation FlutterIntegrationCoreApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [AllNullableTypes fromList:[self readValue]]; - - case 129: + + case 129: return [AllNullableTypesWrapper fromList:[self readValue]]; - - case 130: + + case 130: return [AllTypes fromList:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -780,21 +805,17 @@ - (nullable id)readValueOfType:(UInt8)type @interface FlutterIntegrationCoreApiCodecWriter : FlutterStandardWriter @end @implementation FlutterIntegrationCoreApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[AllNullableTypes class]]) { [self writeByte:128]; [self writeValue:[value toList]]; - } else - if ([value isKindOfClass:[AllNullableTypesWrapper class]]) { + } else if ([value isKindOfClass:[AllNullableTypesWrapper class]]) { [self writeByte:129]; [self writeValue:[value toList]]; - } else - if ([value isKindOfClass:[AllTypes class]]) { + } else if ([value isKindOfClass:[AllTypes class]]) { [self writeByte:130]; [self writeValue:[value toList]]; - } else -{ + } else { [super writeValue:value]; } } @@ -811,19 +832,19 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { } @end - NSObject *FlutterIntegrationCoreApiGetCodec() { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - FlutterIntegrationCoreApiCodecReaderWriter *readerWriter = [[FlutterIntegrationCoreApiCodecReaderWriter alloc] init]; + FlutterIntegrationCoreApiCodecReaderWriter *readerWriter = + [[FlutterIntegrationCoreApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } @interface FlutterIntegrationCoreApi () -@property (nonatomic, strong) NSObject *binaryMessenger; +@property(nonatomic, strong) NSObject *binaryMessenger; @end @implementation FlutterIntegrationCoreApi @@ -835,202 +856,229 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)noopWithCompletion:(void(^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)noopWithCompletion:(void (^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.noop" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:nil reply:^(id reply) { - completion(nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:nil + reply:^(id reply) { + completion(nil); + }]; } -- (void)echoAllTypes:(AllTypes *)arg_everything completion:(void(^)(AllTypes *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)echoAllTypes:(AllTypes *)arg_everything + completion:(void (^)(AllTypes *_Nullable, NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllTypes" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:@[arg_everything ?: [NSNull null]] reply:^(id reply) { - AllTypes *output = reply; - completion(output, nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:@[ arg_everything ?: [NSNull null] ] + reply:^(id reply) { + AllTypes *output = reply; + completion(output, nil); + }]; } -- (void)echoAllNullableTypes:(AllNullableTypes *)arg_everything completion:(void(^)(AllNullableTypes *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)echoAllNullableTypes:(AllNullableTypes *)arg_everything + completion:(void (^)(AllNullableTypes *_Nullable, NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:@[arg_everything ?: [NSNull null]] reply:^(id reply) { - AllNullableTypes *output = reply; - completion(output, nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:@[ arg_everything ?: [NSNull null] ] + reply:^(id reply) { + AllNullableTypes *output = reply; + completion(output, nil); + }]; } -- (void)sendMultipleNullableTypesABool:(nullable NSNumber *)arg_aNullableBool anInt:(nullable NSNumber *)arg_aNullableInt aString:(nullable NSString *)arg_aNullableString completion:(void(^)(AllNullableTypes *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel - messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.sendMultipleNullableTypes" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:@[arg_aNullableBool ?: [NSNull null], arg_aNullableInt ?: [NSNull null], arg_aNullableString ?: [NSNull null]] reply:^(id reply) { - AllNullableTypes *output = reply; - completion(output, nil); - }]; +- (void)sendMultipleNullableTypesABool:(nullable NSNumber *)arg_aNullableBool + anInt:(nullable NSNumber *)arg_aNullableInt + aString:(nullable NSString *)arg_aNullableString + completion:(void (^)(AllNullableTypes *_Nullable, + NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel + messageChannelWithName: + @"dev.flutter.pigeon.FlutterIntegrationCoreApi.sendMultipleNullableTypes" + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:@[ + arg_aNullableBool ?: [NSNull null], arg_aNullableInt ?: [NSNull null], + arg_aNullableString ?: [NSNull null] + ] + reply:^(id reply) { + AllNullableTypes *output = reply; + completion(output, nil); + }]; } -- (void)echoBool:(NSNumber *)arg_aBool completion:(void(^)(NSNumber *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)echoBool:(NSNumber *)arg_aBool + completion:(void (^)(NSNumber *_Nullable, NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.echoBool" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:@[arg_aBool ?: [NSNull null]] reply:^(id reply) { - NSNumber *output = reply; - completion(output, nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:@[ arg_aBool ?: [NSNull null] ] + reply:^(id reply) { + NSNumber *output = reply; + completion(output, nil); + }]; } -- (void)echoInt:(NSNumber *)arg_anInt completion:(void(^)(NSNumber *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)echoInt:(NSNumber *)arg_anInt + completion:(void (^)(NSNumber *_Nullable, NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.echoInt" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:@[arg_anInt ?: [NSNull null]] reply:^(id reply) { - NSNumber *output = reply; - completion(output, nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:@[ arg_anInt ?: [NSNull null] ] + reply:^(id reply) { + NSNumber *output = reply; + completion(output, nil); + }]; } -- (void)echoDouble:(NSNumber *)arg_aDouble completion:(void(^)(NSNumber *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)echoDouble:(NSNumber *)arg_aDouble + completion:(void (^)(NSNumber *_Nullable, NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.echoDouble" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:@[arg_aDouble ?: [NSNull null]] reply:^(id reply) { - NSNumber *output = reply; - completion(output, nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:@[ arg_aDouble ?: [NSNull null] ] + reply:^(id reply) { + NSNumber *output = reply; + completion(output, nil); + }]; } -- (void)echoString:(NSString *)arg_aString completion:(void(^)(NSString *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)echoString:(NSString *)arg_aString + completion:(void (^)(NSString *_Nullable, NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.echoString" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:@[arg_aString ?: [NSNull null]] reply:^(id reply) { - NSString *output = reply; - completion(output, nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:@[ arg_aString ?: [NSNull null] ] + reply:^(id reply) { + NSString *output = reply; + completion(output, nil); + }]; } -- (void)echoUint8List:(FlutterStandardTypedData *)arg_aList completion:(void(^)(FlutterStandardTypedData *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)echoUint8List:(FlutterStandardTypedData *)arg_aList + completion: + (void (^)(FlutterStandardTypedData *_Nullable, NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.echoUint8List" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:@[arg_aList ?: [NSNull null]] reply:^(id reply) { - FlutterStandardTypedData *output = reply; - completion(output, nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:@[ arg_aList ?: [NSNull null] ] + reply:^(id reply) { + FlutterStandardTypedData *output = reply; + completion(output, nil); + }]; } -- (void)echoList:(NSArray *)arg_aList completion:(void(^)(NSArray *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)echoList:(NSArray *)arg_aList + completion:(void (^)(NSArray *_Nullable, NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.echoList" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:@[arg_aList ?: [NSNull null]] reply:^(id reply) { - NSArray *output = reply; - completion(output, nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:@[ arg_aList ?: [NSNull null] ] + reply:^(id reply) { + NSArray *output = reply; + completion(output, nil); + }]; } -- (void)echoMap:(NSDictionary *)arg_aMap completion:(void(^)(NSDictionary *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)echoMap:(NSDictionary *)arg_aMap + completion:(void (^)(NSDictionary *_Nullable, NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.echoMap" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:@[arg_aMap ?: [NSNull null]] reply:^(id reply) { - NSDictionary *output = reply; - completion(output, nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:@[ arg_aMap ?: [NSNull null] ] + reply:^(id reply) { + NSDictionary *output = reply; + completion(output, nil); + }]; } -- (void)echoNullableBool:(nullable NSNumber *)arg_aBool completion:(void(^)(NSNumber *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)echoNullableBool:(nullable NSNumber *)arg_aBool + completion:(void (^)(NSNumber *_Nullable, NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableBool" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:@[arg_aBool ?: [NSNull null]] reply:^(id reply) { - NSNumber *output = reply; - completion(output, nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:@[ arg_aBool ?: [NSNull null] ] + reply:^(id reply) { + NSNumber *output = reply; + completion(output, nil); + }]; } -- (void)echoNullableInt:(nullable NSNumber *)arg_anInt completion:(void(^)(NSNumber *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)echoNullableInt:(nullable NSNumber *)arg_anInt + completion:(void (^)(NSNumber *_Nullable, NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableInt" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:@[arg_anInt ?: [NSNull null]] reply:^(id reply) { - NSNumber *output = reply; - completion(output, nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:@[ arg_anInt ?: [NSNull null] ] + reply:^(id reply) { + NSNumber *output = reply; + completion(output, nil); + }]; } -- (void)echoNullableDouble:(nullable NSNumber *)arg_aDouble completion:(void(^)(NSNumber *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)echoNullableDouble:(nullable NSNumber *)arg_aDouble + completion:(void (^)(NSNumber *_Nullable, NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableDouble" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:@[arg_aDouble ?: [NSNull null]] reply:^(id reply) { - NSNumber *output = reply; - completion(output, nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:@[ arg_aDouble ?: [NSNull null] ] + reply:^(id reply) { + NSNumber *output = reply; + completion(output, nil); + }]; } -- (void)echoNullableString:(nullable NSString *)arg_aString completion:(void(^)(NSString *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)echoNullableString:(nullable NSString *)arg_aString + completion:(void (^)(NSString *_Nullable, NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableString" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:@[arg_aString ?: [NSNull null]] reply:^(id reply) { - NSString *output = reply; - completion(output, nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:@[ arg_aString ?: [NSNull null] ] + reply:^(id reply) { + NSString *output = reply; + completion(output, nil); + }]; } -- (void)echoNullableUint8List:(nullable FlutterStandardTypedData *)arg_aList completion:(void(^)(FlutterStandardTypedData *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)echoNullableUint8List:(nullable FlutterStandardTypedData *)arg_aList + completion:(void (^)(FlutterStandardTypedData *_Nullable, + NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableUint8List" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:@[arg_aList ?: [NSNull null]] reply:^(id reply) { - FlutterStandardTypedData *output = reply; - completion(output, nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:@[ arg_aList ?: [NSNull null] ] + reply:^(id reply) { + FlutterStandardTypedData *output = reply; + completion(output, nil); + }]; } -- (void)echoNullableList:(nullable NSArray *)arg_aList completion:(void(^)(NSArray *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)echoNullableList:(nullable NSArray *)arg_aList + completion:(void (^)(NSArray *_Nullable, NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:@[arg_aList ?: [NSNull null]] reply:^(id reply) { - NSArray *output = reply; - completion(output, nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:@[ arg_aList ?: [NSNull null] ] + reply:^(id reply) { + NSArray *output = reply; + completion(output, nil); + }]; } -- (void)echoNullableMap:(NSDictionary *)arg_aMap completion:(void(^)(NSDictionary *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)echoNullableMap:(NSDictionary *)arg_aMap + completion: + (void (^)(NSDictionary *_Nullable, NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:@[arg_aMap ?: [NSNull null]] reply:^(id reply) { - NSDictionary *output = reply; - completion(output, nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:@[ arg_aMap ?: [NSNull null] ] + reply:^(id reply) { + NSDictionary *output = reply; + completion(output, nil); + }]; } @end @@ -1040,22 +1088,22 @@ - (void)echoNullableMap:(NSDictionary *)arg_aMap completion:(voi return sSharedObject; } -void HostTrivialApiSetup(id binaryMessenger, NSObject *api) { +void HostTrivialApiSetup(id binaryMessenger, + NSObject *api) { { FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostTrivialApi.noop" - binaryMessenger:binaryMessenger - codec:HostTrivialApiGetCodec()]; + [[FlutterBasicMessageChannel alloc] initWithName:@"dev.flutter.pigeon.HostTrivialApi.noop" + binaryMessenger:binaryMessenger + codec:HostTrivialApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(noopWithError:)], @"HostTrivialApi api (%@) doesn't respond to @selector(noopWithError:)", api); + NSCAssert([api respondsToSelector:@selector(noopWithError:)], + @"HostTrivialApi api (%@) doesn't respond to @selector(noopWithError:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { FlutterError *error; [api noopWithError:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } 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 index bf6e201a31b..213aa4855e9 100644 --- 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 @@ -1,7 +1,7 @@ // 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 (v6.0.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 @@ -83,8 +83,7 @@ class AllTypes { aFloatArray: result[6]! as Float64List, aList: result[7]! as List, aMap: result[8]! as Map, - anEnum: AnEnum.values[result[9]! as int] -, + anEnum: AnEnum.values[result[9]! as int], aString: result[10]! as String, ); } @@ -168,11 +167,12 @@ class AllNullableTypes { aNullableList: result[7] as List?, aNullableMap: result[8] as Map?, nullableNestedList: (result[9] as List?)?.cast?>(), - nullableMapWithAnnotations: (result[10] as Map?)?.cast(), - nullableMapWithObject: (result[11] as Map?)?.cast(), - aNullableEnum: result[12] != null - ? AnEnum.values[result[12]! as int] - : null, + nullableMapWithAnnotations: + (result[10] as Map?)?.cast(), + nullableMapWithObject: + (result[11] as Map?)?.cast(), + aNullableEnum: + result[12] != null ? AnEnum.values[result[12]! as int] : null, aNullableString: result[13] as String?, ); } @@ -194,11 +194,11 @@ class AllNullableTypesWrapper { static AllNullableTypesWrapper decode(Object result) { result as List; return AllNullableTypesWrapper( - values: AllNullableTypes.decode(result[0]! as List) -, + values: AllNullableTypes.decode(result[0]! as List), ); } } + class _HostIntegrationCoreApiCodec extends StandardMessageCodec { const _HostIntegrationCoreApiCodec(); @override @@ -220,19 +220,17 @@ class _HostIntegrationCoreApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return AllNullableTypes.decode(readValue(buffer)!); - - case 129: + + case 129: return AllNullableTypesWrapper.decode(readValue(buffer)!); - - case 130: + + case 130: return AllTypes.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -255,8 +253,7 @@ class HostIntegrationCoreApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.HostIntegrationCoreApi.noop', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -302,7 +299,8 @@ class HostIntegrationCoreApi { } /// Returns the passed object, to test serialization and deserialization. - Future echoAllNullableTypes(AllNullableTypes? arg_everything) async { + Future echoAllNullableTypes( + AllNullableTypes? arg_everything) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.HostIntegrationCoreApi.echoAllNullableTypes', codec, binaryMessenger: _binaryMessenger); @@ -329,8 +327,7 @@ class HostIntegrationCoreApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.HostIntegrationCoreApi.throwError', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -517,9 +514,11 @@ class HostIntegrationCoreApi { /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. - Future extractNestedNullableString(AllNullableTypesWrapper arg_wrapper) async { + Future extractNestedNullableString( + AllNullableTypesWrapper arg_wrapper) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.HostIntegrationCoreApi.extractNestedNullableString', codec, + 'dev.flutter.pigeon.HostIntegrationCoreApi.extractNestedNullableString', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_wrapper]) as List?; @@ -541,9 +540,11 @@ class HostIntegrationCoreApi { /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. - Future createNestedNullableString(String? arg_nullableString) async { + Future createNestedNullableString( + String? arg_nullableString) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.HostIntegrationCoreApi.createNestedNullableString', codec, + 'dev.flutter.pigeon.HostIntegrationCoreApi.createNestedNullableString', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_nullableString]) as List?; @@ -569,12 +570,15 @@ class HostIntegrationCoreApi { } /// Returns passed in arguments of multiple types. - Future sendMultipleNullableTypes(bool? arg_aNullableBool, int? arg_aNullableInt, String? arg_aNullableString) async { + Future sendMultipleNullableTypes(bool? arg_aNullableBool, + int? arg_aNullableInt, String? arg_aNullableString) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.HostIntegrationCoreApi.sendMultipleNullableTypes', codec, + 'dev.flutter.pigeon.HostIntegrationCoreApi.sendMultipleNullableTypes', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aNullableBool, arg_aNullableInt, arg_aNullableString]) as List?; + final List? replyList = await channel.send( + [arg_aNullableBool, arg_aNullableInt, arg_aNullableString]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -689,9 +693,11 @@ class HostIntegrationCoreApi { } /// Returns the passed in Uint8List. - Future echoNullableUint8List(Uint8List? arg_aNullableUint8List) async { + Future echoNullableUint8List( + Uint8List? arg_aNullableUint8List) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableUint8List', codec, + 'dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableUint8List', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_aNullableUint8List]) as List?; @@ -740,8 +746,7 @@ class HostIntegrationCoreApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.HostIntegrationCoreApi.noopAsync', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -790,8 +795,7 @@ class HostIntegrationCoreApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterNoop', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -810,7 +814,8 @@ class HostIntegrationCoreApi { Future callFlutterEchoString(String arg_aString) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoString', codec, + 'dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoString', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_aString]) as List?; @@ -835,6 +840,7 @@ class HostIntegrationCoreApi { } } } + class _FlutterIntegrationCoreApiCodec extends StandardMessageCodec { const _FlutterIntegrationCoreApiCodec(); @override @@ -856,19 +862,17 @@ class _FlutterIntegrationCoreApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return AllNullableTypes.decode(readValue(buffer)!); - - case 129: + + case 129: return AllNullableTypesWrapper.decode(readValue(buffer)!); - - case 130: + + case 130: return AllTypes.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -891,7 +895,8 @@ abstract class FlutterIntegrationCoreApi { /// Returns passed in arguments of multiple types. /// /// Tests multiple-arity FlutterApi handling. - AllNullableTypes sendMultipleNullableTypes(bool? aNullableBool, int? aNullableInt, String? aNullableString); + AllNullableTypes sendMultipleNullableTypes( + bool? aNullableBool, int? aNullableInt, String? aNullableString); /// Returns the passed boolean, to test serialization and deserialization. bool echoBool(bool aBool); @@ -935,7 +940,8 @@ abstract class FlutterIntegrationCoreApi { /// Returns the passed map, to test serialization and deserialization. Map echoNullableMap(Map aMap); - static void setup(FlutterIntegrationCoreApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(FlutterIntegrationCoreApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.FlutterIntegrationCoreApi.noop', codec, @@ -959,10 +965,11 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllTypes was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoAllTypes was null, expected non-null AllTypes.'); + assert(arg_everything != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllTypes was null, expected non-null AllTypes.'); final AllTypes output = api.echoAllTypes(arg_everything!); return output; }); @@ -970,37 +977,43 @@ abstract class FlutterIntegrationCoreApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes', codec, + 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoAllNullableTypes was null, expected non-null AllNullableTypes.'); - final AllNullableTypes output = api.echoAllNullableTypes(arg_everything!); + final AllNullableTypes? arg_everything = + (args[0] as AllNullableTypes?); + assert(arg_everything != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes was null, expected non-null AllNullableTypes.'); + final AllNullableTypes output = + api.echoAllNullableTypes(arg_everything!); return output; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterIntegrationCoreApi.sendMultipleNullableTypes', codec, + 'dev.flutter.pigeon.FlutterIntegrationCoreApi.sendMultipleNullableTypes', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.sendMultipleNullableTypes was null.'); + 'Argument for dev.flutter.pigeon.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); + final AllNullableTypes output = api.sendMultipleNullableTypes( + arg_aNullableBool, arg_aNullableInt, arg_aNullableString); return output; }); } @@ -1014,10 +1027,11 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoBool was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoBool was null, expected non-null bool.'); + assert(arg_aBool != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoBool was null, expected non-null bool.'); final bool output = api.echoBool(arg_aBool!); return output; }); @@ -1032,10 +1046,11 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoInt was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoInt was null, expected non-null int.'); + assert(arg_anInt != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoInt was null, expected non-null int.'); final int output = api.echoInt(arg_anInt!); return output; }); @@ -1050,10 +1065,11 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoDouble was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoDouble was null, expected non-null double.'); + assert(arg_aDouble != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoDouble was null, expected non-null double.'); final double output = api.echoDouble(arg_aDouble!); return output; }); @@ -1068,10 +1084,11 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoString was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoString was null, expected non-null String.'); + assert(arg_aString != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoString was null, expected non-null String.'); final String output = api.echoString(arg_aString!); return output; }); @@ -1086,10 +1103,11 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoUint8List was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoUint8List was null, expected non-null Uint8List.'); + assert(arg_aList != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoUint8List was null, expected non-null Uint8List.'); final Uint8List output = api.echoUint8List(arg_aList!); return output; }); @@ -1104,10 +1122,12 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoList was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoList was null, expected non-null List.'); + final List? arg_aList = + (args[0] as List?)?.cast(); + assert(arg_aList != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoList was null, expected non-null List.'); final List output = api.echoList(arg_aList!); return output; }); @@ -1122,10 +1142,12 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoMap was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoMap was null, expected non-null Map.'); + final Map? arg_aMap = + (args[0] as Map?)?.cast(); + assert(arg_aMap != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoMap was null, expected non-null Map.'); final Map output = api.echoMap(arg_aMap!); return output; }); @@ -1133,14 +1155,15 @@ abstract class FlutterIntegrationCoreApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableBool', codec, + 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableBool', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableBool was null.'); + 'Argument for dev.flutter.pigeon.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); @@ -1157,7 +1180,7 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableInt was null.'); + 'Argument for dev.flutter.pigeon.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); @@ -1167,14 +1190,15 @@ abstract class FlutterIntegrationCoreApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableDouble', codec, + 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableDouble', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableDouble was null.'); + 'Argument for dev.flutter.pigeon.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); @@ -1184,14 +1208,15 @@ abstract class FlutterIntegrationCoreApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableString', codec, + 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableString', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableString was null.'); + 'Argument for dev.flutter.pigeon.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); @@ -1201,14 +1226,15 @@ abstract class FlutterIntegrationCoreApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableUint8List', codec, + 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableUint8List', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableUint8List was null.'); + 'Argument for dev.flutter.pigeon.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); @@ -1218,16 +1244,18 @@ abstract class FlutterIntegrationCoreApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList', codec, + 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList was null.'); + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList was null.'); final List args = (message as List?)!; - final List? arg_aList = (args[0] as List?)?.cast(); + final List? arg_aList = + (args[0] as List?)?.cast(); final List? output = api.echoNullableList(arg_aList); return output; }); @@ -1242,10 +1270,12 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap was null.'); + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap 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.FlutterIntegrationCoreApi.echoNullableMap was null, expected non-null Map.'); + final Map? arg_aMap = + (args[0] as Map?)?.cast(); + assert(arg_aMap != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap was null, expected non-null Map.'); final Map output = api.echoNullableMap(arg_aMap!); return output; }); @@ -1269,8 +1299,7 @@ class HostTrivialApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.HostTrivialApi.noop', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/multiple_arity.gen.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/multiple_arity.gen.dart index 913b97011d9..32325c58162 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/multiple_arity.gen.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/multiple_arity.gen.dart @@ -1,7 +1,7 @@ // 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 (v6.0.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 @@ -55,7 +55,8 @@ abstract class MultipleArityFlutterApi { int subtract(int x, int y); - static void setup(MultipleArityFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(MultipleArityFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.MultipleArityFlutterApi.subtract', codec, @@ -65,12 +66,14 @@ abstract class MultipleArityFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.MultipleArityFlutterApi.subtract was null.'); + 'Argument for dev.flutter.pigeon.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.MultipleArityFlutterApi.subtract was null, expected non-null int.'); + assert(arg_x != null, + 'Argument for dev.flutter.pigeon.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.MultipleArityFlutterApi.subtract was null, expected non-null int.'); + assert(arg_y != null, + 'Argument for dev.flutter.pigeon.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/flutter_null_safe_unit_tests/lib/non_null_fields.gen.dart index 62b21ac1d4e..cf6d1c1f80b 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/non_null_fields.gen.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/non_null_fields.gen.dart @@ -1,7 +1,7 @@ // 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 (v6.0.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 @@ -99,13 +99,12 @@ class NonNullFieldSearchReply { result: result[0]! as String, error: result[1]! as String, indices: (result[2] as List?)!.cast(), - extraData: ExtraData.decode(result[3]! as List) -, - type: ReplyType.values[result[4]! as int] -, + extraData: ExtraData.decode(result[3]! as List), + type: ReplyType.values[result[4]! as int], ); } } + class _NonNullFieldHostApiCodec extends StandardMessageCodec { const _NonNullFieldHostApiCodec(); @override @@ -127,19 +126,17 @@ class _NonNullFieldHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return ExtraData.decode(readValue(buffer)!); - - case 129: + + case 129: return NonNullFieldSearchReply.decode(readValue(buffer)!); - - case 130: + + case 130: return NonNullFieldSearchRequest.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -154,7 +151,8 @@ class NonNullFieldHostApi { static const MessageCodec codec = _NonNullFieldHostApiCodec(); - Future search(NonNullFieldSearchRequest arg_nested) async { + Future search( + NonNullFieldSearchRequest arg_nested) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NonNullFieldHostApi.search', codec, binaryMessenger: _binaryMessenger); @@ -181,6 +179,7 @@ class NonNullFieldHostApi { } } } + class _NonNullFieldFlutterApiCodec extends StandardMessageCodec { const _NonNullFieldFlutterApiCodec(); @override @@ -202,19 +201,17 @@ class _NonNullFieldFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return ExtraData.decode(readValue(buffer)!); - - case 129: + + case 129: return NonNullFieldSearchReply.decode(readValue(buffer)!); - - case 130: + + case 130: return NonNullFieldSearchRequest.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -224,7 +221,8 @@ abstract class NonNullFieldFlutterApi { NonNullFieldSearchReply search(NonNullFieldSearchRequest request); - static void setup(NonNullFieldFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(NonNullFieldFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NonNullFieldFlutterApi.search', codec, @@ -234,10 +232,12 @@ abstract class NonNullFieldFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.NonNullFieldFlutterApi.search was null.'); + 'Argument for dev.flutter.pigeon.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.NonNullFieldFlutterApi.search was null, expected non-null NonNullFieldSearchRequest.'); + final NonNullFieldSearchRequest? arg_request = + (args[0] as NonNullFieldSearchRequest?); + assert(arg_request != null, + 'Argument for dev.flutter.pigeon.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/flutter_null_safe_unit_tests/lib/null_fields.gen.dart index 15c27fafb68..c3720c48a6e 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_fields.gen.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_fields.gen.dart @@ -1,7 +1,7 @@ // 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 (v6.0.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 @@ -87,6 +87,7 @@ class NullFieldsSearchReply { ); } } + class _NullFieldsHostApiCodec extends StandardMessageCodec { const _NullFieldsHostApiCodec(); @override @@ -105,16 +106,14 @@ class _NullFieldsHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NullFieldsSearchReply.decode(readValue(buffer)!); - - case 129: + + case 129: return NullFieldsSearchRequest.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -129,7 +128,8 @@ class NullFieldsHostApi { static const MessageCodec codec = _NullFieldsHostApiCodec(); - Future search(NullFieldsSearchRequest arg_nested) async { + Future search( + NullFieldsSearchRequest arg_nested) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NullFieldsHostApi.search', codec, binaryMessenger: _binaryMessenger); @@ -156,6 +156,7 @@ class NullFieldsHostApi { } } } + class _NullFieldsFlutterApiCodec extends StandardMessageCodec { const _NullFieldsFlutterApiCodec(); @override @@ -174,16 +175,14 @@ class _NullFieldsFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NullFieldsSearchReply.decode(readValue(buffer)!); - - case 129: + + case 129: return NullFieldsSearchRequest.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -193,7 +192,8 @@ abstract class NullFieldsFlutterApi { NullFieldsSearchReply search(NullFieldsSearchRequest request); - static void setup(NullFieldsFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(NullFieldsFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NullFieldsFlutterApi.search', codec, @@ -203,10 +203,12 @@ abstract class NullFieldsFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.NullFieldsFlutterApi.search was null.'); + 'Argument for dev.flutter.pigeon.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.NullFieldsFlutterApi.search was null, expected non-null NullFieldsSearchRequest.'); + final NullFieldsSearchRequest? arg_request = + (args[0] as NullFieldsSearchRequest?); + assert(arg_request != null, + 'Argument for dev.flutter.pigeon.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/null_safe_pigeon.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_safe_pigeon.dart index d477c897380..09af9d96844 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_safe_pigeon.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_safe_pigeon.dart @@ -1,7 +1,7 @@ // 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 (v6.0.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 @@ -100,6 +100,7 @@ class FlutterSearchReplies { ); } } + class _ApiCodec extends StandardMessageCodec { const _ApiCodec(); @override @@ -124,22 +125,20 @@ class _ApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return FlutterSearchReplies.decode(readValue(buffer)!); - - case 129: + + case 129: return FlutterSearchReply.decode(readValue(buffer)!); - - case 130: + + case 130: return FlutterSearchRequest.decode(readValue(buffer)!); - - case 131: + + case 131: return FlutterSearchRequests.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -148,8 +147,7 @@ class Api { /// Constructor for [Api]. 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. - Api({BinaryMessenger? binaryMessenger}) - : _binaryMessenger = binaryMessenger; + Api({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _ApiCodec(); @@ -181,7 +179,8 @@ class Api { } } - Future doSearches(FlutterSearchRequests arg_request) async { + Future doSearches( + FlutterSearchRequests arg_request) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.Api.doSearches', codec, binaryMessenger: _binaryMessenger); diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/nullable_returns.gen.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/nullable_returns.gen.dart index 1f0574faf2f..f02f793ef8b 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/nullable_returns.gen.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/nullable_returns.gen.dart @@ -1,7 +1,7 @@ // 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 (v6.0.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 @@ -26,8 +26,7 @@ class NullableReturnHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NullableReturnHostApi.doit', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -50,7 +49,8 @@ abstract class NullableReturnFlutterApi { int? doit(); - static void setup(NullableReturnFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(NullableReturnFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NullableReturnFlutterApi.doit', codec, @@ -111,7 +111,8 @@ abstract class NullableArgFlutterApi { int doit(int? x); - static void setup(NullableArgFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(NullableArgFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NullableArgFlutterApi.doit', codec, @@ -121,7 +122,7 @@ abstract class NullableArgFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.NullableArgFlutterApi.doit was null.'); + 'Argument for dev.flutter.pigeon.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); @@ -146,8 +147,7 @@ class NullableCollectionReturnHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NullableCollectionReturnHostApi.doit', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -170,7 +170,8 @@ abstract class NullableCollectionReturnFlutterApi { List? doit(); - static void setup(NullableCollectionReturnFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(NullableCollectionReturnFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NullableCollectionReturnFlutterApi.doit', codec, @@ -231,7 +232,8 @@ abstract class NullableCollectionArgFlutterApi { List doit(List? x); - static void setup(NullableCollectionArgFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(NullableCollectionArgFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NullableCollectionArgFlutterApi.doit', codec, @@ -241,9 +243,10 @@ abstract class NullableCollectionArgFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.NullableCollectionArgFlutterApi.doit was null.'); + 'Argument for dev.flutter.pigeon.NullableCollectionArgFlutterApi.doit was null.'); final List args = (message as List?)!; - final List? arg_x = (args[0] as List?)?.cast(); + final List? arg_x = + (args[0] as List?)?.cast(); final List output = api.doit(arg_x); return output; }); diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.dart index 3ff03d79f7c..e7e9dc0527c 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.dart @@ -1,7 +1,7 @@ // 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 (v6.0.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 @@ -287,7 +287,8 @@ abstract class PrimitiveFlutterApi { Map aStringIntMap(Map value); - static void setup(PrimitiveFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(PrimitiveFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PrimitiveFlutterApi.anInt', codec, @@ -297,10 +298,11 @@ abstract class PrimitiveFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PrimitiveFlutterApi.anInt was null.'); + 'Argument for dev.flutter.pigeon.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.PrimitiveFlutterApi.anInt was null, expected non-null int.'); + assert(arg_value != null, + 'Argument for dev.flutter.pigeon.PrimitiveFlutterApi.anInt was null, expected non-null int.'); final int output = api.anInt(arg_value!); return output; }); @@ -315,10 +317,11 @@ abstract class PrimitiveFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PrimitiveFlutterApi.aBool was null.'); + 'Argument for dev.flutter.pigeon.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.PrimitiveFlutterApi.aBool was null, expected non-null bool.'); + assert(arg_value != null, + 'Argument for dev.flutter.pigeon.PrimitiveFlutterApi.aBool was null, expected non-null bool.'); final bool output = api.aBool(arg_value!); return output; }); @@ -333,10 +336,11 @@ abstract class PrimitiveFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PrimitiveFlutterApi.aString was null.'); + 'Argument for dev.flutter.pigeon.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.PrimitiveFlutterApi.aString was null, expected non-null String.'); + assert(arg_value != null, + 'Argument for dev.flutter.pigeon.PrimitiveFlutterApi.aString was null, expected non-null String.'); final String output = api.aString(arg_value!); return output; }); @@ -351,10 +355,11 @@ abstract class PrimitiveFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PrimitiveFlutterApi.aDouble was null.'); + 'Argument for dev.flutter.pigeon.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.PrimitiveFlutterApi.aDouble was null, expected non-null double.'); + assert(arg_value != null, + 'Argument for dev.flutter.pigeon.PrimitiveFlutterApi.aDouble was null, expected non-null double.'); final double output = api.aDouble(arg_value!); return output; }); @@ -369,10 +374,12 @@ abstract class PrimitiveFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PrimitiveFlutterApi.aMap was null.'); + 'Argument for dev.flutter.pigeon.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.PrimitiveFlutterApi.aMap was null, expected non-null Map.'); + final Map? arg_value = + (args[0] as Map?); + assert(arg_value != null, + 'Argument for dev.flutter.pigeon.PrimitiveFlutterApi.aMap was null, expected non-null Map.'); final Map output = api.aMap(arg_value!); return output; }); @@ -387,10 +394,11 @@ abstract class PrimitiveFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PrimitiveFlutterApi.aList was null.'); + 'Argument for dev.flutter.pigeon.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.PrimitiveFlutterApi.aList was null, expected non-null List.'); + assert(arg_value != null, + 'Argument for dev.flutter.pigeon.PrimitiveFlutterApi.aList was null, expected non-null List.'); final List output = api.aList(arg_value!); return output; }); @@ -405,10 +413,11 @@ abstract class PrimitiveFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PrimitiveFlutterApi.anInt32List was null.'); + 'Argument for dev.flutter.pigeon.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.PrimitiveFlutterApi.anInt32List was null, expected non-null Int32List.'); + assert(arg_value != null, + 'Argument for dev.flutter.pigeon.PrimitiveFlutterApi.anInt32List was null, expected non-null Int32List.'); final Int32List output = api.anInt32List(arg_value!); return output; }); @@ -423,10 +432,12 @@ abstract class PrimitiveFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PrimitiveFlutterApi.aBoolList was null.'); + 'Argument for dev.flutter.pigeon.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.PrimitiveFlutterApi.aBoolList was null, expected non-null List.'); + final List? arg_value = + (args[0] as List?)?.cast(); + assert(arg_value != null, + 'Argument for dev.flutter.pigeon.PrimitiveFlutterApi.aBoolList was null, expected non-null List.'); final List output = api.aBoolList(arg_value!); return output; }); @@ -441,10 +452,12 @@ abstract class PrimitiveFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PrimitiveFlutterApi.aStringIntMap was null.'); + 'Argument for dev.flutter.pigeon.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.PrimitiveFlutterApi.aStringIntMap was null, expected non-null Map.'); + final Map? arg_value = + (args[0] as Map?)?.cast(); + assert(arg_value != null, + 'Argument for dev.flutter.pigeon.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/lib/src/generated/core_tests.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart index bf6e201a31b..213aa4855e9 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart @@ -1,7 +1,7 @@ // 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 (v6.0.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 @@ -83,8 +83,7 @@ class AllTypes { aFloatArray: result[6]! as Float64List, aList: result[7]! as List, aMap: result[8]! as Map, - anEnum: AnEnum.values[result[9]! as int] -, + anEnum: AnEnum.values[result[9]! as int], aString: result[10]! as String, ); } @@ -168,11 +167,12 @@ class AllNullableTypes { aNullableList: result[7] as List?, aNullableMap: result[8] as Map?, nullableNestedList: (result[9] as List?)?.cast?>(), - nullableMapWithAnnotations: (result[10] as Map?)?.cast(), - nullableMapWithObject: (result[11] as Map?)?.cast(), - aNullableEnum: result[12] != null - ? AnEnum.values[result[12]! as int] - : null, + nullableMapWithAnnotations: + (result[10] as Map?)?.cast(), + nullableMapWithObject: + (result[11] as Map?)?.cast(), + aNullableEnum: + result[12] != null ? AnEnum.values[result[12]! as int] : null, aNullableString: result[13] as String?, ); } @@ -194,11 +194,11 @@ class AllNullableTypesWrapper { static AllNullableTypesWrapper decode(Object result) { result as List; return AllNullableTypesWrapper( - values: AllNullableTypes.decode(result[0]! as List) -, + values: AllNullableTypes.decode(result[0]! as List), ); } } + class _HostIntegrationCoreApiCodec extends StandardMessageCodec { const _HostIntegrationCoreApiCodec(); @override @@ -220,19 +220,17 @@ class _HostIntegrationCoreApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return AllNullableTypes.decode(readValue(buffer)!); - - case 129: + + case 129: return AllNullableTypesWrapper.decode(readValue(buffer)!); - - case 130: + + case 130: return AllTypes.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -255,8 +253,7 @@ class HostIntegrationCoreApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.HostIntegrationCoreApi.noop', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -302,7 +299,8 @@ class HostIntegrationCoreApi { } /// Returns the passed object, to test serialization and deserialization. - Future echoAllNullableTypes(AllNullableTypes? arg_everything) async { + Future echoAllNullableTypes( + AllNullableTypes? arg_everything) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.HostIntegrationCoreApi.echoAllNullableTypes', codec, binaryMessenger: _binaryMessenger); @@ -329,8 +327,7 @@ class HostIntegrationCoreApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.HostIntegrationCoreApi.throwError', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -517,9 +514,11 @@ class HostIntegrationCoreApi { /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. - Future extractNestedNullableString(AllNullableTypesWrapper arg_wrapper) async { + Future extractNestedNullableString( + AllNullableTypesWrapper arg_wrapper) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.HostIntegrationCoreApi.extractNestedNullableString', codec, + 'dev.flutter.pigeon.HostIntegrationCoreApi.extractNestedNullableString', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_wrapper]) as List?; @@ -541,9 +540,11 @@ class HostIntegrationCoreApi { /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. - Future createNestedNullableString(String? arg_nullableString) async { + Future createNestedNullableString( + String? arg_nullableString) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.HostIntegrationCoreApi.createNestedNullableString', codec, + 'dev.flutter.pigeon.HostIntegrationCoreApi.createNestedNullableString', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_nullableString]) as List?; @@ -569,12 +570,15 @@ class HostIntegrationCoreApi { } /// Returns passed in arguments of multiple types. - Future sendMultipleNullableTypes(bool? arg_aNullableBool, int? arg_aNullableInt, String? arg_aNullableString) async { + Future sendMultipleNullableTypes(bool? arg_aNullableBool, + int? arg_aNullableInt, String? arg_aNullableString) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.HostIntegrationCoreApi.sendMultipleNullableTypes', codec, + 'dev.flutter.pigeon.HostIntegrationCoreApi.sendMultipleNullableTypes', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aNullableBool, arg_aNullableInt, arg_aNullableString]) as List?; + final List? replyList = await channel.send( + [arg_aNullableBool, arg_aNullableInt, arg_aNullableString]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -689,9 +693,11 @@ class HostIntegrationCoreApi { } /// Returns the passed in Uint8List. - Future echoNullableUint8List(Uint8List? arg_aNullableUint8List) async { + Future echoNullableUint8List( + Uint8List? arg_aNullableUint8List) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableUint8List', codec, + 'dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableUint8List', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_aNullableUint8List]) as List?; @@ -740,8 +746,7 @@ class HostIntegrationCoreApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.HostIntegrationCoreApi.noopAsync', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -790,8 +795,7 @@ class HostIntegrationCoreApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterNoop', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -810,7 +814,8 @@ class HostIntegrationCoreApi { Future callFlutterEchoString(String arg_aString) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoString', codec, + 'dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoString', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_aString]) as List?; @@ -835,6 +840,7 @@ class HostIntegrationCoreApi { } } } + class _FlutterIntegrationCoreApiCodec extends StandardMessageCodec { const _FlutterIntegrationCoreApiCodec(); @override @@ -856,19 +862,17 @@ class _FlutterIntegrationCoreApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return AllNullableTypes.decode(readValue(buffer)!); - - case 129: + + case 129: return AllNullableTypesWrapper.decode(readValue(buffer)!); - - case 130: + + case 130: return AllTypes.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -891,7 +895,8 @@ abstract class FlutterIntegrationCoreApi { /// Returns passed in arguments of multiple types. /// /// Tests multiple-arity FlutterApi handling. - AllNullableTypes sendMultipleNullableTypes(bool? aNullableBool, int? aNullableInt, String? aNullableString); + AllNullableTypes sendMultipleNullableTypes( + bool? aNullableBool, int? aNullableInt, String? aNullableString); /// Returns the passed boolean, to test serialization and deserialization. bool echoBool(bool aBool); @@ -935,7 +940,8 @@ abstract class FlutterIntegrationCoreApi { /// Returns the passed map, to test serialization and deserialization. Map echoNullableMap(Map aMap); - static void setup(FlutterIntegrationCoreApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(FlutterIntegrationCoreApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.FlutterIntegrationCoreApi.noop', codec, @@ -959,10 +965,11 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllTypes was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoAllTypes was null, expected non-null AllTypes.'); + assert(arg_everything != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllTypes was null, expected non-null AllTypes.'); final AllTypes output = api.echoAllTypes(arg_everything!); return output; }); @@ -970,37 +977,43 @@ abstract class FlutterIntegrationCoreApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes', codec, + 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoAllNullableTypes was null, expected non-null AllNullableTypes.'); - final AllNullableTypes output = api.echoAllNullableTypes(arg_everything!); + final AllNullableTypes? arg_everything = + (args[0] as AllNullableTypes?); + assert(arg_everything != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes was null, expected non-null AllNullableTypes.'); + final AllNullableTypes output = + api.echoAllNullableTypes(arg_everything!); return output; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterIntegrationCoreApi.sendMultipleNullableTypes', codec, + 'dev.flutter.pigeon.FlutterIntegrationCoreApi.sendMultipleNullableTypes', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.sendMultipleNullableTypes was null.'); + 'Argument for dev.flutter.pigeon.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); + final AllNullableTypes output = api.sendMultipleNullableTypes( + arg_aNullableBool, arg_aNullableInt, arg_aNullableString); return output; }); } @@ -1014,10 +1027,11 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoBool was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoBool was null, expected non-null bool.'); + assert(arg_aBool != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoBool was null, expected non-null bool.'); final bool output = api.echoBool(arg_aBool!); return output; }); @@ -1032,10 +1046,11 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoInt was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoInt was null, expected non-null int.'); + assert(arg_anInt != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoInt was null, expected non-null int.'); final int output = api.echoInt(arg_anInt!); return output; }); @@ -1050,10 +1065,11 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoDouble was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoDouble was null, expected non-null double.'); + assert(arg_aDouble != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoDouble was null, expected non-null double.'); final double output = api.echoDouble(arg_aDouble!); return output; }); @@ -1068,10 +1084,11 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoString was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoString was null, expected non-null String.'); + assert(arg_aString != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoString was null, expected non-null String.'); final String output = api.echoString(arg_aString!); return output; }); @@ -1086,10 +1103,11 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoUint8List was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoUint8List was null, expected non-null Uint8List.'); + assert(arg_aList != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoUint8List was null, expected non-null Uint8List.'); final Uint8List output = api.echoUint8List(arg_aList!); return output; }); @@ -1104,10 +1122,12 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoList was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoList was null, expected non-null List.'); + final List? arg_aList = + (args[0] as List?)?.cast(); + assert(arg_aList != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoList was null, expected non-null List.'); final List output = api.echoList(arg_aList!); return output; }); @@ -1122,10 +1142,12 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoMap was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoMap was null, expected non-null Map.'); + final Map? arg_aMap = + (args[0] as Map?)?.cast(); + assert(arg_aMap != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoMap was null, expected non-null Map.'); final Map output = api.echoMap(arg_aMap!); return output; }); @@ -1133,14 +1155,15 @@ abstract class FlutterIntegrationCoreApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableBool', codec, + 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableBool', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableBool was null.'); + 'Argument for dev.flutter.pigeon.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); @@ -1157,7 +1180,7 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableInt was null.'); + 'Argument for dev.flutter.pigeon.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); @@ -1167,14 +1190,15 @@ abstract class FlutterIntegrationCoreApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableDouble', codec, + 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableDouble', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableDouble was null.'); + 'Argument for dev.flutter.pigeon.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); @@ -1184,14 +1208,15 @@ abstract class FlutterIntegrationCoreApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableString', codec, + 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableString', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableString was null.'); + 'Argument for dev.flutter.pigeon.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); @@ -1201,14 +1226,15 @@ abstract class FlutterIntegrationCoreApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableUint8List', codec, + 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableUint8List', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableUint8List was null.'); + 'Argument for dev.flutter.pigeon.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); @@ -1218,16 +1244,18 @@ abstract class FlutterIntegrationCoreApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList', codec, + 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList was null.'); + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList was null.'); final List args = (message as List?)!; - final List? arg_aList = (args[0] as List?)?.cast(); + final List? arg_aList = + (args[0] as List?)?.cast(); final List? output = api.echoNullableList(arg_aList); return output; }); @@ -1242,10 +1270,12 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap was null.'); + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap 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.FlutterIntegrationCoreApi.echoNullableMap was null, expected non-null Map.'); + final Map? arg_aMap = + (args[0] as Map?)?.cast(); + assert(arg_aMap != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap was null, expected non-null Map.'); final Map output = api.echoNullableMap(arg_aMap!); return output; }); @@ -1269,8 +1299,7 @@ class HostTrivialApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.HostTrivialApi.noop', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', diff --git a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp index 6884ffcc7a4..98d83ea4bbf 100644 --- a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp +++ b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp @@ -1,7 +1,7 @@ // 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 (v6.0.4), do not edit directly. // See also: https://pub.dev/packages/pigeon @@ -31,43 +31,65 @@ void AllTypes::set_an_int(int64_t value_arg) { an_int_ = value_arg; } double AllTypes::a_double() const { return a_double_; } void AllTypes::set_a_double(double value_arg) { a_double_ = value_arg; } -const std::vector& AllTypes::a_byte_array() const { return a_byte_array_; } -void AllTypes::set_a_byte_array(const std::vector& value_arg) { a_byte_array_ = value_arg; } +const std::vector& AllTypes::a_byte_array() const { + return a_byte_array_; +} +void AllTypes::set_a_byte_array(const std::vector& value_arg) { + a_byte_array_ = value_arg; +} -const std::vector& AllTypes::a4_byte_array() const { return a4_byte_array_; } -void AllTypes::set_a4_byte_array(const std::vector& value_arg) { a4_byte_array_ = value_arg; } +const std::vector& AllTypes::a4_byte_array() const { + return a4_byte_array_; +} +void AllTypes::set_a4_byte_array(const std::vector& value_arg) { + a4_byte_array_ = value_arg; +} -const std::vector& AllTypes::a8_byte_array() const { return a8_byte_array_; } -void AllTypes::set_a8_byte_array(const std::vector& value_arg) { a8_byte_array_ = value_arg; } +const std::vector& AllTypes::a8_byte_array() const { + return a8_byte_array_; +} +void AllTypes::set_a8_byte_array(const std::vector& value_arg) { + a8_byte_array_ = value_arg; +} -const std::vector& AllTypes::a_float_array() const { return a_float_array_; } -void AllTypes::set_a_float_array(const std::vector& value_arg) { a_float_array_ = value_arg; } +const std::vector& AllTypes::a_float_array() const { + return a_float_array_; +} +void AllTypes::set_a_float_array(const std::vector& value_arg) { + a_float_array_ = value_arg; +} const flutter::EncodableList& AllTypes::a_list() const { return a_list_; } -void AllTypes::set_a_list(const flutter::EncodableList& value_arg) { a_list_ = value_arg; } +void AllTypes::set_a_list(const flutter::EncodableList& value_arg) { + a_list_ = value_arg; +} const flutter::EncodableMap& AllTypes::a_map() const { return a_map_; } -void AllTypes::set_a_map(const flutter::EncodableMap& value_arg) { a_map_ = value_arg; } +void AllTypes::set_a_map(const flutter::EncodableMap& value_arg) { + a_map_ = value_arg; +} const AnEnum& AllTypes::an_enum() const { return an_enum_; } void AllTypes::set_an_enum(const AnEnum& value_arg) { an_enum_ = value_arg; } const std::string& AllTypes::a_string() const { return a_string_; } -void AllTypes::set_a_string(std::string_view value_arg) { a_string_ = value_arg; } +void AllTypes::set_a_string(std::string_view value_arg) { + a_string_ = value_arg; +} flutter::EncodableList AllTypes::ToEncodableList() const { -return flutter::EncodableList{ - flutter::EncodableValue(a_bool_), - flutter::EncodableValue(an_int_), - flutter::EncodableValue(a_double_), - flutter::EncodableValue(a_byte_array_), - flutter::EncodableValue(a4_byte_array_), - flutter::EncodableValue(a8_byte_array_), - flutter::EncodableValue(a_float_array_), - flutter::EncodableValue(a_list_), - flutter::EncodableValue(a_map_), - flutter::EncodableValue((int)an_enum_), - flutter::EncodableValue(a_string_), + return flutter::EncodableList{ + flutter::EncodableValue(a_bool_), + flutter::EncodableValue(an_int_), + flutter::EncodableValue(a_double_), + flutter::EncodableValue(a_byte_array_), + flutter::EncodableValue(a4_byte_array_), + flutter::EncodableValue(a8_byte_array_), + flutter::EncodableValue(a_float_array_), + flutter::EncodableValue(a_list_), + flutter::EncodableValue(a_map_), + flutter::EncodableValue((int)an_enum_), + flutter::EncodableValue(a_string_), }; } @@ -81,119 +103,273 @@ AllTypes::AllTypes(const flutter::EncodableList& list) { auto& encodable_an_int = list[1]; if (const int32_t* pointer_an_int = std::get_if(&encodable_an_int)) an_int_ = *pointer_an_int; - else if (const int64_t* pointer_an_int_64 = std::get_if(&encodable_an_int)) + else if (const int64_t* pointer_an_int_64 = + std::get_if(&encodable_an_int)) an_int_ = *pointer_an_int_64; auto& encodable_a_double = list[2]; - if (const double* pointer_a_double = std::get_if(&encodable_a_double)) { + if (const double* pointer_a_double = + std::get_if(&encodable_a_double)) { a_double_ = *pointer_a_double; } auto& encodable_a_byte_array = list[3]; - if (const std::vector* pointer_a_byte_array = std::get_if>(&encodable_a_byte_array)) { + if (const std::vector* pointer_a_byte_array = + std::get_if>(&encodable_a_byte_array)) { a_byte_array_ = *pointer_a_byte_array; } auto& encodable_a4_byte_array = list[4]; - if (const std::vector* pointer_a4_byte_array = std::get_if>(&encodable_a4_byte_array)) { + if (const std::vector* pointer_a4_byte_array = + std::get_if>(&encodable_a4_byte_array)) { a4_byte_array_ = *pointer_a4_byte_array; } auto& encodable_a8_byte_array = list[5]; - if (const std::vector* pointer_a8_byte_array = std::get_if>(&encodable_a8_byte_array)) { + if (const std::vector* pointer_a8_byte_array = + std::get_if>(&encodable_a8_byte_array)) { a8_byte_array_ = *pointer_a8_byte_array; } auto& encodable_a_float_array = list[6]; - if (const std::vector* pointer_a_float_array = std::get_if>(&encodable_a_float_array)) { + if (const std::vector* pointer_a_float_array = + std::get_if>(&encodable_a_float_array)) { a_float_array_ = *pointer_a_float_array; } auto& encodable_a_list = list[7]; - if (const flutter::EncodableList* pointer_a_list = std::get_if(&encodable_a_list)) { + if (const flutter::EncodableList* pointer_a_list = + std::get_if(&encodable_a_list)) { a_list_ = *pointer_a_list; } auto& encodable_a_map = list[8]; - if (const flutter::EncodableMap* pointer_a_map = std::get_if(&encodable_a_map)) { + if (const flutter::EncodableMap* pointer_a_map = + std::get_if(&encodable_a_map)) { a_map_ = *pointer_a_map; } auto& encodable_an_enum = list[9]; - if (const int32_t* pointer_an_enum = std::get_if(&encodable_an_enum)) an_enum_ = (AnEnum)*pointer_an_enum; + if (const int32_t* pointer_an_enum = std::get_if(&encodable_an_enum)) + an_enum_ = (AnEnum)*pointer_an_enum; auto& encodable_a_string = list[10]; - if (const std::string* pointer_a_string = std::get_if(&encodable_a_string)) { + if (const std::string* pointer_a_string = + std::get_if(&encodable_a_string)) { a_string_ = *pointer_a_string; } } - // AllNullableTypes -const bool* AllNullableTypes::a_nullable_bool() const { return a_nullable_bool_ ? &(*a_nullable_bool_) : nullptr; } -void AllNullableTypes::set_a_nullable_bool(const bool* value_arg) { a_nullable_bool_ = value_arg ? std::optional(*value_arg) : std::nullopt; } -void AllNullableTypes::set_a_nullable_bool(bool value_arg) { a_nullable_bool_ = value_arg; } +const bool* AllNullableTypes::a_nullable_bool() const { + return a_nullable_bool_ ? &(*a_nullable_bool_) : nullptr; +} +void AllNullableTypes::set_a_nullable_bool(const bool* value_arg) { + a_nullable_bool_ = value_arg ? std::optional(*value_arg) : std::nullopt; +} +void AllNullableTypes::set_a_nullable_bool(bool value_arg) { + a_nullable_bool_ = value_arg; +} -const int64_t* AllNullableTypes::a_nullable_int() const { return a_nullable_int_ ? &(*a_nullable_int_) : nullptr; } -void AllNullableTypes::set_a_nullable_int(const int64_t* value_arg) { a_nullable_int_ = value_arg ? std::optional(*value_arg) : std::nullopt; } -void AllNullableTypes::set_a_nullable_int(int64_t value_arg) { a_nullable_int_ = value_arg; } +const int64_t* AllNullableTypes::a_nullable_int() const { + return a_nullable_int_ ? &(*a_nullable_int_) : nullptr; +} +void AllNullableTypes::set_a_nullable_int(const int64_t* value_arg) { + a_nullable_int_ = + value_arg ? std::optional(*value_arg) : std::nullopt; +} +void AllNullableTypes::set_a_nullable_int(int64_t value_arg) { + a_nullable_int_ = value_arg; +} -const double* AllNullableTypes::a_nullable_double() const { return a_nullable_double_ ? &(*a_nullable_double_) : nullptr; } -void AllNullableTypes::set_a_nullable_double(const double* value_arg) { a_nullable_double_ = value_arg ? std::optional(*value_arg) : std::nullopt; } -void AllNullableTypes::set_a_nullable_double(double value_arg) { a_nullable_double_ = value_arg; } +const double* AllNullableTypes::a_nullable_double() const { + return a_nullable_double_ ? &(*a_nullable_double_) : nullptr; +} +void AllNullableTypes::set_a_nullable_double(const double* value_arg) { + a_nullable_double_ = + value_arg ? std::optional(*value_arg) : std::nullopt; +} +void AllNullableTypes::set_a_nullable_double(double value_arg) { + a_nullable_double_ = value_arg; +} -const std::vector* AllNullableTypes::a_nullable_byte_array() const { return a_nullable_byte_array_ ? &(*a_nullable_byte_array_) : nullptr; } -void AllNullableTypes::set_a_nullable_byte_array(const std::vector* value_arg) { a_nullable_byte_array_ = value_arg ? std::optional>(*value_arg) : std::nullopt; } -void AllNullableTypes::set_a_nullable_byte_array(const std::vector& value_arg) { a_nullable_byte_array_ = value_arg; } +const std::vector* AllNullableTypes::a_nullable_byte_array() const { + return a_nullable_byte_array_ ? &(*a_nullable_byte_array_) : nullptr; +} +void AllNullableTypes::set_a_nullable_byte_array( + const std::vector* value_arg) { + a_nullable_byte_array_ = value_arg + ? std::optional>(*value_arg) + : std::nullopt; +} +void AllNullableTypes::set_a_nullable_byte_array( + const std::vector& value_arg) { + a_nullable_byte_array_ = value_arg; +} -const std::vector* AllNullableTypes::a_nullable4_byte_array() const { return a_nullable4_byte_array_ ? &(*a_nullable4_byte_array_) : nullptr; } -void AllNullableTypes::set_a_nullable4_byte_array(const std::vector* value_arg) { a_nullable4_byte_array_ = value_arg ? std::optional>(*value_arg) : std::nullopt; } -void AllNullableTypes::set_a_nullable4_byte_array(const std::vector& value_arg) { a_nullable4_byte_array_ = value_arg; } +const std::vector* AllNullableTypes::a_nullable4_byte_array() const { + return a_nullable4_byte_array_ ? &(*a_nullable4_byte_array_) : nullptr; +} +void AllNullableTypes::set_a_nullable4_byte_array( + const std::vector* value_arg) { + a_nullable4_byte_array_ = + value_arg ? std::optional>(*value_arg) + : std::nullopt; +} +void AllNullableTypes::set_a_nullable4_byte_array( + const std::vector& value_arg) { + a_nullable4_byte_array_ = value_arg; +} -const std::vector* AllNullableTypes::a_nullable8_byte_array() const { return a_nullable8_byte_array_ ? &(*a_nullable8_byte_array_) : nullptr; } -void AllNullableTypes::set_a_nullable8_byte_array(const std::vector* value_arg) { a_nullable8_byte_array_ = value_arg ? std::optional>(*value_arg) : std::nullopt; } -void AllNullableTypes::set_a_nullable8_byte_array(const std::vector& value_arg) { a_nullable8_byte_array_ = value_arg; } +const std::vector* AllNullableTypes::a_nullable8_byte_array() const { + return a_nullable8_byte_array_ ? &(*a_nullable8_byte_array_) : nullptr; +} +void AllNullableTypes::set_a_nullable8_byte_array( + const std::vector* value_arg) { + a_nullable8_byte_array_ = + value_arg ? std::optional>(*value_arg) + : std::nullopt; +} +void AllNullableTypes::set_a_nullable8_byte_array( + const std::vector& value_arg) { + a_nullable8_byte_array_ = value_arg; +} -const std::vector* AllNullableTypes::a_nullable_float_array() const { return a_nullable_float_array_ ? &(*a_nullable_float_array_) : nullptr; } -void AllNullableTypes::set_a_nullable_float_array(const std::vector* value_arg) { a_nullable_float_array_ = value_arg ? std::optional>(*value_arg) : std::nullopt; } -void AllNullableTypes::set_a_nullable_float_array(const std::vector& value_arg) { a_nullable_float_array_ = value_arg; } +const std::vector* AllNullableTypes::a_nullable_float_array() const { + return a_nullable_float_array_ ? &(*a_nullable_float_array_) : nullptr; +} +void AllNullableTypes::set_a_nullable_float_array( + const std::vector* value_arg) { + a_nullable_float_array_ = + value_arg ? std::optional>(*value_arg) : std::nullopt; +} +void AllNullableTypes::set_a_nullable_float_array( + const std::vector& value_arg) { + a_nullable_float_array_ = value_arg; +} -const flutter::EncodableList* AllNullableTypes::a_nullable_list() const { return a_nullable_list_ ? &(*a_nullable_list_) : nullptr; } -void AllNullableTypes::set_a_nullable_list(const flutter::EncodableList* value_arg) { a_nullable_list_ = value_arg ? std::optional(*value_arg) : std::nullopt; } -void AllNullableTypes::set_a_nullable_list(const flutter::EncodableList& value_arg) { a_nullable_list_ = value_arg; } +const flutter::EncodableList* AllNullableTypes::a_nullable_list() const { + return a_nullable_list_ ? &(*a_nullable_list_) : nullptr; +} +void AllNullableTypes::set_a_nullable_list( + const flutter::EncodableList* value_arg) { + a_nullable_list_ = value_arg + ? std::optional(*value_arg) + : std::nullopt; +} +void AllNullableTypes::set_a_nullable_list( + const flutter::EncodableList& value_arg) { + a_nullable_list_ = value_arg; +} -const flutter::EncodableMap* AllNullableTypes::a_nullable_map() const { return a_nullable_map_ ? &(*a_nullable_map_) : nullptr; } -void AllNullableTypes::set_a_nullable_map(const flutter::EncodableMap* value_arg) { a_nullable_map_ = value_arg ? std::optional(*value_arg) : std::nullopt; } -void AllNullableTypes::set_a_nullable_map(const flutter::EncodableMap& value_arg) { a_nullable_map_ = value_arg; } +const flutter::EncodableMap* AllNullableTypes::a_nullable_map() const { + return a_nullable_map_ ? &(*a_nullable_map_) : nullptr; +} +void AllNullableTypes::set_a_nullable_map( + const flutter::EncodableMap* value_arg) { + a_nullable_map_ = value_arg ? std::optional(*value_arg) + : std::nullopt; +} +void AllNullableTypes::set_a_nullable_map( + const flutter::EncodableMap& value_arg) { + a_nullable_map_ = value_arg; +} -const flutter::EncodableList* AllNullableTypes::nullable_nested_list() const { return nullable_nested_list_ ? &(*nullable_nested_list_) : nullptr; } -void AllNullableTypes::set_nullable_nested_list(const flutter::EncodableList* value_arg) { nullable_nested_list_ = value_arg ? std::optional(*value_arg) : std::nullopt; } -void AllNullableTypes::set_nullable_nested_list(const flutter::EncodableList& value_arg) { nullable_nested_list_ = value_arg; } +const flutter::EncodableList* AllNullableTypes::nullable_nested_list() const { + return nullable_nested_list_ ? &(*nullable_nested_list_) : nullptr; +} +void AllNullableTypes::set_nullable_nested_list( + const flutter::EncodableList* value_arg) { + nullable_nested_list_ = + value_arg ? std::optional(*value_arg) + : std::nullopt; +} +void AllNullableTypes::set_nullable_nested_list( + const flutter::EncodableList& value_arg) { + nullable_nested_list_ = value_arg; +} -const flutter::EncodableMap* AllNullableTypes::nullable_map_with_annotations() const { return nullable_map_with_annotations_ ? &(*nullable_map_with_annotations_) : nullptr; } -void AllNullableTypes::set_nullable_map_with_annotations(const flutter::EncodableMap* value_arg) { nullable_map_with_annotations_ = value_arg ? std::optional(*value_arg) : std::nullopt; } -void AllNullableTypes::set_nullable_map_with_annotations(const flutter::EncodableMap& value_arg) { nullable_map_with_annotations_ = value_arg; } +const flutter::EncodableMap* AllNullableTypes::nullable_map_with_annotations() + const { + return nullable_map_with_annotations_ ? &(*nullable_map_with_annotations_) + : nullptr; +} +void AllNullableTypes::set_nullable_map_with_annotations( + const flutter::EncodableMap* value_arg) { + nullable_map_with_annotations_ = + value_arg ? std::optional(*value_arg) + : std::nullopt; +} +void AllNullableTypes::set_nullable_map_with_annotations( + const flutter::EncodableMap& value_arg) { + nullable_map_with_annotations_ = value_arg; +} -const flutter::EncodableMap* AllNullableTypes::nullable_map_with_object() const { return nullable_map_with_object_ ? &(*nullable_map_with_object_) : nullptr; } -void AllNullableTypes::set_nullable_map_with_object(const flutter::EncodableMap* value_arg) { nullable_map_with_object_ = value_arg ? std::optional(*value_arg) : std::nullopt; } -void AllNullableTypes::set_nullable_map_with_object(const flutter::EncodableMap& value_arg) { nullable_map_with_object_ = value_arg; } +const flutter::EncodableMap* AllNullableTypes::nullable_map_with_object() + const { + return nullable_map_with_object_ ? &(*nullable_map_with_object_) : nullptr; +} +void AllNullableTypes::set_nullable_map_with_object( + const flutter::EncodableMap* value_arg) { + nullable_map_with_object_ = + value_arg ? std::optional(*value_arg) + : std::nullopt; +} +void AllNullableTypes::set_nullable_map_with_object( + const flutter::EncodableMap& value_arg) { + nullable_map_with_object_ = value_arg; +} -const AnEnum* AllNullableTypes::a_nullable_enum() const { return a_nullable_enum_ ? &(*a_nullable_enum_) : nullptr; } -void AllNullableTypes::set_a_nullable_enum(const AnEnum* value_arg) { a_nullable_enum_ = value_arg ? std::optional(*value_arg) : std::nullopt; } -void AllNullableTypes::set_a_nullable_enum(const AnEnum& value_arg) { a_nullable_enum_ = value_arg; } +const AnEnum* AllNullableTypes::a_nullable_enum() const { + return a_nullable_enum_ ? &(*a_nullable_enum_) : nullptr; +} +void AllNullableTypes::set_a_nullable_enum(const AnEnum* value_arg) { + a_nullable_enum_ = + value_arg ? std::optional(*value_arg) : std::nullopt; +} +void AllNullableTypes::set_a_nullable_enum(const AnEnum& value_arg) { + a_nullable_enum_ = value_arg; +} -const std::string* AllNullableTypes::a_nullable_string() const { return a_nullable_string_ ? &(*a_nullable_string_) : nullptr; } -void AllNullableTypes::set_a_nullable_string(const std::string_view* value_arg) { a_nullable_string_ = value_arg ? std::optional(*value_arg) : std::nullopt; } -void AllNullableTypes::set_a_nullable_string(std::string_view value_arg) { a_nullable_string_ = value_arg; } +const std::string* AllNullableTypes::a_nullable_string() const { + return a_nullable_string_ ? &(*a_nullable_string_) : nullptr; +} +void AllNullableTypes::set_a_nullable_string( + const std::string_view* value_arg) { + a_nullable_string_ = + value_arg ? std::optional(*value_arg) : std::nullopt; +} +void AllNullableTypes::set_a_nullable_string(std::string_view value_arg) { + a_nullable_string_ = value_arg; +} flutter::EncodableList AllNullableTypes::ToEncodableList() const { -return flutter::EncodableList{ - a_nullable_bool_ ? flutter::EncodableValue(*a_nullable_bool_) : flutter::EncodableValue(), - a_nullable_int_ ? flutter::EncodableValue(*a_nullable_int_) : flutter::EncodableValue(), - a_nullable_double_ ? flutter::EncodableValue(*a_nullable_double_) : flutter::EncodableValue(), - a_nullable_byte_array_ ? flutter::EncodableValue(*a_nullable_byte_array_) : flutter::EncodableValue(), - a_nullable4_byte_array_ ? flutter::EncodableValue(*a_nullable4_byte_array_) : flutter::EncodableValue(), - a_nullable8_byte_array_ ? flutter::EncodableValue(*a_nullable8_byte_array_) : flutter::EncodableValue(), - a_nullable_float_array_ ? flutter::EncodableValue(*a_nullable_float_array_) : flutter::EncodableValue(), - a_nullable_list_ ? flutter::EncodableValue(*a_nullable_list_) : flutter::EncodableValue(), - a_nullable_map_ ? flutter::EncodableValue(*a_nullable_map_) : flutter::EncodableValue(), - nullable_nested_list_ ? flutter::EncodableValue(*nullable_nested_list_) : flutter::EncodableValue(), - nullable_map_with_annotations_ ? flutter::EncodableValue(*nullable_map_with_annotations_) : flutter::EncodableValue(), - nullable_map_with_object_ ? flutter::EncodableValue(*nullable_map_with_object_) : flutter::EncodableValue(), - a_nullable_enum_ ? flutter::EncodableValue((int)(*a_nullable_enum_)) : flutter::EncodableValue(), - a_nullable_string_ ? flutter::EncodableValue(*a_nullable_string_) : flutter::EncodableValue(), + return flutter::EncodableList{ + a_nullable_bool_ ? flutter::EncodableValue(*a_nullable_bool_) + : flutter::EncodableValue(), + a_nullable_int_ ? flutter::EncodableValue(*a_nullable_int_) + : flutter::EncodableValue(), + a_nullable_double_ ? flutter::EncodableValue(*a_nullable_double_) + : flutter::EncodableValue(), + a_nullable_byte_array_ ? flutter::EncodableValue(*a_nullable_byte_array_) + : flutter::EncodableValue(), + a_nullable4_byte_array_ + ? flutter::EncodableValue(*a_nullable4_byte_array_) + : flutter::EncodableValue(), + a_nullable8_byte_array_ + ? flutter::EncodableValue(*a_nullable8_byte_array_) + : flutter::EncodableValue(), + a_nullable_float_array_ + ? flutter::EncodableValue(*a_nullable_float_array_) + : flutter::EncodableValue(), + a_nullable_list_ ? flutter::EncodableValue(*a_nullable_list_) + : flutter::EncodableValue(), + a_nullable_map_ ? flutter::EncodableValue(*a_nullable_map_) + : flutter::EncodableValue(), + nullable_nested_list_ ? flutter::EncodableValue(*nullable_nested_list_) + : flutter::EncodableValue(), + nullable_map_with_annotations_ + ? flutter::EncodableValue(*nullable_map_with_annotations_) + : flutter::EncodableValue(), + nullable_map_with_object_ + ? flutter::EncodableValue(*nullable_map_with_object_) + : flutter::EncodableValue(), + a_nullable_enum_ ? flutter::EncodableValue((int)(*a_nullable_enum_)) + : flutter::EncodableValue(), + a_nullable_string_ ? flutter::EncodableValue(*a_nullable_string_) + : flutter::EncodableValue(), }; } @@ -201,115 +377,157 @@ AllNullableTypes::AllNullableTypes() {} AllNullableTypes::AllNullableTypes(const flutter::EncodableList& list) { auto& encodable_a_nullable_bool = list[0]; - if (const bool* pointer_a_nullable_bool = std::get_if(&encodable_a_nullable_bool)) { + if (const bool* pointer_a_nullable_bool = + std::get_if(&encodable_a_nullable_bool)) { a_nullable_bool_ = *pointer_a_nullable_bool; } auto& encodable_a_nullable_int = list[1]; - if (const int32_t* pointer_a_nullable_int = std::get_if(&encodable_a_nullable_int)) + if (const int32_t* pointer_a_nullable_int = + std::get_if(&encodable_a_nullable_int)) a_nullable_int_ = *pointer_a_nullable_int; - else if (const int64_t* pointer_a_nullable_int_64 = std::get_if(&encodable_a_nullable_int)) + else if (const int64_t* pointer_a_nullable_int_64 = + std::get_if(&encodable_a_nullable_int)) a_nullable_int_ = *pointer_a_nullable_int_64; auto& encodable_a_nullable_double = list[2]; - if (const double* pointer_a_nullable_double = std::get_if(&encodable_a_nullable_double)) { + if (const double* pointer_a_nullable_double = + std::get_if(&encodable_a_nullable_double)) { a_nullable_double_ = *pointer_a_nullable_double; } auto& encodable_a_nullable_byte_array = list[3]; - if (const std::vector* pointer_a_nullable_byte_array = std::get_if>(&encodable_a_nullable_byte_array)) { + if (const std::vector* pointer_a_nullable_byte_array = + std::get_if>(&encodable_a_nullable_byte_array)) { a_nullable_byte_array_ = *pointer_a_nullable_byte_array; } auto& encodable_a_nullable4_byte_array = list[4]; - if (const std::vector* pointer_a_nullable4_byte_array = std::get_if>(&encodable_a_nullable4_byte_array)) { + if (const std::vector* pointer_a_nullable4_byte_array = + std::get_if>( + &encodable_a_nullable4_byte_array)) { a_nullable4_byte_array_ = *pointer_a_nullable4_byte_array; } auto& encodable_a_nullable8_byte_array = list[5]; - if (const std::vector* pointer_a_nullable8_byte_array = std::get_if>(&encodable_a_nullable8_byte_array)) { + if (const std::vector* pointer_a_nullable8_byte_array = + std::get_if>( + &encodable_a_nullable8_byte_array)) { a_nullable8_byte_array_ = *pointer_a_nullable8_byte_array; } auto& encodable_a_nullable_float_array = list[6]; - if (const std::vector* pointer_a_nullable_float_array = std::get_if>(&encodable_a_nullable_float_array)) { + if (const std::vector* pointer_a_nullable_float_array = + std::get_if>(&encodable_a_nullable_float_array)) { a_nullable_float_array_ = *pointer_a_nullable_float_array; } auto& encodable_a_nullable_list = list[7]; - if (const flutter::EncodableList* pointer_a_nullable_list = std::get_if(&encodable_a_nullable_list)) { + if (const flutter::EncodableList* pointer_a_nullable_list = + std::get_if(&encodable_a_nullable_list)) { a_nullable_list_ = *pointer_a_nullable_list; } auto& encodable_a_nullable_map = list[8]; - if (const flutter::EncodableMap* pointer_a_nullable_map = std::get_if(&encodable_a_nullable_map)) { + if (const flutter::EncodableMap* pointer_a_nullable_map = + std::get_if(&encodable_a_nullable_map)) { a_nullable_map_ = *pointer_a_nullable_map; } auto& encodable_nullable_nested_list = list[9]; - if (const flutter::EncodableList* pointer_nullable_nested_list = std::get_if(&encodable_nullable_nested_list)) { + if (const flutter::EncodableList* pointer_nullable_nested_list = + std::get_if( + &encodable_nullable_nested_list)) { nullable_nested_list_ = *pointer_nullable_nested_list; } auto& encodable_nullable_map_with_annotations = list[10]; - if (const flutter::EncodableMap* pointer_nullable_map_with_annotations = std::get_if(&encodable_nullable_map_with_annotations)) { + if (const flutter::EncodableMap* pointer_nullable_map_with_annotations = + std::get_if( + &encodable_nullable_map_with_annotations)) { nullable_map_with_annotations_ = *pointer_nullable_map_with_annotations; } auto& encodable_nullable_map_with_object = list[11]; - if (const flutter::EncodableMap* pointer_nullable_map_with_object = std::get_if(&encodable_nullable_map_with_object)) { + if (const flutter::EncodableMap* pointer_nullable_map_with_object = + std::get_if( + &encodable_nullable_map_with_object)) { nullable_map_with_object_ = *pointer_nullable_map_with_object; } auto& encodable_a_nullable_enum = list[12]; - if (const int32_t* pointer_a_nullable_enum = std::get_if(&encodable_a_nullable_enum)) a_nullable_enum_ = (AnEnum)*pointer_a_nullable_enum; + if (const int32_t* pointer_a_nullable_enum = + std::get_if(&encodable_a_nullable_enum)) + a_nullable_enum_ = (AnEnum)*pointer_a_nullable_enum; auto& encodable_a_nullable_string = list[13]; - if (const std::string* pointer_a_nullable_string = std::get_if(&encodable_a_nullable_string)) { + if (const std::string* pointer_a_nullable_string = + std::get_if(&encodable_a_nullable_string)) { a_nullable_string_ = *pointer_a_nullable_string; } } - // AllNullableTypesWrapper -const AllNullableTypes& AllNullableTypesWrapper::values() const { return values_; } -void AllNullableTypesWrapper::set_values(const AllNullableTypes& value_arg) { values_ = value_arg; } +const AllNullableTypes& AllNullableTypesWrapper::values() const { + return values_; +} +void AllNullableTypesWrapper::set_values(const AllNullableTypes& value_arg) { + values_ = value_arg; +} flutter::EncodableList AllNullableTypesWrapper::ToEncodableList() const { -return flutter::EncodableList{ - flutter::EncodableValue(values_.ToEncodableList()), + return flutter::EncodableList{ + flutter::EncodableValue(values_.ToEncodableList()), }; } AllNullableTypesWrapper::AllNullableTypesWrapper() {} -AllNullableTypesWrapper::AllNullableTypesWrapper(const flutter::EncodableList& list) { +AllNullableTypesWrapper::AllNullableTypesWrapper( + const flutter::EncodableList& list) { auto& encodable_values = list[0]; - if (const flutter::EncodableList* pointer_values = std::get_if(&encodable_values)) { + if (const flutter::EncodableList* pointer_values = + std::get_if(&encodable_values)) { values_ = AllNullableTypes(*pointer_values); } } -HostIntegrationCoreApiCodecSerializer::HostIntegrationCoreApiCodecSerializer() {} -flutter::EncodableValue HostIntegrationCoreApiCodecSerializer::ReadValueOfType(uint8_t type, flutter::ByteStreamReader* stream) const { +HostIntegrationCoreApiCodecSerializer::HostIntegrationCoreApiCodecSerializer() { +} +flutter::EncodableValue HostIntegrationCoreApiCodecSerializer::ReadValueOfType( + uint8_t type, flutter::ByteStreamReader* stream) const { switch (type) { - case 128: - return flutter::CustomEncodableValue(AllNullableTypes(std::get(ReadValue(stream)))); - - case 129: - return flutter::CustomEncodableValue(AllNullableTypesWrapper(std::get(ReadValue(stream)))); - - case 130: - return flutter::CustomEncodableValue(AllTypes(std::get(ReadValue(stream)))); - - default: + case 128: + return flutter::CustomEncodableValue(AllNullableTypes( + std::get(ReadValue(stream)))); + + case 129: + return flutter::CustomEncodableValue(AllNullableTypesWrapper( + std::get(ReadValue(stream)))); + + case 130: + return flutter::CustomEncodableValue( + AllTypes(std::get(ReadValue(stream)))); + + default: return flutter::StandardCodecSerializer::ReadValueOfType(type, stream); - } + } } -void HostIntegrationCoreApiCodecSerializer::WriteValue(const flutter::EncodableValue& value, flutter::ByteStreamWriter* stream) const { - if (const flutter::CustomEncodableValue* custom_value = std::get_if(&value)) { +void HostIntegrationCoreApiCodecSerializer::WriteValue( + const flutter::EncodableValue& value, + flutter::ByteStreamWriter* stream) const { + if (const flutter::CustomEncodableValue* custom_value = + std::get_if(&value)) { if (custom_value->type() == typeid(AllNullableTypes)) { stream->WriteByte(128); - WriteValue(flutter::EncodableValue(std::any_cast(*custom_value).ToEncodableList()), stream); + WriteValue( + flutter::EncodableValue( + std::any_cast(*custom_value).ToEncodableList()), + stream); return; } if (custom_value->type() == typeid(AllNullableTypesWrapper)) { stream->WriteByte(129); - WriteValue(flutter::EncodableValue(std::any_cast(*custom_value).ToEncodableList()), stream); + WriteValue(flutter::EncodableValue( + std::any_cast(*custom_value) + .ToEncodableList()), + stream); return; } if (custom_value->type() == typeid(AllTypes)) { stream->WriteByte(130); - WriteValue(flutter::EncodableValue(std::any_cast(*custom_value).ToEncodableList()), stream); + WriteValue(flutter::EncodableValue( + std::any_cast(*custom_value).ToEncodableList()), + stream); return; } } @@ -318,986 +536,1366 @@ void HostIntegrationCoreApiCodecSerializer::WriteValue(const flutter::EncodableV /// The codec used by HostIntegrationCoreApi. const flutter::StandardMessageCodec& HostIntegrationCoreApi::GetCodec() { - return flutter::StandardMessageCodec::GetInstance(&HostIntegrationCoreApiCodecSerializer::GetInstance()); + return flutter::StandardMessageCodec::GetInstance( + &HostIntegrationCoreApiCodecSerializer::GetInstance()); } -// Sets up an instance of `HostIntegrationCoreApi` to handle messages through the `binary_messenger`. -void HostIntegrationCoreApi::SetUp(flutter::BinaryMessenger* binary_messenger, HostIntegrationCoreApi* api) { +// Sets up an instance of `HostIntegrationCoreApi` to handle messages through +// the `binary_messenger`. +void HostIntegrationCoreApi::SetUp(flutter::BinaryMessenger* binary_messenger, + HostIntegrationCoreApi* api) { { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.noop", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.noop", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - std::optional output = api->Noop(); - if (output.has_value()) { - reply(WrapError(output.value())); - return; - } - flutter::EncodableList wrapped; - wrapped.push_back(flutter::EncodableValue()); - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + std::optional output = api->Noop(); + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + flutter::EncodableList wrapped; + wrapped.push_back(flutter::EncodableValue()); + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAllTypes", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoAllTypes", &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_everything_arg = args.at(0); - if (encodable_everything_arg.IsNull()) { - reply(WrapError("everything_arg unexpectedly null.")); - return; - } - const auto& everything_arg = std::any_cast(std::get(encodable_everything_arg)); - ErrorOr output = api->EchoAllTypes(everything_arg); - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - flutter::EncodableList wrapped; - wrapped.push_back(flutter::CustomEncodableValue(std::move(output).TakeValue())); - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_everything_arg = args.at(0); + if (encodable_everything_arg.IsNull()) { + reply(WrapError("everything_arg unexpectedly null.")); + return; + } + const auto& everything_arg = std::any_cast( + std::get( + encodable_everything_arg)); + ErrorOr output = api->EchoAllTypes(everything_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + wrapped.push_back( + flutter::CustomEncodableValue(std::move(output).TakeValue())); + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAllNullableTypes", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoAllNullableTypes", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_everything_arg = args.at(0); - const auto* everything_arg = &(std::any_cast(std::get(encodable_everything_arg))); - ErrorOr> output = api->EchoAllNullableTypes(everything_arg); - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - flutter::EncodableList wrapped; - auto output_optional = std::move(output).TakeValue(); - if (output_optional) { - wrapped.push_back(flutter::CustomEncodableValue(std::move(output_optional).value())); - } else { - wrapped.push_back(flutter::EncodableValue()); - } - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_everything_arg = args.at(0); + const auto* everything_arg = + &(std::any_cast( + std::get( + encodable_everything_arg))); + ErrorOr> output = + api->EchoAllNullableTypes(everything_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + auto output_optional = std::move(output).TakeValue(); + if (output_optional) { + wrapped.push_back(flutter::CustomEncodableValue( + std::move(output_optional).value())); + } else { + wrapped.push_back(flutter::EncodableValue()); + } + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.throwError", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.throwError", &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - std::optional output = api->ThrowError(); - if (output.has_value()) { - reply(WrapError(output.value())); - return; - } - flutter::EncodableList wrapped; - wrapped.push_back(flutter::EncodableValue()); - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + std::optional output = api->ThrowError(); + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + flutter::EncodableList wrapped; + wrapped.push_back(flutter::EncodableValue()); + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoInt", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoInt", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_an_int_arg = args.at(0); - if (encodable_an_int_arg.IsNull()) { - reply(WrapError("an_int_arg unexpectedly null.")); - return; - } - const int64_t an_int_arg = encodable_an_int_arg.LongValue(); - ErrorOr output = api->EchoInt(an_int_arg); - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - flutter::EncodableList wrapped; - wrapped.push_back(flutter::EncodableValue(std::move(output).TakeValue())); - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_an_int_arg = args.at(0); + if (encodable_an_int_arg.IsNull()) { + reply(WrapError("an_int_arg unexpectedly null.")); + return; + } + const int64_t an_int_arg = encodable_an_int_arg.LongValue(); + ErrorOr output = api->EchoInt(an_int_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + wrapped.push_back( + flutter::EncodableValue(std::move(output).TakeValue())); + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoDouble", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoDouble", &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_a_double_arg = args.at(0); - if (encodable_a_double_arg.IsNull()) { - reply(WrapError("a_double_arg unexpectedly null.")); - return; - } - const auto& a_double_arg = std::get(encodable_a_double_arg); - ErrorOr output = api->EchoDouble(a_double_arg); - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - flutter::EncodableList wrapped; - wrapped.push_back(flutter::EncodableValue(std::move(output).TakeValue())); - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_a_double_arg = args.at(0); + if (encodable_a_double_arg.IsNull()) { + reply(WrapError("a_double_arg unexpectedly null.")); + return; + } + const auto& a_double_arg = + std::get(encodable_a_double_arg); + ErrorOr output = api->EchoDouble(a_double_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + wrapped.push_back( + flutter::EncodableValue(std::move(output).TakeValue())); + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoBool", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoBool", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_a_bool_arg = args.at(0); - if (encodable_a_bool_arg.IsNull()) { - reply(WrapError("a_bool_arg unexpectedly null.")); - return; - } - const auto& a_bool_arg = std::get(encodable_a_bool_arg); - ErrorOr output = api->EchoBool(a_bool_arg); - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - flutter::EncodableList wrapped; - wrapped.push_back(flutter::EncodableValue(std::move(output).TakeValue())); - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_a_bool_arg = args.at(0); + if (encodable_a_bool_arg.IsNull()) { + reply(WrapError("a_bool_arg unexpectedly null.")); + return; + } + const auto& a_bool_arg = std::get(encodable_a_bool_arg); + ErrorOr output = api->EchoBool(a_bool_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + wrapped.push_back( + flutter::EncodableValue(std::move(output).TakeValue())); + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoString", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoString", &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_a_string_arg = args.at(0); - if (encodable_a_string_arg.IsNull()) { - reply(WrapError("a_string_arg unexpectedly null.")); - return; - } - const auto& a_string_arg = std::get(encodable_a_string_arg); - ErrorOr output = api->EchoString(a_string_arg); - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - flutter::EncodableList wrapped; - wrapped.push_back(flutter::EncodableValue(std::move(output).TakeValue())); - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_a_string_arg = args.at(0); + if (encodable_a_string_arg.IsNull()) { + reply(WrapError("a_string_arg unexpectedly null.")); + return; + } + const auto& a_string_arg = + std::get(encodable_a_string_arg); + ErrorOr output = api->EchoString(a_string_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + wrapped.push_back( + flutter::EncodableValue(std::move(output).TakeValue())); + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoUint8List", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoUint8List", &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_a_uint8_list_arg = args.at(0); - if (encodable_a_uint8_list_arg.IsNull()) { - reply(WrapError("a_uint8_list_arg unexpectedly null.")); - return; - } - const auto& a_uint8_list_arg = std::get>(encodable_a_uint8_list_arg); - ErrorOr> output = api->EchoUint8List(a_uint8_list_arg); - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - flutter::EncodableList wrapped; - wrapped.push_back(flutter::EncodableValue(std::move(output).TakeValue())); - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_a_uint8_list_arg = args.at(0); + if (encodable_a_uint8_list_arg.IsNull()) { + reply(WrapError("a_uint8_list_arg unexpectedly null.")); + return; + } + const auto& a_uint8_list_arg = + std::get>(encodable_a_uint8_list_arg); + ErrorOr> output = + api->EchoUint8List(a_uint8_list_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + wrapped.push_back( + flutter::EncodableValue(std::move(output).TakeValue())); + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoObject", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoObject", &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_an_object_arg = args.at(0); - if (encodable_an_object_arg.IsNull()) { - reply(WrapError("an_object_arg unexpectedly null.")); - return; - } - const auto& an_object_arg = encodable_an_object_arg; - ErrorOr output = api->EchoObject(an_object_arg); - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - flutter::EncodableList wrapped; - wrapped.push_back(flutter::EncodableValue(std::move(output).TakeValue())); - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_an_object_arg = args.at(0); + if (encodable_an_object_arg.IsNull()) { + reply(WrapError("an_object_arg unexpectedly null.")); + return; + } + const auto& an_object_arg = encodable_an_object_arg; + ErrorOr output = + api->EchoObject(an_object_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + wrapped.push_back( + flutter::EncodableValue(std::move(output).TakeValue())); + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.extractNestedNullableString", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.extractNestedNullableString", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_wrapper_arg = args.at(0); - if (encodable_wrapper_arg.IsNull()) { - reply(WrapError("wrapper_arg unexpectedly null.")); - return; - } - const auto& wrapper_arg = std::any_cast(std::get(encodable_wrapper_arg)); - ErrorOr> output = api->ExtractNestedNullableString(wrapper_arg); - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - flutter::EncodableList wrapped; - auto output_optional = std::move(output).TakeValue(); - if (output_optional) { - wrapped.push_back(flutter::EncodableValue(std::move(output_optional).value())); - } else { - wrapped.push_back(flutter::EncodableValue()); - } - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_wrapper_arg = args.at(0); + if (encodable_wrapper_arg.IsNull()) { + reply(WrapError("wrapper_arg unexpectedly null.")); + return; + } + const auto& wrapper_arg = + std::any_cast( + std::get( + encodable_wrapper_arg)); + ErrorOr> output = + api->ExtractNestedNullableString(wrapper_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + auto output_optional = std::move(output).TakeValue(); + if (output_optional) { + wrapped.push_back(flutter::EncodableValue( + std::move(output_optional).value())); + } else { + wrapped.push_back(flutter::EncodableValue()); + } + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.createNestedNullableString", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.createNestedNullableString", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_nullable_string_arg = args.at(0); - const auto* nullable_string_arg = std::get_if(&encodable_nullable_string_arg); - ErrorOr output = api->CreateNestedNullableString(nullable_string_arg); - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - flutter::EncodableList wrapped; - wrapped.push_back(flutter::CustomEncodableValue(std::move(output).TakeValue())); - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_nullable_string_arg = args.at(0); + const auto* nullable_string_arg = + std::get_if(&encodable_nullable_string_arg); + ErrorOr output = + api->CreateNestedNullableString(nullable_string_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + wrapped.push_back( + flutter::CustomEncodableValue(std::move(output).TakeValue())); + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.sendMultipleNullableTypes", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.sendMultipleNullableTypes", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_a_nullable_bool_arg = args.at(0); - const auto* a_nullable_bool_arg = std::get_if(&encodable_a_nullable_bool_arg); - const auto& encodable_a_nullable_int_arg = args.at(1); - const int64_t a_nullable_int_arg_value = encodable_a_nullable_int_arg.IsNull() ? 0 : encodable_a_nullable_int_arg.LongValue(); - const auto* a_nullable_int_arg = encodable_a_nullable_int_arg.IsNull() ? nullptr : &a_nullable_int_arg_value; - const auto& encodable_a_nullable_string_arg = args.at(2); - const auto* a_nullable_string_arg = std::get_if(&encodable_a_nullable_string_arg); - ErrorOr output = api->SendMultipleNullableTypes(a_nullable_bool_arg, a_nullable_int_arg, a_nullable_string_arg); - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - flutter::EncodableList wrapped; - wrapped.push_back(flutter::CustomEncodableValue(std::move(output).TakeValue())); - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_a_nullable_bool_arg = args.at(0); + const auto* a_nullable_bool_arg = + std::get_if(&encodable_a_nullable_bool_arg); + const auto& encodable_a_nullable_int_arg = args.at(1); + const int64_t a_nullable_int_arg_value = + encodable_a_nullable_int_arg.IsNull() + ? 0 + : encodable_a_nullable_int_arg.LongValue(); + const auto* a_nullable_int_arg = + encodable_a_nullable_int_arg.IsNull() + ? nullptr + : &a_nullable_int_arg_value; + const auto& encodable_a_nullable_string_arg = args.at(2); + const auto* a_nullable_string_arg = + std::get_if(&encodable_a_nullable_string_arg); + ErrorOr output = api->SendMultipleNullableTypes( + a_nullable_bool_arg, a_nullable_int_arg, + a_nullable_string_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + wrapped.push_back( + flutter::CustomEncodableValue(std::move(output).TakeValue())); + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableInt", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableInt", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_a_nullable_int_arg = args.at(0); - const int64_t a_nullable_int_arg_value = encodable_a_nullable_int_arg.IsNull() ? 0 : encodable_a_nullable_int_arg.LongValue(); - const auto* a_nullable_int_arg = encodable_a_nullable_int_arg.IsNull() ? nullptr : &a_nullable_int_arg_value; - ErrorOr> output = api->EchoNullableInt(a_nullable_int_arg); - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - flutter::EncodableList wrapped; - auto output_optional = std::move(output).TakeValue(); - if (output_optional) { - wrapped.push_back(flutter::EncodableValue(std::move(output_optional).value())); - } else { - wrapped.push_back(flutter::EncodableValue()); - } - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_a_nullable_int_arg = args.at(0); + const int64_t a_nullable_int_arg_value = + encodable_a_nullable_int_arg.IsNull() + ? 0 + : encodable_a_nullable_int_arg.LongValue(); + const auto* a_nullable_int_arg = + encodable_a_nullable_int_arg.IsNull() + ? nullptr + : &a_nullable_int_arg_value; + ErrorOr> output = + api->EchoNullableInt(a_nullable_int_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + auto output_optional = std::move(output).TakeValue(); + if (output_optional) { + wrapped.push_back(flutter::EncodableValue( + std::move(output_optional).value())); + } else { + wrapped.push_back(flutter::EncodableValue()); + } + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableDouble", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableDouble", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_a_nullable_double_arg = args.at(0); - const auto* a_nullable_double_arg = std::get_if(&encodable_a_nullable_double_arg); - ErrorOr> output = api->EchoNullableDouble(a_nullable_double_arg); - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - flutter::EncodableList wrapped; - auto output_optional = std::move(output).TakeValue(); - if (output_optional) { - wrapped.push_back(flutter::EncodableValue(std::move(output_optional).value())); - } else { - wrapped.push_back(flutter::EncodableValue()); - } - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_a_nullable_double_arg = args.at(0); + const auto* a_nullable_double_arg = + std::get_if(&encodable_a_nullable_double_arg); + ErrorOr> output = + api->EchoNullableDouble(a_nullable_double_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + auto output_optional = std::move(output).TakeValue(); + if (output_optional) { + wrapped.push_back(flutter::EncodableValue( + std::move(output_optional).value())); + } else { + wrapped.push_back(flutter::EncodableValue()); + } + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableBool", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableBool", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_a_nullable_bool_arg = args.at(0); - const auto* a_nullable_bool_arg = std::get_if(&encodable_a_nullable_bool_arg); - ErrorOr> output = api->EchoNullableBool(a_nullable_bool_arg); - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - flutter::EncodableList wrapped; - auto output_optional = std::move(output).TakeValue(); - if (output_optional) { - wrapped.push_back(flutter::EncodableValue(std::move(output_optional).value())); - } else { - wrapped.push_back(flutter::EncodableValue()); - } - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_a_nullable_bool_arg = args.at(0); + const auto* a_nullable_bool_arg = + std::get_if(&encodable_a_nullable_bool_arg); + ErrorOr> output = + api->EchoNullableBool(a_nullable_bool_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + auto output_optional = std::move(output).TakeValue(); + if (output_optional) { + wrapped.push_back(flutter::EncodableValue( + std::move(output_optional).value())); + } else { + wrapped.push_back(flutter::EncodableValue()); + } + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableString", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableString", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_a_nullable_string_arg = args.at(0); - const auto* a_nullable_string_arg = std::get_if(&encodable_a_nullable_string_arg); - ErrorOr> output = api->EchoNullableString(a_nullable_string_arg); - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - flutter::EncodableList wrapped; - auto output_optional = std::move(output).TakeValue(); - if (output_optional) { - wrapped.push_back(flutter::EncodableValue(std::move(output_optional).value())); - } else { - wrapped.push_back(flutter::EncodableValue()); - } - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_a_nullable_string_arg = args.at(0); + const auto* a_nullable_string_arg = + std::get_if(&encodable_a_nullable_string_arg); + ErrorOr> output = + api->EchoNullableString(a_nullable_string_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + auto output_optional = std::move(output).TakeValue(); + if (output_optional) { + wrapped.push_back(flutter::EncodableValue( + std::move(output_optional).value())); + } else { + wrapped.push_back(flutter::EncodableValue()); + } + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableUint8List", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableUint8List", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_a_nullable_uint8_list_arg = args.at(0); - const auto* a_nullable_uint8_list_arg = std::get_if>(&encodable_a_nullable_uint8_list_arg); - ErrorOr>> output = api->EchoNullableUint8List(a_nullable_uint8_list_arg); - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - flutter::EncodableList wrapped; - auto output_optional = std::move(output).TakeValue(); - if (output_optional) { - wrapped.push_back(flutter::EncodableValue(std::move(output_optional).value())); - } else { - wrapped.push_back(flutter::EncodableValue()); - } - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_a_nullable_uint8_list_arg = args.at(0); + const auto* a_nullable_uint8_list_arg = + std::get_if>( + &encodable_a_nullable_uint8_list_arg); + ErrorOr>> output = + api->EchoNullableUint8List(a_nullable_uint8_list_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + auto output_optional = std::move(output).TakeValue(); + if (output_optional) { + wrapped.push_back(flutter::EncodableValue( + std::move(output_optional).value())); + } else { + wrapped.push_back(flutter::EncodableValue()); + } + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableObject", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableObject", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_a_nullable_object_arg = args.at(0); - const auto* a_nullable_object_arg = &encodable_a_nullable_object_arg; - ErrorOr> output = api->EchoNullableObject(a_nullable_object_arg); - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - flutter::EncodableList wrapped; - auto output_optional = std::move(output).TakeValue(); - if (output_optional) { - wrapped.push_back(flutter::EncodableValue(std::move(output_optional).value())); - } else { - wrapped.push_back(flutter::EncodableValue()); - } - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_a_nullable_object_arg = args.at(0); + const auto* a_nullable_object_arg = + &encodable_a_nullable_object_arg; + ErrorOr> output = + api->EchoNullableObject(a_nullable_object_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + auto output_optional = std::move(output).TakeValue(); + if (output_optional) { + wrapped.push_back(flutter::EncodableValue( + std::move(output_optional).value())); + } else { + wrapped.push_back(flutter::EncodableValue()); + } + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.noopAsync", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.noopAsync", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - api->NoopAsync([reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + api->NoopAsync([reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + flutter::EncodableList wrapped; + wrapped.push_back(flutter::EncodableValue()); + reply(flutter::EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); } - flutter::EncodableList wrapped; - wrapped.push_back(flutter::EncodableValue()); - reply(flutter::EncodableValue(std::move(wrapped))); }); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncString", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncString", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_a_string_arg = args.at(0); - if (encodable_a_string_arg.IsNull()) { - reply(WrapError("a_string_arg unexpectedly null.")); - return; - } - const auto& a_string_arg = std::get(encodable_a_string_arg); - api->EchoAsyncString(a_string_arg, [reply](ErrorOr&& output) { - if (output.has_error()) { - reply(WrapError(output.error())); - return; + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_a_string_arg = args.at(0); + if (encodable_a_string_arg.IsNull()) { + reply(WrapError("a_string_arg unexpectedly null.")); + return; + } + const auto& a_string_arg = + std::get(encodable_a_string_arg); + api->EchoAsyncString( + a_string_arg, [reply](ErrorOr&& output) { + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + wrapped.push_back( + flutter::EncodableValue(std::move(output).TakeValue())); + reply(flutter::EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); } - flutter::EncodableList wrapped; - wrapped.push_back(flutter::EncodableValue(std::move(output).TakeValue())); - reply(flutter::EncodableValue(std::move(wrapped))); }); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterNoop", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterNoop", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - api->CallFlutterNoop([reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + api->CallFlutterNoop( + [reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + flutter::EncodableList wrapped; + wrapped.push_back(flutter::EncodableValue()); + reply(flutter::EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); } - flutter::EncodableList wrapped; - wrapped.push_back(flutter::EncodableValue()); - reply(flutter::EncodableValue(std::move(wrapped))); }); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoString", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoString", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_a_string_arg = args.at(0); - if (encodable_a_string_arg.IsNull()) { - reply(WrapError("a_string_arg unexpectedly null.")); - return; - } - const auto& a_string_arg = std::get(encodable_a_string_arg); - api->CallFlutterEchoString(a_string_arg, [reply](ErrorOr&& output) { - if (output.has_error()) { - reply(WrapError(output.error())); - return; + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_a_string_arg = args.at(0); + if (encodable_a_string_arg.IsNull()) { + reply(WrapError("a_string_arg unexpectedly null.")); + return; + } + const auto& a_string_arg = + std::get(encodable_a_string_arg); + api->CallFlutterEchoString( + a_string_arg, [reply](ErrorOr&& output) { + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + wrapped.push_back( + flutter::EncodableValue(std::move(output).TakeValue())); + reply(flutter::EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); } - flutter::EncodableList wrapped; - wrapped.push_back(flutter::EncodableValue(std::move(output).TakeValue())); - reply(flutter::EncodableValue(std::move(wrapped))); }); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); } else { channel->SetMessageHandler(nullptr); } } } -flutter::EncodableValue HostIntegrationCoreApi::WrapError(std::string_view error_message) { +flutter::EncodableValue HostIntegrationCoreApi::WrapError( + std::string_view error_message) { return flutter::EncodableValue(flutter::EncodableList{ - flutter::EncodableValue(std::string(error_message)), - flutter::EncodableValue("Error"), - flutter::EncodableValue() - }); + flutter::EncodableValue(std::string(error_message)), + flutter::EncodableValue("Error"), flutter::EncodableValue()}); } -flutter::EncodableValue HostIntegrationCoreApi::WrapError(const FlutterError& error) { +flutter::EncodableValue HostIntegrationCoreApi::WrapError( + const FlutterError& error) { return flutter::EncodableValue(flutter::EncodableList{ - flutter::EncodableValue(error.message()), - flutter::EncodableValue(error.code()), - error.details() - }); + flutter::EncodableValue(error.message()), + flutter::EncodableValue(error.code()), error.details()}); } -FlutterIntegrationCoreApiCodecSerializer::FlutterIntegrationCoreApiCodecSerializer() {} -flutter::EncodableValue FlutterIntegrationCoreApiCodecSerializer::ReadValueOfType(uint8_t type, flutter::ByteStreamReader* stream) const { +FlutterIntegrationCoreApiCodecSerializer:: + FlutterIntegrationCoreApiCodecSerializer() {} +flutter::EncodableValue +FlutterIntegrationCoreApiCodecSerializer::ReadValueOfType( + uint8_t type, flutter::ByteStreamReader* stream) const { switch (type) { - case 128: - return flutter::CustomEncodableValue(AllNullableTypes(std::get(ReadValue(stream)))); - - case 129: - return flutter::CustomEncodableValue(AllNullableTypesWrapper(std::get(ReadValue(stream)))); - - case 130: - return flutter::CustomEncodableValue(AllTypes(std::get(ReadValue(stream)))); - - default: + case 128: + return flutter::CustomEncodableValue(AllNullableTypes( + std::get(ReadValue(stream)))); + + case 129: + return flutter::CustomEncodableValue(AllNullableTypesWrapper( + std::get(ReadValue(stream)))); + + case 130: + return flutter::CustomEncodableValue( + AllTypes(std::get(ReadValue(stream)))); + + default: return flutter::StandardCodecSerializer::ReadValueOfType(type, stream); - } + } } -void FlutterIntegrationCoreApiCodecSerializer::WriteValue(const flutter::EncodableValue& value, flutter::ByteStreamWriter* stream) const { - if (const flutter::CustomEncodableValue* custom_value = std::get_if(&value)) { +void FlutterIntegrationCoreApiCodecSerializer::WriteValue( + const flutter::EncodableValue& value, + flutter::ByteStreamWriter* stream) const { + if (const flutter::CustomEncodableValue* custom_value = + std::get_if(&value)) { if (custom_value->type() == typeid(AllNullableTypes)) { stream->WriteByte(128); - WriteValue(flutter::EncodableValue(std::any_cast(*custom_value).ToEncodableList()), stream); + WriteValue( + flutter::EncodableValue( + std::any_cast(*custom_value).ToEncodableList()), + stream); return; } if (custom_value->type() == typeid(AllNullableTypesWrapper)) { stream->WriteByte(129); - WriteValue(flutter::EncodableValue(std::any_cast(*custom_value).ToEncodableList()), stream); + WriteValue(flutter::EncodableValue( + std::any_cast(*custom_value) + .ToEncodableList()), + stream); return; } if (custom_value->type() == typeid(AllTypes)) { stream->WriteByte(130); - WriteValue(flutter::EncodableValue(std::any_cast(*custom_value).ToEncodableList()), stream); + WriteValue(flutter::EncodableValue( + std::any_cast(*custom_value).ToEncodableList()), + stream); return; } } flutter::StandardCodecSerializer::WriteValue(value, stream); } -// Generated class from Pigeon that represents Flutter messages that can be called from C++. -FlutterIntegrationCoreApi::FlutterIntegrationCoreApi(flutter::BinaryMessenger* binary_messenger) { +// Generated class from Pigeon that represents Flutter messages that can be +// called from C++. +FlutterIntegrationCoreApi::FlutterIntegrationCoreApi( + flutter::BinaryMessenger* binary_messenger) { this->binary_messenger_ = binary_messenger; } const flutter::StandardMessageCodec& FlutterIntegrationCoreApi::GetCodec() { - return flutter::StandardMessageCodec::GetInstance(&FlutterIntegrationCoreApiCodecSerializer::GetInstance()); + return flutter::StandardMessageCodec::GetInstance( + &FlutterIntegrationCoreApiCodecSerializer::GetInstance()); } -void FlutterIntegrationCoreApi::Noop(std::function&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.noop", &GetCodec()); +void FlutterIntegrationCoreApi::Noop( + std::function&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.noop", + &GetCodec()); flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - on_success(); - }); -} -void FlutterIntegrationCoreApi::EchoAllTypes(const AllTypes& everything_arg, std::function&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllTypes", &GetCodec()); - flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(flutter::EncodableList{ - flutter::EncodableValue(everything_arg.ToEncodableList()), - }); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto& return_value = std::any_cast(std::get(encodable_return_value)); - on_success(return_value); - }); -} -void FlutterIntegrationCoreApi::EchoAllNullableTypes(const AllNullableTypes& everything_arg, std::function&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes", &GetCodec()); - flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(flutter::EncodableList{ - flutter::EncodableValue(everything_arg.ToEncodableList()), - }); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto& return_value = std::any_cast(std::get(encodable_return_value)); - on_success(return_value); - }); -} -void FlutterIntegrationCoreApi::SendMultipleNullableTypes(const bool* a_nullable_bool_arg, const int64_t* a_nullable_int_arg, const std::string* a_nullable_string_arg, std::function&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.sendMultipleNullableTypes", &GetCodec()); - flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(flutter::EncodableList{ - a_nullable_bool_arg ? flutter::EncodableValue(*a_nullable_bool_arg) : flutter::EncodableValue(), - a_nullable_int_arg ? flutter::EncodableValue(*a_nullable_int_arg) : flutter::EncodableValue(), - a_nullable_string_arg ? flutter::EncodableValue(*a_nullable_string_arg) : flutter::EncodableValue(), - }); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto& return_value = std::any_cast(std::get(encodable_return_value)); - on_success(return_value); - }); -} -void FlutterIntegrationCoreApi::EchoBool(bool a_bool_arg, std::function&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoBool", &GetCodec()); - flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(flutter::EncodableList{ - flutter::EncodableValue(a_bool_arg), - }); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto& return_value = std::get(encodable_return_value); - on_success(return_value); - }); -} -void FlutterIntegrationCoreApi::EchoInt(int64_t an_int_arg, std::function&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoInt", &GetCodec()); - flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(flutter::EncodableList{ - flutter::EncodableValue(an_int_arg), - }); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const int64_t return_value = encodable_return_value.LongValue(); - on_success(return_value); - }); -} -void FlutterIntegrationCoreApi::EchoDouble(double a_double_arg, std::function&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoDouble", &GetCodec()); - flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(flutter::EncodableList{ - flutter::EncodableValue(a_double_arg), - }); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto& return_value = std::get(encodable_return_value); - on_success(return_value); - }); -} -void FlutterIntegrationCoreApi::EchoString(const std::string& a_string_arg, std::function&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoString", &GetCodec()); - flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(flutter::EncodableList{ - flutter::EncodableValue(a_string_arg), - }); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto& return_value = std::get(encodable_return_value); - on_success(return_value); - }); -} -void FlutterIntegrationCoreApi::EchoUint8List(const std::vector& a_list_arg, std::function&)>&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoUint8List", &GetCodec()); - flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(flutter::EncodableList{ - flutter::EncodableValue(a_list_arg), - }); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto& return_value = std::get>(encodable_return_value); - on_success(return_value); - }); -} -void FlutterIntegrationCoreApi::EchoList(const flutter::EncodableList& a_list_arg, std::function&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoList", &GetCodec()); - flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(flutter::EncodableList{ - flutter::EncodableValue(a_list_arg), - }); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto& return_value = std::get(encodable_return_value); - on_success(return_value); - }); -} -void FlutterIntegrationCoreApi::EchoMap(const flutter::EncodableMap& a_map_arg, std::function&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoMap", &GetCodec()); - flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(flutter::EncodableList{ - flutter::EncodableValue(a_map_arg), - }); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto& return_value = std::get(encodable_return_value); - on_success(return_value); - }); -} -void FlutterIntegrationCoreApi::EchoNullableBool(const bool* a_bool_arg, std::function&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableBool", &GetCodec()); - flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(flutter::EncodableList{ - a_bool_arg ? flutter::EncodableValue(*a_bool_arg) : flutter::EncodableValue(), - }); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto* return_value = std::get_if(&encodable_return_value); - on_success(return_value); - }); -} -void FlutterIntegrationCoreApi::EchoNullableInt(const int64_t* an_int_arg, std::function&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableInt", &GetCodec()); - flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(flutter::EncodableList{ - an_int_arg ? flutter::EncodableValue(*an_int_arg) : flutter::EncodableValue(), - }); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const int64_t return_value_value = encodable_return_value.IsNull() ? 0 : encodable_return_value.LongValue(); - const auto* return_value = encodable_return_value.IsNull() ? nullptr : &return_value_value; - on_success(return_value); - }); -} -void FlutterIntegrationCoreApi::EchoNullableDouble(const double* a_double_arg, std::function&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableDouble", &GetCodec()); - flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(flutter::EncodableList{ - a_double_arg ? flutter::EncodableValue(*a_double_arg) : flutter::EncodableValue(), - }); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto* return_value = std::get_if(&encodable_return_value); - on_success(return_value); - }); -} -void FlutterIntegrationCoreApi::EchoNullableString(const std::string* a_string_arg, std::function&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableString", &GetCodec()); - flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(flutter::EncodableList{ - a_string_arg ? flutter::EncodableValue(*a_string_arg) : flutter::EncodableValue(), - }); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto* return_value = std::get_if(&encodable_return_value); - on_success(return_value); - }); -} -void FlutterIntegrationCoreApi::EchoNullableUint8List(const std::vector* a_list_arg, std::function*)>&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableUint8List", &GetCodec()); - flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(flutter::EncodableList{ - a_list_arg ? flutter::EncodableValue(*a_list_arg) : flutter::EncodableValue(), - }); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto* return_value = std::get_if>(&encodable_return_value); - on_success(return_value); - }); -} -void FlutterIntegrationCoreApi::EchoNullableList(const flutter::EncodableList* a_list_arg, std::function&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList", &GetCodec()); - flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(flutter::EncodableList{ - a_list_arg ? flutter::EncodableValue(*a_list_arg) : flutter::EncodableValue(), - }); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto* return_value = std::get_if(&encodable_return_value); - on_success(return_value); - }); -} -void FlutterIntegrationCoreApi::EchoNullableMap(const flutter::EncodableMap& a_map_arg, std::function&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap", &GetCodec()); - flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(flutter::EncodableList{ - flutter::EncodableValue(a_map_arg), - }); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto& return_value = std::get(encodable_return_value); - on_success(return_value); - }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { on_success(); }); +} +void FlutterIntegrationCoreApi::EchoAllTypes( + const AllTypes& everything_arg, + std::function&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllTypes", &GetCodec()); + flutter::EncodableValue encoded_api_arguments = + flutter::EncodableValue(flutter::EncodableList{ + flutter::EncodableValue(everything_arg.ToEncodableList()), + }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto& return_value = std::any_cast( + std::get(encodable_return_value)); + on_success(return_value); + }); +} +void FlutterIntegrationCoreApi::EchoAllNullableTypes( + const AllNullableTypes& everything_arg, + std::function&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes", + &GetCodec()); + flutter::EncodableValue encoded_api_arguments = + flutter::EncodableValue(flutter::EncodableList{ + flutter::EncodableValue(everything_arg.ToEncodableList()), + }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto& return_value = std::any_cast( + std::get(encodable_return_value)); + on_success(return_value); + }); +} +void FlutterIntegrationCoreApi::SendMultipleNullableTypes( + const bool* a_nullable_bool_arg, const int64_t* a_nullable_int_arg, + const std::string* a_nullable_string_arg, + std::function&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.sendMultipleNullableTypes", + &GetCodec()); + flutter::EncodableValue encoded_api_arguments = + flutter::EncodableValue(flutter::EncodableList{ + a_nullable_bool_arg ? flutter::EncodableValue(*a_nullable_bool_arg) + : flutter::EncodableValue(), + a_nullable_int_arg ? flutter::EncodableValue(*a_nullable_int_arg) + : flutter::EncodableValue(), + a_nullable_string_arg + ? flutter::EncodableValue(*a_nullable_string_arg) + : flutter::EncodableValue(), + }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto& return_value = std::any_cast( + std::get(encodable_return_value)); + on_success(return_value); + }); +} +void FlutterIntegrationCoreApi::EchoBool( + bool a_bool_arg, std::function&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoBool", &GetCodec()); + flutter::EncodableValue encoded_api_arguments = + flutter::EncodableValue(flutter::EncodableList{ + flutter::EncodableValue(a_bool_arg), + }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto& return_value = std::get(encodable_return_value); + on_success(return_value); + }); +} +void FlutterIntegrationCoreApi::EchoInt( + int64_t an_int_arg, std::function&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoInt", + &GetCodec()); + flutter::EncodableValue encoded_api_arguments = + flutter::EncodableValue(flutter::EncodableList{ + flutter::EncodableValue(an_int_arg), + }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const int64_t return_value = encodable_return_value.LongValue(); + on_success(return_value); + }); +} +void FlutterIntegrationCoreApi::EchoDouble( + double a_double_arg, std::function&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoDouble", &GetCodec()); + flutter::EncodableValue encoded_api_arguments = + flutter::EncodableValue(flutter::EncodableList{ + flutter::EncodableValue(a_double_arg), + }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto& return_value = std::get(encodable_return_value); + on_success(return_value); + }); +} +void FlutterIntegrationCoreApi::EchoString( + const std::string& a_string_arg, + std::function&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoString", &GetCodec()); + flutter::EncodableValue encoded_api_arguments = + flutter::EncodableValue(flutter::EncodableList{ + flutter::EncodableValue(a_string_arg), + }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto& return_value = + std::get(encodable_return_value); + on_success(return_value); + }); +} +void FlutterIntegrationCoreApi::EchoUint8List( + const std::vector& a_list_arg, + std::function&)>&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoUint8List", + &GetCodec()); + flutter::EncodableValue encoded_api_arguments = + flutter::EncodableValue(flutter::EncodableList{ + flutter::EncodableValue(a_list_arg), + }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto& return_value = + std::get>(encodable_return_value); + on_success(return_value); + }); +} +void FlutterIntegrationCoreApi::EchoList( + const flutter::EncodableList& a_list_arg, + std::function&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoList", &GetCodec()); + flutter::EncodableValue encoded_api_arguments = + flutter::EncodableValue(flutter::EncodableList{ + flutter::EncodableValue(a_list_arg), + }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto& return_value = + std::get(encodable_return_value); + on_success(return_value); + }); +} +void FlutterIntegrationCoreApi::EchoMap( + const flutter::EncodableMap& a_map_arg, + std::function&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoMap", + &GetCodec()); + flutter::EncodableValue encoded_api_arguments = + flutter::EncodableValue(flutter::EncodableList{ + flutter::EncodableValue(a_map_arg), + }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto& return_value = + std::get(encodable_return_value); + on_success(return_value); + }); +} +void FlutterIntegrationCoreApi::EchoNullableBool( + const bool* a_bool_arg, std::function&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableBool", + &GetCodec()); + flutter::EncodableValue encoded_api_arguments = + flutter::EncodableValue(flutter::EncodableList{ + a_bool_arg ? flutter::EncodableValue(*a_bool_arg) + : flutter::EncodableValue(), + }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto* return_value = std::get_if(&encodable_return_value); + on_success(return_value); + }); +} +void FlutterIntegrationCoreApi::EchoNullableInt( + const int64_t* an_int_arg, std::function&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableInt", + &GetCodec()); + flutter::EncodableValue encoded_api_arguments = + flutter::EncodableValue(flutter::EncodableList{ + an_int_arg ? flutter::EncodableValue(*an_int_arg) + : flutter::EncodableValue(), + }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const int64_t return_value_value = + encodable_return_value.IsNull() + ? 0 + : encodable_return_value.LongValue(); + const auto* return_value = + encodable_return_value.IsNull() ? nullptr : &return_value_value; + on_success(return_value); + }); +} +void FlutterIntegrationCoreApi::EchoNullableDouble( + const double* a_double_arg, std::function&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableDouble", + &GetCodec()); + flutter::EncodableValue encoded_api_arguments = + flutter::EncodableValue(flutter::EncodableList{ + a_double_arg ? flutter::EncodableValue(*a_double_arg) + : flutter::EncodableValue(), + }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto* return_value = std::get_if(&encodable_return_value); + on_success(return_value); + }); +} +void FlutterIntegrationCoreApi::EchoNullableString( + const std::string* a_string_arg, + std::function&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableString", + &GetCodec()); + flutter::EncodableValue encoded_api_arguments = + flutter::EncodableValue(flutter::EncodableList{ + a_string_arg ? flutter::EncodableValue(*a_string_arg) + : flutter::EncodableValue(), + }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto* return_value = + std::get_if(&encodable_return_value); + on_success(return_value); + }); +} +void FlutterIntegrationCoreApi::EchoNullableUint8List( + const std::vector* a_list_arg, + std::function*)>&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableUint8List", + &GetCodec()); + flutter::EncodableValue encoded_api_arguments = + flutter::EncodableValue(flutter::EncodableList{ + a_list_arg ? flutter::EncodableValue(*a_list_arg) + : flutter::EncodableValue(), + }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto* return_value = + std::get_if>(&encodable_return_value); + on_success(return_value); + }); +} +void FlutterIntegrationCoreApi::EchoNullableList( + const flutter::EncodableList* a_list_arg, + std::function&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList", + &GetCodec()); + flutter::EncodableValue encoded_api_arguments = + flutter::EncodableValue(flutter::EncodableList{ + a_list_arg ? flutter::EncodableValue(*a_list_arg) + : flutter::EncodableValue(), + }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto* return_value = + std::get_if(&encodable_return_value); + on_success(return_value); + }); +} +void FlutterIntegrationCoreApi::EchoNullableMap( + const flutter::EncodableMap& a_map_arg, + std::function&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap", + &GetCodec()); + flutter::EncodableValue encoded_api_arguments = + flutter::EncodableValue(flutter::EncodableList{ + flutter::EncodableValue(a_map_arg), + }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto& return_value = + std::get(encodable_return_value); + on_success(return_value); + }); } /// The codec used by HostTrivialApi. const flutter::StandardMessageCodec& HostTrivialApi::GetCodec() { - return flutter::StandardMessageCodec::GetInstance(&flutter::StandardCodecSerializer::GetInstance()); + return flutter::StandardMessageCodec::GetInstance( + &flutter::StandardCodecSerializer::GetInstance()); } -// Sets up an instance of `HostTrivialApi` to handle messages through the `binary_messenger`. -void HostTrivialApi::SetUp(flutter::BinaryMessenger* binary_messenger, HostTrivialApi* api) { +// Sets up an instance of `HostTrivialApi` to handle messages through the +// `binary_messenger`. +void HostTrivialApi::SetUp(flutter::BinaryMessenger* binary_messenger, + HostTrivialApi* api) { { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostTrivialApi.noop", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, "dev.flutter.pigeon.HostTrivialApi.noop", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - std::optional output = api->Noop(); - if (output.has_value()) { - reply(WrapError(output.value())); - return; - } - flutter::EncodableList wrapped; - wrapped.push_back(flutter::EncodableValue()); - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + std::optional output = api->Noop(); + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + flutter::EncodableList wrapped; + wrapped.push_back(flutter::EncodableValue()); + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } } -flutter::EncodableValue HostTrivialApi::WrapError(std::string_view error_message) { +flutter::EncodableValue HostTrivialApi::WrapError( + std::string_view error_message) { return flutter::EncodableValue(flutter::EncodableList{ - flutter::EncodableValue(std::string(error_message)), - flutter::EncodableValue("Error"), - flutter::EncodableValue() - }); + flutter::EncodableValue(std::string(error_message)), + flutter::EncodableValue("Error"), flutter::EncodableValue()}); } flutter::EncodableValue HostTrivialApi::WrapError(const FlutterError& error) { return flutter::EncodableValue(flutter::EncodableList{ - flutter::EncodableValue(error.message()), - flutter::EncodableValue(error.code()), - error.details() - }); + flutter::EncodableValue(error.message()), + flutter::EncodableValue(error.code()), error.details()}); } } // namespace core_tests_pigeontest diff --git a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h index f0e72b5663d..9bc1617e493 100644 --- a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h +++ b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h @@ -1,7 +1,7 @@ // 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 (v6.0.4), do not edit directly. // See also: https://pub.dev/packages/pigeon @@ -24,12 +24,12 @@ class CoreTestsTest; class FlutterError { public: - explicit FlutterError(const std::string& code) - : code_(code) {} + explicit FlutterError(const std::string& code) : code_(code) {} explicit FlutterError(const std::string& code, const std::string& message) - : code_(code), message_(message) {} - explicit FlutterError(const std::string& code, const std::string& message, const flutter::EncodableValue& details) - : code_(code), message_(message), details_(details) {} + : code_(code), message_(message) {} + explicit FlutterError(const std::string& code, const std::string& message, + const flutter::EncodableValue& details) + : code_(code), message_(message), details_(details) {} const std::string& code() const { return code_; } const std::string& message() const { return message_; } @@ -41,13 +41,12 @@ class FlutterError { flutter::EncodableValue details_; }; -template class ErrorOr { +template +class ErrorOr { public: - ErrorOr(const T& rhs) { new(&v_) T(rhs); } + ErrorOr(const T& rhs) { new (&v_) T(rhs); } ErrorOr(const T&& rhs) { v_ = std::move(rhs); } - ErrorOr(const FlutterError& rhs) { - new(&v_) FlutterError(rhs); - } + ErrorOr(const FlutterError& rhs) { new (&v_) FlutterError(rhs); } ErrorOr(const FlutterError&& rhs) { v_ = std::move(rhs); } bool has_error() const { return std::holds_alternative(v_); } @@ -64,12 +63,7 @@ template class ErrorOr { std::variant v_; }; - -enum class AnEnum { - one = 0, - two = 1, - three = 2 -}; +enum class AnEnum { one = 0, two = 1, three = 2 }; // Generated class from Pigeon that represents data sent in messages. class AllTypes { @@ -108,7 +102,6 @@ class AllTypes { const std::string& a_string() const; void set_a_string(std::string_view value_arg); - private: AllTypes(const flutter::EncodableList& list); flutter::EncodableList ToEncodableList() const; @@ -130,10 +123,8 @@ class AllTypes { flutter::EncodableMap a_map_; AnEnum an_enum_; std::string a_string_; - }; - // Generated class from Pigeon that represents data sent in messages. class AllNullableTypes { public: @@ -179,8 +170,10 @@ class AllNullableTypes { void set_nullable_nested_list(const flutter::EncodableList& value_arg); const flutter::EncodableMap* nullable_map_with_annotations() const; - void set_nullable_map_with_annotations(const flutter::EncodableMap* value_arg); - void set_nullable_map_with_annotations(const flutter::EncodableMap& value_arg); + void set_nullable_map_with_annotations( + const flutter::EncodableMap* value_arg); + void set_nullable_map_with_annotations( + const flutter::EncodableMap& value_arg); const flutter::EncodableMap* nullable_map_with_object() const; void set_nullable_map_with_object(const flutter::EncodableMap* value_arg); @@ -194,7 +187,6 @@ class AllNullableTypes { void set_a_nullable_string(const std::string_view* value_arg); void set_a_nullable_string(std::string_view value_arg); - private: AllNullableTypes(const flutter::EncodableList& list); flutter::EncodableList ToEncodableList() const; @@ -220,10 +212,8 @@ class AllNullableTypes { std::optional nullable_map_with_object_; std::optional a_nullable_enum_; std::optional a_nullable_string_; - }; - // Generated class from Pigeon that represents data sent in messages. class AllNullableTypesWrapper { public: @@ -231,7 +221,6 @@ class AllNullableTypesWrapper { const AllNullableTypes& values() const; void set_values(const AllNullableTypes& value_arg); - private: AllNullableTypesWrapper(const flutter::EncodableList& list); flutter::EncodableList ToEncodableList() const; @@ -243,12 +232,11 @@ class AllNullableTypesWrapper { friend class HostTrivialApiCodecSerializer; friend class CoreTestsTest; AllNullableTypes values_; - }; -class HostIntegrationCoreApiCodecSerializer : public flutter::StandardCodecSerializer { +class HostIntegrationCoreApiCodecSerializer + : public flutter::StandardCodecSerializer { public: - inline static HostIntegrationCoreApiCodecSerializer& GetInstance() { static HostIntegrationCoreApiCodecSerializer sInstance; return sInstance; @@ -257,29 +245,32 @@ class HostIntegrationCoreApiCodecSerializer : public flutter::StandardCodecSeria HostIntegrationCoreApiCodecSerializer(); public: - void WriteValue(const flutter::EncodableValue& value, flutter::ByteStreamWriter* stream) const override; + void WriteValue(const flutter::EncodableValue& value, + flutter::ByteStreamWriter* stream) const override; protected: - flutter::EncodableValue ReadValueOfType(uint8_t type, flutter::ByteStreamReader* stream) const override; - + flutter::EncodableValue ReadValueOfType( + uint8_t type, flutter::ByteStreamReader* stream) const override; }; // The core interface that each host language plugin must implement in // platform_test integration tests. // -// Generated interface from Pigeon that represents a handler of messages from Flutter. +// Generated interface from Pigeon that represents a handler of messages from +// Flutter. class HostIntegrationCoreApi { public: HostIntegrationCoreApi(const HostIntegrationCoreApi&) = delete; HostIntegrationCoreApi& operator=(const HostIntegrationCoreApi&) = delete; - virtual ~HostIntegrationCoreApi() { }; + virtual ~HostIntegrationCoreApi(){}; // A no-op function taking no arguments and returning no value, to sanity // test basic calling. virtual std::optional Noop() = 0; // Returns the passed object, to test serialization and deserialization. virtual ErrorOr EchoAllTypes(const AllTypes& everything) = 0; // Returns the passed object, to test serialization and deserialization. - virtual ErrorOr> EchoAllNullableTypes(const AllNullableTypes* everything) = 0; + virtual ErrorOr> EchoAllNullableTypes( + const AllNullableTypes* everything) = 0; // Returns an error, to test error handling. virtual std::optional ThrowError() = 0; // Returns passed in int. @@ -291,51 +282,70 @@ class HostIntegrationCoreApi { // Returns the passed in string. virtual ErrorOr EchoString(const std::string& a_string) = 0; // Returns the passed in Uint8List. - virtual ErrorOr> EchoUint8List(const std::vector& a_uint8_list) = 0; + virtual ErrorOr> EchoUint8List( + const std::vector& a_uint8_list) = 0; // Returns the passed in generic Object. - virtual ErrorOr EchoObject(const flutter::EncodableValue& an_object) = 0; + virtual ErrorOr EchoObject( + const flutter::EncodableValue& an_object) = 0; // Returns the inner `aString` value from the wrapped object, to test // sending of nested objects. - virtual ErrorOr> ExtractNestedNullableString(const AllNullableTypesWrapper& wrapper) = 0; + virtual ErrorOr> ExtractNestedNullableString( + const AllNullableTypesWrapper& wrapper) = 0; // Returns the inner `aString` value from the wrapped object, to test // sending of nested objects. - virtual ErrorOr CreateNestedNullableString(const std::string* nullable_string) = 0; + virtual ErrorOr CreateNestedNullableString( + const std::string* nullable_string) = 0; // Returns passed in arguments of multiple types. - virtual ErrorOr SendMultipleNullableTypes(const bool* a_nullable_bool, const int64_t* a_nullable_int, const std::string* a_nullable_string) = 0; + virtual ErrorOr SendMultipleNullableTypes( + const bool* a_nullable_bool, const int64_t* a_nullable_int, + const std::string* a_nullable_string) = 0; // Returns passed in int. - virtual ErrorOr> EchoNullableInt(const int64_t* a_nullable_int) = 0; + virtual ErrorOr> EchoNullableInt( + const int64_t* a_nullable_int) = 0; // Returns passed in double. - virtual ErrorOr> EchoNullableDouble(const double* a_nullable_double) = 0; + virtual ErrorOr> EchoNullableDouble( + const double* a_nullable_double) = 0; // Returns the passed in boolean. - virtual ErrorOr> EchoNullableBool(const bool* a_nullable_bool) = 0; + virtual ErrorOr> EchoNullableBool( + const bool* a_nullable_bool) = 0; // Returns the passed in string. - virtual ErrorOr> EchoNullableString(const std::string* a_nullable_string) = 0; + virtual ErrorOr> EchoNullableString( + const std::string* a_nullable_string) = 0; // Returns the passed in Uint8List. - virtual ErrorOr>> EchoNullableUint8List(const std::vector* a_nullable_uint8_list) = 0; + virtual ErrorOr>> EchoNullableUint8List( + const std::vector* a_nullable_uint8_list) = 0; // Returns the passed in generic Object. - virtual ErrorOr> EchoNullableObject(const flutter::EncodableValue* a_nullable_object) = 0; + virtual ErrorOr> EchoNullableObject( + const flutter::EncodableValue* a_nullable_object) = 0; // A no-op function taking no arguments and returning no value, to sanity // test basic asynchronous calling. - virtual void NoopAsync(std::function reply)> result) = 0; + virtual void NoopAsync( + std::function reply)> result) = 0; // Returns the passed string asynchronously. - virtual void EchoAsyncString(const std::string& a_string, std::function reply)> result) = 0; - virtual void CallFlutterNoop(std::function reply)> result) = 0; - virtual void CallFlutterEchoString(const std::string& a_string, std::function reply)> result) = 0; + virtual void EchoAsyncString( + const std::string& a_string, + std::function reply)> result) = 0; + virtual void CallFlutterNoop( + std::function reply)> result) = 0; + virtual void CallFlutterEchoString( + const std::string& a_string, + std::function reply)> result) = 0; // The codec used by HostIntegrationCoreApi. static const flutter::StandardMessageCodec& GetCodec(); - // Sets up an instance of `HostIntegrationCoreApi` to handle messages through the `binary_messenger`. - static void SetUp(flutter::BinaryMessenger* binary_messenger, HostIntegrationCoreApi* api); + // Sets up an instance of `HostIntegrationCoreApi` to handle messages through + // the `binary_messenger`. + static void SetUp(flutter::BinaryMessenger* binary_messenger, + HostIntegrationCoreApi* api); static flutter::EncodableValue WrapError(std::string_view error_message); static flutter::EncodableValue WrapError(const FlutterError& error); protected: HostIntegrationCoreApi() = default; - }; -class FlutterIntegrationCoreApiCodecSerializer : public flutter::StandardCodecSerializer { +class FlutterIntegrationCoreApiCodecSerializer + : public flutter::StandardCodecSerializer { public: - inline static FlutterIntegrationCoreApiCodecSerializer& GetInstance() { static FlutterIntegrationCoreApiCodecSerializer sInstance; return sInstance; @@ -344,17 +354,19 @@ class FlutterIntegrationCoreApiCodecSerializer : public flutter::StandardCodecSe FlutterIntegrationCoreApiCodecSerializer(); public: - void WriteValue(const flutter::EncodableValue& value, flutter::ByteStreamWriter* stream) const override; + void WriteValue(const flutter::EncodableValue& value, + flutter::ByteStreamWriter* stream) const override; protected: - flutter::EncodableValue ReadValueOfType(uint8_t type, flutter::ByteStreamReader* stream) const override; - + flutter::EncodableValue ReadValueOfType( + uint8_t type, flutter::ByteStreamReader* stream) const override; }; // The core interface that the Dart platform_test code implements for host // integration tests to call into. // -// Generated class from Pigeon that represents Flutter messages that can be called from C++. +// Generated class from Pigeon that represents Flutter messages that can be +// called from C++. class FlutterIntegrationCoreApi { private: flutter::BinaryMessenger* binary_messenger_; @@ -364,66 +376,106 @@ class FlutterIntegrationCoreApi { static const flutter::StandardMessageCodec& GetCodec(); // A no-op function taking no arguments and returning no value, to sanity // test basic calling. - void Noop(std::function&& on_success, std::function&& on_error); + void Noop(std::function&& on_success, + std::function&& on_error); // Returns the passed object, to test serialization and deserialization. - void EchoAllTypes(const AllTypes& everything, std::function&& on_success, std::function&& on_error); + void EchoAllTypes(const AllTypes& everything, + std::function&& on_success, + std::function&& on_error); // Returns the passed object, to test serialization and deserialization. - void EchoAllNullableTypes(const AllNullableTypes& everything, std::function&& on_success, std::function&& on_error); + void EchoAllNullableTypes( + const AllNullableTypes& everything, + std::function&& on_success, + std::function&& on_error); // Returns passed in arguments of multiple types. // // Tests multiple-arity FlutterApi handling. - void SendMultipleNullableTypes(const bool* a_nullable_bool, const int64_t* a_nullable_int, const std::string* a_nullable_string, std::function&& on_success, std::function&& on_error); + void SendMultipleNullableTypes( + const bool* a_nullable_bool, const int64_t* a_nullable_int, + const std::string* a_nullable_string, + std::function&& on_success, + std::function&& on_error); // Returns the passed boolean, to test serialization and deserialization. - void EchoBool(bool a_bool, std::function&& on_success, std::function&& on_error); + void EchoBool(bool a_bool, std::function&& on_success, + std::function&& on_error); // Returns the passed int, to test serialization and deserialization. - void EchoInt(int64_t an_int, std::function&& on_success, std::function&& on_error); + void EchoInt(int64_t an_int, std::function&& on_success, + std::function&& on_error); // Returns the passed double, to test serialization and deserialization. - void EchoDouble(double a_double, std::function&& on_success, std::function&& on_error); + void EchoDouble(double a_double, std::function&& on_success, + std::function&& on_error); // Returns the passed string, to test serialization and deserialization. - void EchoString(const std::string& a_string, std::function&& on_success, std::function&& on_error); + void EchoString(const std::string& a_string, + std::function&& on_success, + std::function&& on_error); // Returns the passed byte list, to test serialization and deserialization. - void EchoUint8List(const std::vector& a_list, std::function&)>&& on_success, std::function&& on_error); + void EchoUint8List( + const std::vector& a_list, + std::function&)>&& on_success, + std::function&& on_error); // Returns the passed list, to test serialization and deserialization. - void EchoList(const flutter::EncodableList& a_list, std::function&& on_success, std::function&& on_error); + void EchoList(const flutter::EncodableList& a_list, + std::function&& on_success, + std::function&& on_error); // Returns the passed map, to test serialization and deserialization. - void EchoMap(const flutter::EncodableMap& a_map, std::function&& on_success, std::function&& on_error); + void EchoMap(const flutter::EncodableMap& a_map, + std::function&& on_success, + std::function&& on_error); // Returns the passed boolean, to test serialization and deserialization. - void EchoNullableBool(const bool* a_bool, std::function&& on_success, std::function&& on_error); + void EchoNullableBool(const bool* a_bool, + std::function&& on_success, + std::function&& on_error); // Returns the passed int, to test serialization and deserialization. - void EchoNullableInt(const int64_t* an_int, std::function&& on_success, std::function&& on_error); + void EchoNullableInt(const int64_t* an_int, + std::function&& on_success, + std::function&& on_error); // Returns the passed double, to test serialization and deserialization. - void EchoNullableDouble(const double* a_double, std::function&& on_success, std::function&& on_error); + void EchoNullableDouble(const double* a_double, + std::function&& on_success, + std::function&& on_error); // Returns the passed string, to test serialization and deserialization. - void EchoNullableString(const std::string* a_string, std::function&& on_success, std::function&& on_error); + void EchoNullableString(const std::string* a_string, + std::function&& on_success, + std::function&& on_error); // Returns the passed byte list, to test serialization and deserialization. - void EchoNullableUint8List(const std::vector* a_list, std::function*)>&& on_success, std::function&& on_error); + void EchoNullableUint8List( + const std::vector* a_list, + std::function*)>&& on_success, + std::function&& on_error); // Returns the passed list, to test serialization and deserialization. - void EchoNullableList(const flutter::EncodableList* a_list, std::function&& on_success, std::function&& on_error); + void EchoNullableList( + const flutter::EncodableList* a_list, + std::function&& on_success, + std::function&& on_error); // Returns the passed map, to test serialization and deserialization. - void EchoNullableMap(const flutter::EncodableMap& a_map, std::function&& on_success, std::function&& on_error); - + void EchoNullableMap( + const flutter::EncodableMap& a_map, + std::function&& on_success, + std::function&& on_error); }; // An API that can be implemented for minimal, compile-only tests. // -// Generated interface from Pigeon that represents a handler of messages from Flutter. +// Generated interface from Pigeon that represents a handler of messages from +// Flutter. class HostTrivialApi { public: HostTrivialApi(const HostTrivialApi&) = delete; HostTrivialApi& operator=(const HostTrivialApi&) = delete; - virtual ~HostTrivialApi() { }; + virtual ~HostTrivialApi(){}; virtual std::optional Noop() = 0; // The codec used by HostTrivialApi. static const flutter::StandardMessageCodec& GetCodec(); - // Sets up an instance of `HostTrivialApi` to handle messages through the `binary_messenger`. - static void SetUp(flutter::BinaryMessenger* binary_messenger, HostTrivialApi* api); + // Sets up an instance of `HostTrivialApi` to handle messages through the + // `binary_messenger`. + static void SetUp(flutter::BinaryMessenger* binary_messenger, + HostTrivialApi* api); static flutter::EncodableValue WrapError(std::string_view error_message); static flutter::EncodableValue WrapError(const FlutterError& error); protected: HostTrivialApi() = default; - }; } // namespace core_tests_pigeontest #endif // PIGEON_CORE_TESTS_GEN_H_ From 4bc40a3beb206497205edeb4e1f5052ae2c9e866 Mon Sep 17 00:00:00 2001 From: Ailton Vieira Pinto Filho Date: Wed, 18 Jan 2023 16:11:32 -0300 Subject: [PATCH 15/26] Run format --- .../mock_handler_tester/test/message.dart | 53 +- .../pigeon/mock_handler_tester/test/test.dart | 39 +- .../CoreTests.java | 1714 +++++++----- .../ios/Classes/CoreTests.gen.h | 219 +- .../ios/Classes/CoreTests.gen.m | 968 +++---- .../lib/core_tests.gen.dart | 211 +- .../lib/multiple_arity.gen.dart | 13 +- .../lib/non_null_fields.gen.dart | 52 +- .../lib/null_fields.gen.dart | 38 +- .../lib/null_safe_pigeon.dart | 27 +- .../lib/nullable_returns.gen.dart | 27 +- .../lib/primitive.dart | 59 +- .../lib/src/generated/core_tests.gen.dart | 211 +- .../windows/pigeon/core_tests.gen.cpp | 2424 ++++++++++------- .../windows/pigeon/core_tests.gen.h | 218 +- 15 files changed, 3731 insertions(+), 2542 deletions(-) diff --git a/packages/pigeon/mock_handler_tester/test/message.dart b/packages/pigeon/mock_handler_tester/test/message.dart index 8dea3d31967..cad4e02e903 100644 --- a/packages/pigeon/mock_handler_tester/test/message.dart +++ b/packages/pigeon/mock_handler_tester/test/message.dart @@ -1,7 +1,7 @@ // 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 (v6.0.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 @@ -125,6 +125,7 @@ class MessageNested { ); } } + class _MessageApiCodec extends StandardMessageCodec { const _MessageApiCodec(); @override @@ -143,16 +144,14 @@ class _MessageApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return MessageSearchReply.decode(readValue(buffer)!); - - case 129: + + case 129: return MessageSearchRequest.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -177,8 +176,7 @@ class MessageApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.MessageApi.initialize', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -223,6 +221,7 @@ class MessageApi { } } } + class _MessageNestedApiCodec extends StandardMessageCodec { const _MessageNestedApiCodec(); @override @@ -244,19 +243,17 @@ class _MessageNestedApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return MessageNested.decode(readValue(buffer)!); - - case 129: + + case 129: return MessageSearchReply.decode(readValue(buffer)!); - - case 130: + + case 130: return MessageSearchRequest.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -302,6 +299,7 @@ class MessageNestedApi { } } } + class _MessageFlutterSearchApiCodec extends StandardMessageCodec { const _MessageFlutterSearchApiCodec(); @override @@ -320,16 +318,14 @@ class _MessageFlutterSearchApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return MessageSearchReply.decode(readValue(buffer)!); - - case 129: + + case 129: return MessageSearchRequest.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -341,7 +337,8 @@ abstract class MessageFlutterSearchApi { /// This comment is to test method documentation comments. MessageSearchReply search(MessageSearchRequest request); - static void setup(MessageFlutterSearchApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(MessageFlutterSearchApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.MessageFlutterSearchApi.search', codec, @@ -351,10 +348,12 @@ abstract class MessageFlutterSearchApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.MessageFlutterSearchApi.search was null.'); + 'Argument for dev.flutter.pigeon.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.MessageFlutterSearchApi.search was null, expected non-null MessageSearchRequest.'); + final MessageSearchRequest? arg_request = + (args[0] as MessageSearchRequest?); + assert(arg_request != null, + 'Argument for dev.flutter.pigeon.MessageFlutterSearchApi.search was null, expected non-null MessageSearchRequest.'); final MessageSearchReply output = api.search(arg_request!); return output; }); diff --git a/packages/pigeon/mock_handler_tester/test/test.dart b/packages/pigeon/mock_handler_tester/test/test.dart index 5da9e1db737..dd1df05774f 100644 --- a/packages/pigeon/mock_handler_tester/test/test.dart +++ b/packages/pigeon/mock_handler_tester/test/test.dart @@ -1,7 +1,7 @@ // 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 (v6.0.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, unnecessary_import @@ -32,16 +32,14 @@ class _TestHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return MessageSearchReply.decode(readValue(buffer)!); - - case 129: + + case 129: return MessageSearchRequest.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -84,10 +82,12 @@ abstract class TestHostApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.MessageApi.search was null.'); + 'Argument for dev.flutter.pigeon.MessageApi.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.MessageApi.search was null, expected non-null MessageSearchRequest.'); + final MessageSearchRequest? arg_request = + (args[0] as MessageSearchRequest?); + assert(arg_request != null, + 'Argument for dev.flutter.pigeon.MessageApi.search was null, expected non-null MessageSearchRequest.'); final MessageSearchReply output = api.search(arg_request!); return [output]; }); @@ -117,19 +117,17 @@ class _TestNestedApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return MessageNested.decode(readValue(buffer)!); - - case 129: + + case 129: return MessageSearchReply.decode(readValue(buffer)!); - - case 130: + + case 130: return MessageSearchRequest.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -153,10 +151,11 @@ abstract class TestNestedApi { } else { channel.setMockMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.MessageNestedApi.search was null.'); + 'Argument for dev.flutter.pigeon.MessageNestedApi.search was null.'); final List args = (message as List?)!; final MessageNested? arg_nested = (args[0] as MessageNested?); - assert(arg_nested != null, 'Argument for dev.flutter.pigeon.MessageNestedApi.search was null, expected non-null MessageNested.'); + assert(arg_nested != null, + 'Argument for dev.flutter.pigeon.MessageNestedApi.search was null, expected non-null MessageNested.'); final MessageSearchReply output = api.search(arg_nested!); return [output]; }); diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java index 29f84f92ac5..a0b058a13d9 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java @@ -1,11 +1,12 @@ // 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 (v6.0.4), do not edit directly. // See also: https://pub.dev/packages/pigeon package com.example.alternate_language_test_plugin; + import android.util.Log; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -15,21 +16,22 @@ import io.flutter.plugin.common.StandardMessageCodec; import java.io.ByteArrayOutputStream; import java.nio.ByteBuffer; -import java.util.Arrays; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Map; -import java.util.HashMap; /** Generated class from Pigeon. */ @SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression"}) public class CoreTests { - @NonNull private static ArrayList wrapError(@NonNull Throwable exception) { + @NonNull + private static ArrayList wrapError(@NonNull Throwable exception) { ArrayList errorList = new ArrayList<>(3); errorList.add(exception.toString()); errorList.add(exception.getClass().getSimpleName()); - errorList.add("Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); + errorList.add( + "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); return errorList; } @@ -39,6 +41,7 @@ public enum AnEnum { THREE(2); private final int index; + private AnEnum(final int index) { this.index = index; } @@ -47,7 +50,11 @@ private AnEnum(final int index) { /** Generated class from Pigeon that represents data sent in messages. */ public static class AllTypes { private @NonNull Boolean aBool; - public @NonNull Boolean getABool() { return aBool; } + + public @NonNull Boolean getABool() { + return aBool; + } + public void setABool(@NonNull Boolean setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"aBool\" is null."); @@ -56,7 +63,11 @@ public void setABool(@NonNull Boolean setterArg) { } private @NonNull Long anInt; - public @NonNull Long getAnInt() { return anInt; } + + public @NonNull Long getAnInt() { + return anInt; + } + public void setAnInt(@NonNull Long setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"anInt\" is null."); @@ -65,7 +76,11 @@ public void setAnInt(@NonNull Long setterArg) { } private @NonNull Double aDouble; - public @NonNull Double getADouble() { return aDouble; } + + public @NonNull Double getADouble() { + return aDouble; + } + public void setADouble(@NonNull Double setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"aDouble\" is null."); @@ -74,7 +89,11 @@ public void setADouble(@NonNull Double setterArg) { } private @NonNull byte[] aByteArray; - public @NonNull byte[] getAByteArray() { return aByteArray; } + + public @NonNull byte[] getAByteArray() { + return aByteArray; + } + public void setAByteArray(@NonNull byte[] setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"aByteArray\" is null."); @@ -83,7 +102,11 @@ public void setAByteArray(@NonNull byte[] setterArg) { } private @NonNull int[] a4ByteArray; - public @NonNull int[] getA4ByteArray() { return a4ByteArray; } + + public @NonNull int[] getA4ByteArray() { + return a4ByteArray; + } + public void setA4ByteArray(@NonNull int[] setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"a4ByteArray\" is null."); @@ -92,7 +115,11 @@ public void setA4ByteArray(@NonNull int[] setterArg) { } private @NonNull long[] a8ByteArray; - public @NonNull long[] getA8ByteArray() { return a8ByteArray; } + + public @NonNull long[] getA8ByteArray() { + return a8ByteArray; + } + public void setA8ByteArray(@NonNull long[] setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"a8ByteArray\" is null."); @@ -101,7 +128,11 @@ public void setA8ByteArray(@NonNull long[] setterArg) { } private @NonNull double[] aFloatArray; - public @NonNull double[] getAFloatArray() { return aFloatArray; } + + public @NonNull double[] getAFloatArray() { + return aFloatArray; + } + public void setAFloatArray(@NonNull double[] setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"aFloatArray\" is null."); @@ -110,7 +141,11 @@ public void setAFloatArray(@NonNull double[] setterArg) { } private @NonNull List aList; - public @NonNull List getAList() { return aList; } + + public @NonNull List getAList() { + return aList; + } + public void setAList(@NonNull List setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"aList\" is null."); @@ -119,7 +154,11 @@ public void setAList(@NonNull List setterArg) { } private @NonNull Map aMap; - public @NonNull Map getAMap() { return aMap; } + + public @NonNull Map getAMap() { + return aMap; + } + public void setAMap(@NonNull Map setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"aMap\" is null."); @@ -128,7 +167,11 @@ public void setAMap(@NonNull Map setterArg) { } private @NonNull AnEnum anEnum; - public @NonNull AnEnum getAnEnum() { return anEnum; } + + public @NonNull AnEnum getAnEnum() { + return anEnum; + } + public void setAnEnum(@NonNull AnEnum setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"anEnum\" is null."); @@ -137,7 +180,11 @@ public void setAnEnum(@NonNull AnEnum setterArg) { } private @NonNull String aString; - public @NonNull String getAString() { return aString; } + + public @NonNull String getAString() { + return aString; + } + public void setAString(@NonNull String setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"aString\" is null."); @@ -145,64 +192,87 @@ public void setAString(@NonNull String setterArg) { this.aString = setterArg; } - /**Constructor is private to enforce null safety; use Builder. */ + /** Constructor is private to enforce null safety; use Builder. */ private AllTypes() {} + public static final class Builder { private @Nullable Boolean aBool; + public @NonNull Builder setABool(@NonNull Boolean setterArg) { this.aBool = setterArg; return this; } + private @Nullable Long anInt; + public @NonNull Builder setAnInt(@NonNull Long setterArg) { this.anInt = setterArg; return this; } + private @Nullable Double aDouble; + public @NonNull Builder setADouble(@NonNull Double setterArg) { this.aDouble = setterArg; return this; } + private @Nullable byte[] aByteArray; + public @NonNull Builder setAByteArray(@NonNull byte[] setterArg) { this.aByteArray = setterArg; return this; } + private @Nullable int[] a4ByteArray; + public @NonNull Builder setA4ByteArray(@NonNull int[] setterArg) { this.a4ByteArray = setterArg; return this; } + private @Nullable long[] a8ByteArray; + public @NonNull Builder setA8ByteArray(@NonNull long[] setterArg) { this.a8ByteArray = setterArg; return this; } + private @Nullable double[] aFloatArray; + public @NonNull Builder setAFloatArray(@NonNull double[] setterArg) { this.aFloatArray = setterArg; return this; } + private @Nullable List aList; + public @NonNull Builder setAList(@NonNull List setterArg) { this.aList = setterArg; return this; } + private @Nullable Map aMap; + public @NonNull Builder setAMap(@NonNull Map setterArg) { this.aMap = setterArg; return this; } + private @Nullable AnEnum anEnum; + public @NonNull Builder setAnEnum(@NonNull AnEnum setterArg) { this.anEnum = setterArg; return this; } + private @Nullable String aString; + public @NonNull Builder setAString(@NonNull String setterArg) { this.aString = setterArg; return this; } + public @NonNull AllTypes build() { AllTypes pigeonReturn = new AllTypes(); pigeonReturn.setABool(aBool); @@ -219,7 +289,9 @@ public static final class Builder { return pigeonReturn; } } - @NonNull ArrayList toList() { + + @NonNull + ArrayList toList() { ArrayList toListResult = new ArrayList(11); toListResult.add(aBool); toListResult.add(anInt); @@ -234,30 +306,32 @@ public static final class Builder { toListResult.add(aString); return toListResult; } + static @NonNull AllTypes fromList(@NonNull ArrayList list) { AllTypes pigeonResult = new AllTypes(); Object aBool = list.get(0); - pigeonResult.setABool((Boolean)aBool); + pigeonResult.setABool((Boolean) aBool); Object anInt = list.get(1); - pigeonResult.setAnInt((anInt == null) ? null : ((anInt instanceof Integer) ? (Integer)anInt : (Long)anInt)); + pigeonResult.setAnInt( + (anInt == null) ? null : ((anInt instanceof Integer) ? (Integer) anInt : (Long) anInt)); Object aDouble = list.get(2); - pigeonResult.setADouble((Double)aDouble); + pigeonResult.setADouble((Double) aDouble); Object aByteArray = list.get(3); - pigeonResult.setAByteArray((byte[])aByteArray); + pigeonResult.setAByteArray((byte[]) aByteArray); Object a4ByteArray = list.get(4); - pigeonResult.setA4ByteArray((int[])a4ByteArray); + pigeonResult.setA4ByteArray((int[]) a4ByteArray); Object a8ByteArray = list.get(5); - pigeonResult.setA8ByteArray((long[])a8ByteArray); + pigeonResult.setA8ByteArray((long[]) a8ByteArray); Object aFloatArray = list.get(6); - pigeonResult.setAFloatArray((double[])aFloatArray); + pigeonResult.setAFloatArray((double[]) aFloatArray); Object aList = list.get(7); - pigeonResult.setAList((List)aList); + pigeonResult.setAList((List) aList); Object aMap = list.get(8); - pigeonResult.setAMap((Map)aMap); + pigeonResult.setAMap((Map) aMap); Object anEnum = list.get(9); - pigeonResult.setAnEnum(anEnum == null ? null : AnEnum.values()[(int)anEnum]); + pigeonResult.setAnEnum(anEnum == null ? null : AnEnum.values()[(int) anEnum]); Object aString = list.get(10); - pigeonResult.setAString((String)aString); + pigeonResult.setAString((String) aString); return pigeonResult; } } @@ -265,160 +339,245 @@ public static final class Builder { /** Generated class from Pigeon that represents data sent in messages. */ public static class AllNullableTypes { private @Nullable Boolean aNullableBool; - public @Nullable Boolean getANullableBool() { return aNullableBool; } + + public @Nullable Boolean getANullableBool() { + return aNullableBool; + } + public void setANullableBool(@Nullable Boolean setterArg) { this.aNullableBool = setterArg; } private @Nullable Long aNullableInt; - public @Nullable Long getANullableInt() { return aNullableInt; } + + public @Nullable Long getANullableInt() { + return aNullableInt; + } + public void setANullableInt(@Nullable Long setterArg) { this.aNullableInt = setterArg; } private @Nullable Double aNullableDouble; - public @Nullable Double getANullableDouble() { return aNullableDouble; } + + public @Nullable Double getANullableDouble() { + return aNullableDouble; + } + public void setANullableDouble(@Nullable Double setterArg) { this.aNullableDouble = setterArg; } private @Nullable byte[] aNullableByteArray; - public @Nullable byte[] getANullableByteArray() { return aNullableByteArray; } + + public @Nullable byte[] getANullableByteArray() { + return aNullableByteArray; + } + public void setANullableByteArray(@Nullable byte[] setterArg) { this.aNullableByteArray = setterArg; } private @Nullable int[] aNullable4ByteArray; - public @Nullable int[] getANullable4ByteArray() { return aNullable4ByteArray; } + + public @Nullable int[] getANullable4ByteArray() { + return aNullable4ByteArray; + } + public void setANullable4ByteArray(@Nullable int[] setterArg) { this.aNullable4ByteArray = setterArg; } private @Nullable long[] aNullable8ByteArray; - public @Nullable long[] getANullable8ByteArray() { return aNullable8ByteArray; } + + public @Nullable long[] getANullable8ByteArray() { + return aNullable8ByteArray; + } + public void setANullable8ByteArray(@Nullable long[] setterArg) { this.aNullable8ByteArray = setterArg; } private @Nullable double[] aNullableFloatArray; - public @Nullable double[] getANullableFloatArray() { return aNullableFloatArray; } + + public @Nullable double[] getANullableFloatArray() { + return aNullableFloatArray; + } + public void setANullableFloatArray(@Nullable double[] setterArg) { this.aNullableFloatArray = setterArg; } private @Nullable List aNullableList; - public @Nullable List getANullableList() { return aNullableList; } + + public @Nullable List getANullableList() { + return aNullableList; + } + public void setANullableList(@Nullable List setterArg) { this.aNullableList = setterArg; } private @Nullable Map aNullableMap; - public @Nullable Map getANullableMap() { return aNullableMap; } + + public @Nullable Map getANullableMap() { + return aNullableMap; + } + public void setANullableMap(@Nullable Map setterArg) { this.aNullableMap = setterArg; } private @Nullable List> nullableNestedList; - public @Nullable List> getNullableNestedList() { return nullableNestedList; } + + public @Nullable List> getNullableNestedList() { + return nullableNestedList; + } + public void setNullableNestedList(@Nullable List> setterArg) { this.nullableNestedList = setterArg; } private @Nullable Map nullableMapWithAnnotations; - public @Nullable Map getNullableMapWithAnnotations() { return nullableMapWithAnnotations; } + + public @Nullable Map getNullableMapWithAnnotations() { + return nullableMapWithAnnotations; + } + public void setNullableMapWithAnnotations(@Nullable Map setterArg) { this.nullableMapWithAnnotations = setterArg; } private @Nullable Map nullableMapWithObject; - public @Nullable Map getNullableMapWithObject() { return nullableMapWithObject; } + + public @Nullable Map getNullableMapWithObject() { + return nullableMapWithObject; + } + public void setNullableMapWithObject(@Nullable Map setterArg) { this.nullableMapWithObject = setterArg; } private @Nullable AnEnum aNullableEnum; - public @Nullable AnEnum getANullableEnum() { return aNullableEnum; } + + public @Nullable AnEnum getANullableEnum() { + return aNullableEnum; + } + public void setANullableEnum(@Nullable AnEnum setterArg) { this.aNullableEnum = setterArg; } private @Nullable String aNullableString; - public @Nullable String getANullableString() { return aNullableString; } + + public @Nullable String getANullableString() { + return aNullableString; + } + public void setANullableString(@Nullable String setterArg) { this.aNullableString = setterArg; } public static final class Builder { private @Nullable Boolean aNullableBool; + public @NonNull Builder setANullableBool(@Nullable Boolean setterArg) { this.aNullableBool = setterArg; return this; } + private @Nullable Long aNullableInt; + public @NonNull Builder setANullableInt(@Nullable Long setterArg) { this.aNullableInt = setterArg; return this; } + private @Nullable Double aNullableDouble; + public @NonNull Builder setANullableDouble(@Nullable Double setterArg) { this.aNullableDouble = setterArg; return this; } + private @Nullable byte[] aNullableByteArray; + public @NonNull Builder setANullableByteArray(@Nullable byte[] setterArg) { this.aNullableByteArray = setterArg; return this; } + private @Nullable int[] aNullable4ByteArray; + public @NonNull Builder setANullable4ByteArray(@Nullable int[] setterArg) { this.aNullable4ByteArray = setterArg; return this; } + private @Nullable long[] aNullable8ByteArray; + public @NonNull Builder setANullable8ByteArray(@Nullable long[] setterArg) { this.aNullable8ByteArray = setterArg; return this; } + private @Nullable double[] aNullableFloatArray; + public @NonNull Builder setANullableFloatArray(@Nullable double[] setterArg) { this.aNullableFloatArray = setterArg; return this; } + private @Nullable List aNullableList; + public @NonNull Builder setANullableList(@Nullable List setterArg) { this.aNullableList = setterArg; return this; } + private @Nullable Map aNullableMap; + public @NonNull Builder setANullableMap(@Nullable Map setterArg) { this.aNullableMap = setterArg; return this; } + private @Nullable List> nullableNestedList; + public @NonNull Builder setNullableNestedList(@Nullable List> setterArg) { this.nullableNestedList = setterArg; return this; } + private @Nullable Map nullableMapWithAnnotations; - public @NonNull Builder setNullableMapWithAnnotations(@Nullable Map setterArg) { + + public @NonNull Builder setNullableMapWithAnnotations( + @Nullable Map setterArg) { this.nullableMapWithAnnotations = setterArg; return this; } + private @Nullable Map nullableMapWithObject; + public @NonNull Builder setNullableMapWithObject(@Nullable Map setterArg) { this.nullableMapWithObject = setterArg; return this; } + private @Nullable AnEnum aNullableEnum; + public @NonNull Builder setANullableEnum(@Nullable AnEnum setterArg) { this.aNullableEnum = setterArg; return this; } + private @Nullable String aNullableString; + public @NonNull Builder setANullableString(@Nullable String setterArg) { this.aNullableString = setterArg; return this; } + public @NonNull AllNullableTypes build() { AllNullableTypes pigeonReturn = new AllNullableTypes(); pigeonReturn.setANullableBool(aNullableBool); @@ -438,7 +597,9 @@ public static final class Builder { return pigeonReturn; } } - @NonNull ArrayList toList() { + + @NonNull + ArrayList toList() { ArrayList toListResult = new ArrayList(14); toListResult.add(aNullableBool); toListResult.add(aNullableInt); @@ -456,36 +617,41 @@ public static final class Builder { toListResult.add(aNullableString); return toListResult; } + static @NonNull AllNullableTypes fromList(@NonNull ArrayList list) { AllNullableTypes pigeonResult = new AllNullableTypes(); Object aNullableBool = list.get(0); - pigeonResult.setANullableBool((Boolean)aNullableBool); + pigeonResult.setANullableBool((Boolean) aNullableBool); Object aNullableInt = list.get(1); - pigeonResult.setANullableInt((aNullableInt == null) ? null : ((aNullableInt instanceof Integer) ? (Integer)aNullableInt : (Long)aNullableInt)); + pigeonResult.setANullableInt( + (aNullableInt == null) + ? null + : ((aNullableInt instanceof Integer) ? (Integer) aNullableInt : (Long) aNullableInt)); Object aNullableDouble = list.get(2); - pigeonResult.setANullableDouble((Double)aNullableDouble); + pigeonResult.setANullableDouble((Double) aNullableDouble); Object aNullableByteArray = list.get(3); - pigeonResult.setANullableByteArray((byte[])aNullableByteArray); + pigeonResult.setANullableByteArray((byte[]) aNullableByteArray); Object aNullable4ByteArray = list.get(4); - pigeonResult.setANullable4ByteArray((int[])aNullable4ByteArray); + pigeonResult.setANullable4ByteArray((int[]) aNullable4ByteArray); Object aNullable8ByteArray = list.get(5); - pigeonResult.setANullable8ByteArray((long[])aNullable8ByteArray); + pigeonResult.setANullable8ByteArray((long[]) aNullable8ByteArray); Object aNullableFloatArray = list.get(6); - pigeonResult.setANullableFloatArray((double[])aNullableFloatArray); + pigeonResult.setANullableFloatArray((double[]) aNullableFloatArray); Object aNullableList = list.get(7); - pigeonResult.setANullableList((List)aNullableList); + pigeonResult.setANullableList((List) aNullableList); Object aNullableMap = list.get(8); - pigeonResult.setANullableMap((Map)aNullableMap); + pigeonResult.setANullableMap((Map) aNullableMap); Object nullableNestedList = list.get(9); - pigeonResult.setNullableNestedList((List>)nullableNestedList); + pigeonResult.setNullableNestedList((List>) nullableNestedList); Object nullableMapWithAnnotations = list.get(10); - pigeonResult.setNullableMapWithAnnotations((Map)nullableMapWithAnnotations); + pigeonResult.setNullableMapWithAnnotations((Map) nullableMapWithAnnotations); Object nullableMapWithObject = list.get(11); - pigeonResult.setNullableMapWithObject((Map)nullableMapWithObject); + pigeonResult.setNullableMapWithObject((Map) nullableMapWithObject); Object aNullableEnum = list.get(12); - pigeonResult.setANullableEnum(aNullableEnum == null ? null : AnEnum.values()[(int)aNullableEnum]); + pigeonResult.setANullableEnum( + aNullableEnum == null ? null : AnEnum.values()[(int) aNullableEnum]); Object aNullableString = list.get(13); - pigeonResult.setANullableString((String)aNullableString); + pigeonResult.setANullableString((String) aNullableString); return pigeonResult; } } @@ -493,7 +659,11 @@ public static final class Builder { /** Generated class from Pigeon that represents data sent in messages. */ public static class AllNullableTypesWrapper { private @NonNull AllNullableTypes values; - public @NonNull AllNullableTypes getValues() { return values; } + + public @NonNull AllNullableTypes getValues() { + return values; + } + public void setValues(@NonNull AllNullableTypes setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"values\" is null."); @@ -501,1006 +671,1204 @@ public void setValues(@NonNull AllNullableTypes setterArg) { this.values = setterArg; } - /**Constructor is private to enforce null safety; use Builder. */ + /** Constructor is private to enforce null safety; use Builder. */ private AllNullableTypesWrapper() {} + public static final class Builder { private @Nullable AllNullableTypes values; + public @NonNull Builder setValues(@NonNull AllNullableTypes setterArg) { this.values = setterArg; return this; } + public @NonNull AllNullableTypesWrapper build() { AllNullableTypesWrapper pigeonReturn = new AllNullableTypesWrapper(); pigeonReturn.setValues(values); return pigeonReturn; } } - @NonNull ArrayList toList() { + + @NonNull + ArrayList toList() { ArrayList toListResult = new ArrayList(1); toListResult.add((values == null) ? null : values.toList()); return toListResult; } + static @NonNull AllNullableTypesWrapper fromList(@NonNull ArrayList list) { AllNullableTypesWrapper pigeonResult = new AllNullableTypesWrapper(); Object values = list.get(0); - pigeonResult.setValues((values == null) ? null : AllNullableTypes.fromList((ArrayList)values)); + pigeonResult.setValues( + (values == null) ? null : AllNullableTypes.fromList((ArrayList) values)); return pigeonResult; } } public interface Result { void success(T result); + void error(Throwable error); } + private static class HostIntegrationCoreApiCodec extends StandardMessageCodec { public static final HostIntegrationCoreApiCodec INSTANCE = new HostIntegrationCoreApiCodec(); + private HostIntegrationCoreApiCodec() {} + @Override protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { switch (type) { - case (byte)128: + case (byte) 128: return AllNullableTypes.fromList((ArrayList) readValue(buffer)); - - case (byte)129: + + case (byte) 129: return AllNullableTypesWrapper.fromList((ArrayList) readValue(buffer)); - - case (byte)130: + + case (byte) 130: return AllTypes.fromList((ArrayList) readValue(buffer)); - - default: + + default: return super.readValueOfType(type, buffer); - } } + @Override - protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { + protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { if (value instanceof AllNullableTypes) { stream.write(128); writeValue(stream, ((AllNullableTypes) value).toList()); - } else - if (value instanceof AllNullableTypesWrapper) { + } else if (value instanceof AllNullableTypesWrapper) { stream.write(129); writeValue(stream, ((AllNullableTypesWrapper) value).toList()); - } else - if (value instanceof AllTypes) { + } else if (value instanceof AllTypes) { stream.write(130); writeValue(stream, ((AllTypes) value).toList()); - } else -{ + } else { super.writeValue(stream, value); } } } /** - * The core interface that each host language plugin must implement in - * platform_test integration tests. + * The core interface that each host language plugin must implement in platform_test integration + * tests. * - * Generated interface from Pigeon that represents a handler of messages from Flutter. + *

Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface HostIntegrationCoreApi { /** - * A no-op function taking no arguments and returning no value, to sanity - * test basic calling. + * A no-op function taking no arguments and returning no value, to sanity test basic calling. */ void noop(); /** Returns the passed object, to test serialization and deserialization. */ - @NonNull AllTypes echoAllTypes(@NonNull AllTypes everything); + @NonNull + AllTypes echoAllTypes(@NonNull AllTypes everything); /** Returns the passed object, to test serialization and deserialization. */ - @Nullable AllNullableTypes echoAllNullableTypes(@Nullable AllNullableTypes everything); + @Nullable + AllNullableTypes echoAllNullableTypes(@Nullable AllNullableTypes everything); /** Returns an error, to test error handling. */ void throwError(); /** Returns passed in int. */ - @NonNull Long echoInt(@NonNull Long anInt); + @NonNull + Long echoInt(@NonNull Long anInt); /** Returns passed in double. */ - @NonNull Double echoDouble(@NonNull Double aDouble); + @NonNull + Double echoDouble(@NonNull Double aDouble); /** Returns the passed in boolean. */ - @NonNull Boolean echoBool(@NonNull Boolean aBool); + @NonNull + Boolean echoBool(@NonNull Boolean aBool); /** Returns the passed in string. */ - @NonNull String echoString(@NonNull String aString); + @NonNull + String echoString(@NonNull String aString); /** Returns the passed in Uint8List. */ - @NonNull byte[] echoUint8List(@NonNull byte[] aUint8List); + @NonNull + byte[] echoUint8List(@NonNull byte[] aUint8List); /** Returns the passed in generic Object. */ - @NonNull Object echoObject(@NonNull Object anObject); + @NonNull + Object echoObject(@NonNull Object anObject); /** - * Returns the inner `aString` value from the wrapped object, to test - * sending of nested objects. + * Returns the inner `aString` value from the wrapped object, to test sending of nested objects. */ - @Nullable String extractNestedNullableString(@NonNull AllNullableTypesWrapper wrapper); + @Nullable + String extractNestedNullableString(@NonNull AllNullableTypesWrapper wrapper); /** - * Returns the inner `aString` value from the wrapped object, to test - * sending of nested objects. + * Returns the inner `aString` value from the wrapped object, to test sending of nested objects. */ - @NonNull AllNullableTypesWrapper createNestedNullableString(@Nullable String nullableString); + @NonNull + AllNullableTypesWrapper createNestedNullableString(@Nullable String nullableString); /** Returns passed in arguments of multiple types. */ - @NonNull AllNullableTypes sendMultipleNullableTypes(@Nullable Boolean aNullableBool, @Nullable Long aNullableInt, @Nullable String aNullableString); + @NonNull + AllNullableTypes sendMultipleNullableTypes( + @Nullable Boolean aNullableBool, + @Nullable Long aNullableInt, + @Nullable String aNullableString); /** Returns passed in int. */ - @Nullable Long echoNullableInt(@Nullable Long aNullableInt); + @Nullable + Long echoNullableInt(@Nullable Long aNullableInt); /** Returns passed in double. */ - @Nullable Double echoNullableDouble(@Nullable Double aNullableDouble); + @Nullable + Double echoNullableDouble(@Nullable Double aNullableDouble); /** Returns the passed in boolean. */ - @Nullable Boolean echoNullableBool(@Nullable Boolean aNullableBool); + @Nullable + Boolean echoNullableBool(@Nullable Boolean aNullableBool); /** Returns the passed in string. */ - @Nullable String echoNullableString(@Nullable String aNullableString); + @Nullable + String echoNullableString(@Nullable String aNullableString); /** Returns the passed in Uint8List. */ - @Nullable byte[] echoNullableUint8List(@Nullable byte[] aNullableUint8List); + @Nullable + byte[] echoNullableUint8List(@Nullable byte[] aNullableUint8List); /** Returns the passed in generic Object. */ - @Nullable Object echoNullableObject(@Nullable Object aNullableObject); + @Nullable + Object echoNullableObject(@Nullable Object aNullableObject); /** - * A no-op function taking no arguments and returning no value, to sanity - * test basic asynchronous calling. + * A no-op function taking no arguments and returning no value, to sanity test basic + * asynchronous calling. */ void noopAsync(Result result); /** Returns the passed string asynchronously. */ void echoAsyncString(@NonNull String aString, Result result); + void callFlutterNoop(Result result); + void callFlutterEchoString(@NonNull String aString, Result result); /** The codec used by HostIntegrationCoreApi. */ static MessageCodec getCodec() { - return HostIntegrationCoreApiCodec.INSTANCE; } - /**Sets up an instance of `HostIntegrationCoreApi` to handle messages through the `binaryMessenger`. */ + return HostIntegrationCoreApiCodec.INSTANCE; + } + /** + * Sets up an instance of `HostIntegrationCoreApi` to handle messages through the + * `binaryMessenger`. + */ static void setup(BinaryMessenger binaryMessenger, HostIntegrationCoreApi api) { { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.noop", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.noop", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - api.noop(); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + api.noop(); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAllTypes", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoAllTypes", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - AllTypes everythingArg = (AllTypes)args.get(0); - if (everythingArg == null) { - throw new NullPointerException("everythingArg unexpectedly null."); - } - AllTypes output = api.echoAllTypes(everythingArg); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + AllTypes everythingArg = (AllTypes) args.get(0); + if (everythingArg == null) { + throw new NullPointerException("everythingArg unexpectedly null."); + } + AllTypes output = api.echoAllTypes(everythingArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAllNullableTypes", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoAllNullableTypes", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - AllNullableTypes everythingArg = (AllNullableTypes)args.get(0); - AllNullableTypes output = api.echoAllNullableTypes(everythingArg); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + AllNullableTypes everythingArg = (AllNullableTypes) args.get(0); + AllNullableTypes output = api.echoAllNullableTypes(everythingArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.throwError", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.throwError", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - api.throwError(); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + api.throwError(); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoInt", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoInt", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number anIntArg = (Number)args.get(0); - if (anIntArg == null) { - throw new NullPointerException("anIntArg unexpectedly null."); - } - Long output = api.echoInt((anIntArg == null) ? null : anIntArg.longValue()); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number anIntArg = (Number) args.get(0); + if (anIntArg == null) { + throw new NullPointerException("anIntArg unexpectedly null."); + } + Long output = api.echoInt((anIntArg == null) ? null : anIntArg.longValue()); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoDouble", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoDouble", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Double aDoubleArg = (Double)args.get(0); - if (aDoubleArg == null) { - throw new NullPointerException("aDoubleArg unexpectedly null."); - } - Double output = api.echoDouble(aDoubleArg); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Double aDoubleArg = (Double) args.get(0); + if (aDoubleArg == null) { + throw new NullPointerException("aDoubleArg unexpectedly null."); + } + Double output = api.echoDouble(aDoubleArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoBool", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoBool", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Boolean aBoolArg = (Boolean)args.get(0); - if (aBoolArg == null) { - throw new NullPointerException("aBoolArg unexpectedly null."); - } - Boolean output = api.echoBool(aBoolArg); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Boolean aBoolArg = (Boolean) args.get(0); + if (aBoolArg == null) { + throw new NullPointerException("aBoolArg unexpectedly null."); + } + Boolean output = api.echoBool(aBoolArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoString", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoString", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - String aStringArg = (String)args.get(0); - if (aStringArg == null) { - throw new NullPointerException("aStringArg unexpectedly null."); - } - String output = api.echoString(aStringArg); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String aStringArg = (String) args.get(0); + if (aStringArg == null) { + throw new NullPointerException("aStringArg unexpectedly null."); + } + String output = api.echoString(aStringArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoUint8List", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoUint8List", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - byte[] aUint8ListArg = (byte[])args.get(0); - if (aUint8ListArg == null) { - throw new NullPointerException("aUint8ListArg unexpectedly null."); - } - byte[] output = api.echoUint8List(aUint8ListArg); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + byte[] aUint8ListArg = (byte[]) args.get(0); + if (aUint8ListArg == null) { + throw new NullPointerException("aUint8ListArg unexpectedly null."); + } + byte[] output = api.echoUint8List(aUint8ListArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoObject", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoObject", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Object anObjectArg = args.get(0); - if (anObjectArg == null) { - throw new NullPointerException("anObjectArg unexpectedly null."); - } - Object output = api.echoObject(anObjectArg); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Object anObjectArg = args.get(0); + if (anObjectArg == null) { + throw new NullPointerException("anObjectArg unexpectedly null."); + } + Object output = api.echoObject(anObjectArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.extractNestedNullableString", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.extractNestedNullableString", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - AllNullableTypesWrapper wrapperArg = (AllNullableTypesWrapper)args.get(0); - if (wrapperArg == null) { - throw new NullPointerException("wrapperArg unexpectedly null."); - } - String output = api.extractNestedNullableString(wrapperArg); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + AllNullableTypesWrapper wrapperArg = (AllNullableTypesWrapper) args.get(0); + if (wrapperArg == null) { + throw new NullPointerException("wrapperArg unexpectedly null."); + } + String output = api.extractNestedNullableString(wrapperArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.createNestedNullableString", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.createNestedNullableString", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - String nullableStringArg = (String)args.get(0); - AllNullableTypesWrapper output = api.createNestedNullableString(nullableStringArg); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String nullableStringArg = (String) args.get(0); + AllNullableTypesWrapper output = + api.createNestedNullableString(nullableStringArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.sendMultipleNullableTypes", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.sendMultipleNullableTypes", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Boolean aNullableBoolArg = (Boolean)args.get(0); - Number aNullableIntArg = (Number)args.get(1); - String aNullableStringArg = (String)args.get(2); - AllNullableTypes output = api.sendMultipleNullableTypes(aNullableBoolArg, (aNullableIntArg == null) ? null : aNullableIntArg.longValue(), aNullableStringArg); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Boolean aNullableBoolArg = (Boolean) args.get(0); + Number aNullableIntArg = (Number) args.get(1); + String aNullableStringArg = (String) args.get(2); + AllNullableTypes output = + api.sendMultipleNullableTypes( + aNullableBoolArg, + (aNullableIntArg == null) ? null : aNullableIntArg.longValue(), + aNullableStringArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableInt", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableInt", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Number aNullableIntArg = (Number)args.get(0); - Long output = api.echoNullableInt((aNullableIntArg == null) ? null : aNullableIntArg.longValue()); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number aNullableIntArg = (Number) args.get(0); + Long output = + api.echoNullableInt( + (aNullableIntArg == null) ? null : aNullableIntArg.longValue()); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableDouble", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableDouble", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Double aNullableDoubleArg = (Double)args.get(0); - Double output = api.echoNullableDouble(aNullableDoubleArg); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Double aNullableDoubleArg = (Double) args.get(0); + Double output = api.echoNullableDouble(aNullableDoubleArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableBool", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableBool", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Boolean aNullableBoolArg = (Boolean)args.get(0); - Boolean output = api.echoNullableBool(aNullableBoolArg); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Boolean aNullableBoolArg = (Boolean) args.get(0); + Boolean output = api.echoNullableBool(aNullableBoolArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableString", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableString", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - String aNullableStringArg = (String)args.get(0); - String output = api.echoNullableString(aNullableStringArg); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String aNullableStringArg = (String) args.get(0); + String output = api.echoNullableString(aNullableStringArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableUint8List", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableUint8List", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - byte[] aNullableUint8ListArg = (byte[])args.get(0); - byte[] output = api.echoNullableUint8List(aNullableUint8ListArg); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + byte[] aNullableUint8ListArg = (byte[]) args.get(0); + byte[] output = api.echoNullableUint8List(aNullableUint8ListArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableObject", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableObject", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - Object aNullableObjectArg = args.get(0); - Object output = api.echoNullableObject(aNullableObjectArg); - wrapped.add(0, output); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Object aNullableObjectArg = args.get(0); + Object output = api.echoNullableObject(aNullableObjectArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.noopAsync", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.noopAsync", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - Result resultCallback = new Result() { - public void success(Void result) { - wrapped.add(0, null); - reply.reply(wrapped); - } - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + Result resultCallback = + new Result() { + public void success(Void result) { + wrapped.add(0, null); + reply.reply(wrapped); + } + + public void error(Throwable error) { + ArrayList wrappedError = wrapError(error); + reply.reply(wrappedError); + } + }; + + api.noopAsync(resultCallback); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); reply.reply(wrappedError); } - }; - - api.noopAsync(resultCallback); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - reply.reply(wrappedError); - } - }); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncString", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncString", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - String aStringArg = (String)args.get(0); - if (aStringArg == null) { - throw new NullPointerException("aStringArg unexpectedly null."); - } - Result resultCallback = new Result() { - public void success(String result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String aStringArg = (String) args.get(0); + if (aStringArg == null) { + throw new NullPointerException("aStringArg unexpectedly null."); + } + Result resultCallback = + new Result() { + public void success(String result) { + wrapped.add(0, result); + reply.reply(wrapped); + } + + public void error(Throwable error) { + ArrayList wrappedError = wrapError(error); + reply.reply(wrappedError); + } + }; + + api.echoAsyncString(aStringArg, resultCallback); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); reply.reply(wrappedError); } - }; - - api.echoAsyncString(aStringArg, resultCallback); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - reply.reply(wrappedError); - } - }); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterNoop", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterNoop", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - Result resultCallback = new Result() { - public void success(Void result) { - wrapped.add(0, null); - reply.reply(wrapped); - } - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + Result resultCallback = + new Result() { + public void success(Void result) { + wrapped.add(0, null); + reply.reply(wrapped); + } + + public void error(Throwable error) { + ArrayList wrappedError = wrapError(error); + reply.reply(wrappedError); + } + }; + + api.callFlutterNoop(resultCallback); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); reply.reply(wrappedError); } - }; - - api.callFlutterNoop(resultCallback); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - reply.reply(wrappedError); - } - }); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoString", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoString", + getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - ArrayList args = (ArrayList)message; - assert args != null; - String aStringArg = (String)args.get(0); - if (aStringArg == null) { - throw new NullPointerException("aStringArg unexpectedly null."); - } - Result resultCallback = new Result() { - public void success(String result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String aStringArg = (String) args.get(0); + if (aStringArg == null) { + throw new NullPointerException("aStringArg unexpectedly null."); + } + Result resultCallback = + new Result() { + public void success(String result) { + wrapped.add(0, result); + reply.reply(wrapped); + } + + public void error(Throwable error) { + ArrayList wrappedError = wrapError(error); + reply.reply(wrappedError); + } + }; + + api.callFlutterEchoString(aStringArg, resultCallback); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); reply.reply(wrappedError); } - }; - - api.callFlutterEchoString(aStringArg, resultCallback); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - reply.reply(wrappedError); - } - }); + }); } else { channel.setMessageHandler(null); } } } } + private static class FlutterIntegrationCoreApiCodec extends StandardMessageCodec { - public static final FlutterIntegrationCoreApiCodec INSTANCE = new FlutterIntegrationCoreApiCodec(); + public static final FlutterIntegrationCoreApiCodec INSTANCE = + new FlutterIntegrationCoreApiCodec(); + private FlutterIntegrationCoreApiCodec() {} + @Override protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { switch (type) { - case (byte)128: + case (byte) 128: return AllNullableTypes.fromList((ArrayList) readValue(buffer)); - - case (byte)129: + + case (byte) 129: return AllNullableTypesWrapper.fromList((ArrayList) readValue(buffer)); - - case (byte)130: + + case (byte) 130: return AllTypes.fromList((ArrayList) readValue(buffer)); - - default: + + default: return super.readValueOfType(type, buffer); - } } + @Override - protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { + protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { if (value instanceof AllNullableTypes) { stream.write(128); writeValue(stream, ((AllNullableTypes) value).toList()); - } else - if (value instanceof AllNullableTypesWrapper) { + } else if (value instanceof AllNullableTypesWrapper) { stream.write(129); writeValue(stream, ((AllNullableTypesWrapper) value).toList()); - } else - if (value instanceof AllTypes) { + } else if (value instanceof AllTypes) { stream.write(130); writeValue(stream, ((AllTypes) value).toList()); - } else -{ + } else { super.writeValue(stream, value); } } } /** - * The core interface that the Dart platform_test code implements for host - * integration tests to call into. + * The core interface that the Dart platform_test code implements for host integration tests to + * call into. * - * Generated class from Pigeon that represents Flutter messages that can be called from Java. + *

Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class FlutterIntegrationCoreApi { private final BinaryMessenger binaryMessenger; - public FlutterIntegrationCoreApi(BinaryMessenger argBinaryMessenger){ + + public FlutterIntegrationCoreApi(BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } + public interface Reply { void reply(T reply); } /** The codec used by FlutterIntegrationCoreApi. */ static MessageCodec getCodec() { - return FlutterIntegrationCoreApiCodec.INSTANCE; + return FlutterIntegrationCoreApiCodec.INSTANCE; } /** - * A no-op function taking no arguments and returning no value, to sanity - * test basic calling. + * A no-op function taking no arguments and returning no value, to sanity test basic calling. */ public void noop(Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.noop", getCodec()); - channel.send(null, channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.noop", getCodec()); + channel.send( + null, + channelReply -> { + callback.reply(null); + }); } /** Returns the passed object, to test serialization and deserialization. */ public void echoAllTypes(@NonNull AllTypes everythingArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllTypes", getCodec()); - channel.send(new ArrayList(Collections.singletonList(everythingArg)), channelReply -> { - @SuppressWarnings("ConstantConditions") - AllTypes output = (AllTypes)channelReply; - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllTypes", + getCodec()); + channel.send( + new ArrayList(Collections.singletonList(everythingArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + AllTypes output = (AllTypes) channelReply; + callback.reply(output); + }); } /** Returns the passed object, to test serialization and deserialization. */ - public void echoAllNullableTypes(@NonNull AllNullableTypes everythingArg, Reply callback) { + public void echoAllNullableTypes( + @NonNull AllNullableTypes everythingArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes", getCodec()); - channel.send(new ArrayList(Collections.singletonList(everythingArg)), channelReply -> { - @SuppressWarnings("ConstantConditions") - AllNullableTypes output = (AllNullableTypes)channelReply; - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes", + getCodec()); + channel.send( + new ArrayList(Collections.singletonList(everythingArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + AllNullableTypes output = (AllNullableTypes) channelReply; + callback.reply(output); + }); } /** * Returns passed in arguments of multiple types. * - * Tests multiple-arity FlutterApi handling. + *

Tests multiple-arity FlutterApi handling. */ - public void sendMultipleNullableTypes(@Nullable Boolean aNullableBoolArg, @Nullable Long aNullableIntArg, @Nullable String aNullableStringArg, Reply callback) { + public void sendMultipleNullableTypes( + @Nullable Boolean aNullableBoolArg, + @Nullable Long aNullableIntArg, + @Nullable String aNullableStringArg, + Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.sendMultipleNullableTypes", getCodec()); - channel.send(new ArrayList(Arrays.asList(aNullableBoolArg, aNullableIntArg, aNullableStringArg)), channelReply -> { - @SuppressWarnings("ConstantConditions") - AllNullableTypes output = (AllNullableTypes)channelReply; - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.sendMultipleNullableTypes", + getCodec()); + channel.send( + new ArrayList( + Arrays.asList(aNullableBoolArg, aNullableIntArg, aNullableStringArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + AllNullableTypes output = (AllNullableTypes) channelReply; + callback.reply(output); + }); } /** Returns the passed boolean, to test serialization and deserialization. */ public void echoBool(@NonNull Boolean aBoolArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoBool", getCodec()); - channel.send(new ArrayList(Collections.singletonList(aBoolArg)), channelReply -> { - @SuppressWarnings("ConstantConditions") - Boolean output = (Boolean)channelReply; - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoBool", getCodec()); + channel.send( + new ArrayList(Collections.singletonList(aBoolArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + Boolean output = (Boolean) channelReply; + callback.reply(output); + }); } /** Returns the passed int, to test serialization and deserialization. */ public void echoInt(@NonNull Long anIntArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoInt", getCodec()); - channel.send(new ArrayList(Collections.singletonList(anIntArg)), channelReply -> { - @SuppressWarnings("ConstantConditions") - Long output = channelReply == null ? null : ((Number)channelReply).longValue(); - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoInt", getCodec()); + channel.send( + new ArrayList(Collections.singletonList(anIntArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + Long output = channelReply == null ? null : ((Number) channelReply).longValue(); + callback.reply(output); + }); } /** Returns the passed double, to test serialization and deserialization. */ public void echoDouble(@NonNull Double aDoubleArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoDouble", getCodec()); - channel.send(new ArrayList(Collections.singletonList(aDoubleArg)), channelReply -> { - @SuppressWarnings("ConstantConditions") - Double output = (Double)channelReply; - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoDouble", + getCodec()); + channel.send( + new ArrayList(Collections.singletonList(aDoubleArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + Double output = (Double) channelReply; + callback.reply(output); + }); } /** Returns the passed string, to test serialization and deserialization. */ public void echoString(@NonNull String aStringArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoString", getCodec()); - channel.send(new ArrayList(Collections.singletonList(aStringArg)), channelReply -> { - @SuppressWarnings("ConstantConditions") - String output = (String)channelReply; - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoString", + getCodec()); + channel.send( + new ArrayList(Collections.singletonList(aStringArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + String output = (String) channelReply; + callback.reply(output); + }); } /** Returns the passed byte list, to test serialization and deserialization. */ public void echoUint8List(@NonNull byte[] aListArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoUint8List", getCodec()); - channel.send(new ArrayList(Collections.singletonList(aListArg)), channelReply -> { - @SuppressWarnings("ConstantConditions") - byte[] output = (byte[])channelReply; - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoUint8List", + getCodec()); + channel.send( + new ArrayList(Collections.singletonList(aListArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + byte[] output = (byte[]) channelReply; + callback.reply(output); + }); } /** Returns the passed list, to test serialization and deserialization. */ public void echoList(@NonNull List aListArg, Reply> callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoList", getCodec()); - channel.send(new ArrayList(Collections.singletonList(aListArg)), channelReply -> { - @SuppressWarnings("ConstantConditions") - List output = (List)channelReply; - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoList", getCodec()); + channel.send( + new ArrayList(Collections.singletonList(aListArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + List output = (List) channelReply; + callback.reply(output); + }); } /** Returns the passed map, to test serialization and deserialization. */ public void echoMap(@NonNull Map aMapArg, Reply> callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoMap", getCodec()); - channel.send(new ArrayList(Collections.singletonList(aMapArg)), channelReply -> { - @SuppressWarnings("ConstantConditions") - Map output = (Map)channelReply; - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoMap", getCodec()); + channel.send( + new ArrayList(Collections.singletonList(aMapArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + Map output = (Map) channelReply; + callback.reply(output); + }); } /** Returns the passed boolean, to test serialization and deserialization. */ public void echoNullableBool(@Nullable Boolean aBoolArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableBool", getCodec()); - channel.send(new ArrayList(Collections.singletonList(aBoolArg)), channelReply -> { - @SuppressWarnings("ConstantConditions") - Boolean output = (Boolean)channelReply; - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableBool", + getCodec()); + channel.send( + new ArrayList(Collections.singletonList(aBoolArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + Boolean output = (Boolean) channelReply; + callback.reply(output); + }); } /** Returns the passed int, to test serialization and deserialization. */ public void echoNullableInt(@Nullable Long anIntArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableInt", getCodec()); - channel.send(new ArrayList(Collections.singletonList(anIntArg)), channelReply -> { - @SuppressWarnings("ConstantConditions") - Long output = channelReply == null ? null : ((Number)channelReply).longValue(); - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableInt", + getCodec()); + channel.send( + new ArrayList(Collections.singletonList(anIntArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + Long output = channelReply == null ? null : ((Number) channelReply).longValue(); + callback.reply(output); + }); } /** Returns the passed double, to test serialization and deserialization. */ public void echoNullableDouble(@Nullable Double aDoubleArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableDouble", getCodec()); - channel.send(new ArrayList(Collections.singletonList(aDoubleArg)), channelReply -> { - @SuppressWarnings("ConstantConditions") - Double output = (Double)channelReply; - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableDouble", + getCodec()); + channel.send( + new ArrayList(Collections.singletonList(aDoubleArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + Double output = (Double) channelReply; + callback.reply(output); + }); } /** Returns the passed string, to test serialization and deserialization. */ public void echoNullableString(@Nullable String aStringArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableString", getCodec()); - channel.send(new ArrayList(Collections.singletonList(aStringArg)), channelReply -> { - @SuppressWarnings("ConstantConditions") - String output = (String)channelReply; - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableString", + getCodec()); + channel.send( + new ArrayList(Collections.singletonList(aStringArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + String output = (String) channelReply; + callback.reply(output); + }); } /** Returns the passed byte list, to test serialization and deserialization. */ public void echoNullableUint8List(@Nullable byte[] aListArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableUint8List", getCodec()); - channel.send(new ArrayList(Collections.singletonList(aListArg)), channelReply -> { - @SuppressWarnings("ConstantConditions") - byte[] output = (byte[])channelReply; - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableUint8List", + getCodec()); + channel.send( + new ArrayList(Collections.singletonList(aListArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + byte[] output = (byte[]) channelReply; + callback.reply(output); + }); } /** Returns the passed list, to test serialization and deserialization. */ public void echoNullableList(@Nullable List aListArg, Reply> callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList", getCodec()); - channel.send(new ArrayList(Collections.singletonList(aListArg)), channelReply -> { - @SuppressWarnings("ConstantConditions") - List output = (List)channelReply; - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList", + getCodec()); + channel.send( + new ArrayList(Collections.singletonList(aListArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + List output = (List) channelReply; + callback.reply(output); + }); } /** Returns the passed map, to test serialization and deserialization. */ - public void echoNullableMap(@NonNull Map aMapArg, Reply> callback) { + public void echoNullableMap( + @NonNull Map aMapArg, Reply> callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap", getCodec()); - channel.send(new ArrayList(Collections.singletonList(aMapArg)), channelReply -> { - @SuppressWarnings("ConstantConditions") - Map output = (Map)channelReply; - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap", + getCodec()); + channel.send( + new ArrayList(Collections.singletonList(aMapArg)), + channelReply -> { + @SuppressWarnings("ConstantConditions") + Map output = (Map) channelReply; + callback.reply(output); + }); } } /** * An API that can be implemented for minimal, compile-only tests. * - * Generated interface from Pigeon that represents a handler of messages from Flutter. + *

Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface HostTrivialApi { void noop(); /** The codec used by HostTrivialApi. */ static MessageCodec getCodec() { - return new StandardMessageCodec(); } - /**Sets up an instance of `HostTrivialApi` to handle messages through the `binaryMessenger`. */ + return new StandardMessageCodec(); + } + /** Sets up an instance of `HostTrivialApi` to handle messages through the `binaryMessenger`. */ static void setup(BinaryMessenger binaryMessenger, HostTrivialApi api) { { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.HostTrivialApi.noop", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.HostTrivialApi.noop", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - api.noop(); - wrapped.add(0, null); - } - catch (Error | RuntimeException exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + api.noop(); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h index 482f2c13722..1f7196621ec 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h @@ -1,7 +1,7 @@ // 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 (v6.0.4), do not edit directly. // See also: https://pub.dev/packages/pigeon @@ -28,65 +28,67 @@ typedef NS_ENUM(NSUInteger, AnEnum) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithABool:(NSNumber *)aBool - anInt:(NSNumber *)anInt - aDouble:(NSNumber *)aDouble - aByteArray:(FlutterStandardTypedData *)aByteArray - a4ByteArray:(FlutterStandardTypedData *)a4ByteArray - a8ByteArray:(FlutterStandardTypedData *)a8ByteArray - aFloatArray:(FlutterStandardTypedData *)aFloatArray - aList:(NSArray *)aList - aMap:(NSDictionary *)aMap - anEnum:(AnEnum)anEnum - aString:(NSString *)aString; -@property(nonatomic, strong) NSNumber * aBool; -@property(nonatomic, strong) NSNumber * anInt; -@property(nonatomic, strong) NSNumber * aDouble; -@property(nonatomic, strong) FlutterStandardTypedData * aByteArray; -@property(nonatomic, strong) FlutterStandardTypedData * a4ByteArray; -@property(nonatomic, strong) FlutterStandardTypedData * a8ByteArray; -@property(nonatomic, strong) FlutterStandardTypedData * aFloatArray; -@property(nonatomic, strong) NSArray * aList; -@property(nonatomic, strong) NSDictionary * aMap; + anInt:(NSNumber *)anInt + aDouble:(NSNumber *)aDouble + aByteArray:(FlutterStandardTypedData *)aByteArray + a4ByteArray:(FlutterStandardTypedData *)a4ByteArray + a8ByteArray:(FlutterStandardTypedData *)a8ByteArray + aFloatArray:(FlutterStandardTypedData *)aFloatArray + aList:(NSArray *)aList + aMap:(NSDictionary *)aMap + anEnum:(AnEnum)anEnum + aString:(NSString *)aString; +@property(nonatomic, strong) NSNumber *aBool; +@property(nonatomic, strong) NSNumber *anInt; +@property(nonatomic, strong) NSNumber *aDouble; +@property(nonatomic, strong) FlutterStandardTypedData *aByteArray; +@property(nonatomic, strong) FlutterStandardTypedData *a4ByteArray; +@property(nonatomic, strong) FlutterStandardTypedData *a8ByteArray; +@property(nonatomic, strong) FlutterStandardTypedData *aFloatArray; +@property(nonatomic, strong) NSArray *aList; +@property(nonatomic, strong) NSDictionary *aMap; @property(nonatomic, assign) AnEnum anEnum; -@property(nonatomic, copy) NSString * aString; +@property(nonatomic, copy) NSString *aString; @end @interface AllNullableTypes : NSObject + (instancetype)makeWithANullableBool:(nullable NSNumber *)aNullableBool - aNullableInt:(nullable NSNumber *)aNullableInt - aNullableDouble:(nullable NSNumber *)aNullableDouble - aNullableByteArray:(nullable FlutterStandardTypedData *)aNullableByteArray - aNullable4ByteArray:(nullable FlutterStandardTypedData *)aNullable4ByteArray - aNullable8ByteArray:(nullable FlutterStandardTypedData *)aNullable8ByteArray - aNullableFloatArray:(nullable FlutterStandardTypedData *)aNullableFloatArray - aNullableList:(nullable NSArray *)aNullableList - aNullableMap:(nullable NSDictionary *)aNullableMap - nullableNestedList:(nullable NSArray *> *)nullableNestedList - nullableMapWithAnnotations:(nullable NSDictionary *)nullableMapWithAnnotations - nullableMapWithObject:(nullable NSDictionary *)nullableMapWithObject - aNullableEnum:(AnEnum)aNullableEnum - aNullableString:(nullable NSString *)aNullableString; -@property(nonatomic, strong, nullable) NSNumber * aNullableBool; -@property(nonatomic, strong, nullable) NSNumber * aNullableInt; -@property(nonatomic, strong, nullable) NSNumber * aNullableDouble; -@property(nonatomic, strong, nullable) FlutterStandardTypedData * aNullableByteArray; -@property(nonatomic, strong, nullable) FlutterStandardTypedData * aNullable4ByteArray; -@property(nonatomic, strong, nullable) FlutterStandardTypedData * aNullable8ByteArray; -@property(nonatomic, strong, nullable) FlutterStandardTypedData * aNullableFloatArray; -@property(nonatomic, strong, nullable) NSArray * aNullableList; -@property(nonatomic, strong, nullable) NSDictionary * aNullableMap; -@property(nonatomic, strong, nullable) NSArray *> * nullableNestedList; -@property(nonatomic, strong, nullable) NSDictionary * nullableMapWithAnnotations; -@property(nonatomic, strong, nullable) NSDictionary * nullableMapWithObject; + aNullableInt:(nullable NSNumber *)aNullableInt + aNullableDouble:(nullable NSNumber *)aNullableDouble + aNullableByteArray:(nullable FlutterStandardTypedData *)aNullableByteArray + aNullable4ByteArray:(nullable FlutterStandardTypedData *)aNullable4ByteArray + aNullable8ByteArray:(nullable FlutterStandardTypedData *)aNullable8ByteArray + aNullableFloatArray:(nullable FlutterStandardTypedData *)aNullableFloatArray + aNullableList:(nullable NSArray *)aNullableList + aNullableMap:(nullable NSDictionary *)aNullableMap + nullableNestedList:(nullable NSArray *> *)nullableNestedList + nullableMapWithAnnotations: + (nullable NSDictionary *)nullableMapWithAnnotations + nullableMapWithObject:(nullable NSDictionary *)nullableMapWithObject + aNullableEnum:(AnEnum)aNullableEnum + aNullableString:(nullable NSString *)aNullableString; +@property(nonatomic, strong, nullable) NSNumber *aNullableBool; +@property(nonatomic, strong, nullable) NSNumber *aNullableInt; +@property(nonatomic, strong, nullable) NSNumber *aNullableDouble; +@property(nonatomic, strong, nullable) FlutterStandardTypedData *aNullableByteArray; +@property(nonatomic, strong, nullable) FlutterStandardTypedData *aNullable4ByteArray; +@property(nonatomic, strong, nullable) FlutterStandardTypedData *aNullable8ByteArray; +@property(nonatomic, strong, nullable) FlutterStandardTypedData *aNullableFloatArray; +@property(nonatomic, strong, nullable) NSArray *aNullableList; +@property(nonatomic, strong, nullable) NSDictionary *aNullableMap; +@property(nonatomic, strong, nullable) NSArray *> *nullableNestedList; +@property(nonatomic, strong, nullable) + NSDictionary *nullableMapWithAnnotations; +@property(nonatomic, strong, nullable) NSDictionary *nullableMapWithObject; @property(nonatomic, assign) AnEnum aNullableEnum; -@property(nonatomic, copy, nullable) NSString * aNullableString; +@property(nonatomic, copy, nullable) NSString *aNullableString; @end @interface AllNullableTypesWrapper : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithValues:(AllNullableTypes *)values; -@property(nonatomic, strong) AllNullableTypes * values; +@property(nonatomic, strong) AllNullableTypes *values; @end /// The codec used by HostIntegrationCoreApi. @@ -101,9 +103,11 @@ NSObject *HostIntegrationCoreApiGetCodec(void); /// Returns the passed object, to test serialization and deserialization. /// /// @return `nil` only when `error != nil`. -- (nullable AllTypes *)echoAllTypes:(AllTypes *)everything error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable AllTypes *)echoAllTypes:(AllTypes *)everything + error:(FlutterError *_Nullable *_Nonnull)error; /// Returns the passed object, to test serialization and deserialization. -- (nullable AllNullableTypes *)echoAllNullableTypes:(nullable AllNullableTypes *)everything error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable AllNullableTypes *)echoAllNullableTypes:(nullable AllNullableTypes *)everything + error:(FlutterError *_Nullable *_Nonnull)error; /// Returns an error, to test error handling. - (void)throwErrorWithError:(FlutterError *_Nullable *_Nonnull)error; /// Returns passed in int. @@ -113,7 +117,8 @@ NSObject *HostIntegrationCoreApiGetCodec(void); /// Returns passed in double. /// /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)echoDouble:(NSNumber *)aDouble error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSNumber *)echoDouble:(NSNumber *)aDouble + error:(FlutterError *_Nullable *_Nonnull)error; /// Returns the passed in boolean. /// /// @return `nil` only when `error != nil`. @@ -121,49 +126,68 @@ NSObject *HostIntegrationCoreApiGetCodec(void); /// Returns the passed in string. /// /// @return `nil` only when `error != nil`. -- (nullable NSString *)echoString:(NSString *)aString error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSString *)echoString:(NSString *)aString + error:(FlutterError *_Nullable *_Nonnull)error; /// Returns the passed in Uint8List. /// /// @return `nil` only when `error != nil`. -- (nullable FlutterStandardTypedData *)echoUint8List:(FlutterStandardTypedData *)aUint8List error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable FlutterStandardTypedData *)echoUint8List:(FlutterStandardTypedData *)aUint8List + error:(FlutterError *_Nullable *_Nonnull)error; /// Returns the passed in generic Object. /// /// @return `nil` only when `error != nil`. - (nullable id)echoObject:(id)anObject error:(FlutterError *_Nullable *_Nonnull)error; /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. -- (nullable NSString *)extractNestedNullableStringFrom:(AllNullableTypesWrapper *)wrapper error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSString *)extractNestedNullableStringFrom:(AllNullableTypesWrapper *)wrapper + error:(FlutterError *_Nullable *_Nonnull)error; /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. /// /// @return `nil` only when `error != nil`. -- (nullable AllNullableTypesWrapper *)createNestedObjectWithNullableString:(nullable NSString *)nullableString error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable AllNullableTypesWrapper *) + createNestedObjectWithNullableString:(nullable NSString *)nullableString + error:(FlutterError *_Nullable *_Nonnull)error; /// Returns passed in arguments of multiple types. /// /// @return `nil` only when `error != nil`. -- (nullable AllNullableTypes *)sendMultipleNullableTypesABool:(nullable NSNumber *)aNullableBool anInt:(nullable NSNumber *)aNullableInt aString:(nullable NSString *)aNullableString error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable AllNullableTypes *)sendMultipleNullableTypesABool:(nullable NSNumber *)aNullableBool + anInt:(nullable NSNumber *)aNullableInt + aString:(nullable NSString *)aNullableString + error:(FlutterError *_Nullable *_Nonnull) + error; /// Returns passed in int. -- (nullable NSNumber *)echoNullableInt:(nullable NSNumber *)aNullableInt error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSNumber *)echoNullableInt:(nullable NSNumber *)aNullableInt + error:(FlutterError *_Nullable *_Nonnull)error; /// Returns passed in double. -- (nullable NSNumber *)echoNullableDouble:(nullable NSNumber *)aNullableDouble error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSNumber *)echoNullableDouble:(nullable NSNumber *)aNullableDouble + error:(FlutterError *_Nullable *_Nonnull)error; /// Returns the passed in boolean. -- (nullable NSNumber *)echoNullableBool:(nullable NSNumber *)aNullableBool error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSNumber *)echoNullableBool:(nullable NSNumber *)aNullableBool + error:(FlutterError *_Nullable *_Nonnull)error; /// Returns the passed in string. -- (nullable NSString *)echoNullableString:(nullable NSString *)aNullableString error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable NSString *)echoNullableString:(nullable NSString *)aNullableString + error:(FlutterError *_Nullable *_Nonnull)error; /// Returns the passed in Uint8List. -- (nullable FlutterStandardTypedData *)echoNullableUint8List:(nullable FlutterStandardTypedData *)aNullableUint8List error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable FlutterStandardTypedData *) + echoNullableUint8List:(nullable FlutterStandardTypedData *)aNullableUint8List + error:(FlutterError *_Nullable *_Nonnull)error; /// Returns the passed in generic Object. -- (nullable id)echoNullableObject:(nullable id)aNullableObject error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable id)echoNullableObject:(nullable id)aNullableObject + error:(FlutterError *_Nullable *_Nonnull)error; /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. -- (void)noopAsyncWithCompletion:(void(^)(FlutterError *_Nullable))completion; +- (void)noopAsyncWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Returns the passed string asynchronously. -- (void)echoAsyncString:(NSString *)aString completion:(void(^)(NSString *_Nullable, FlutterError *_Nullable))completion; -- (void)callFlutterNoopWithCompletion:(void(^)(FlutterError *_Nullable))completion; -- (void)callFlutterEchoString:(NSString *)aString completion:(void(^)(NSString *_Nullable, FlutterError *_Nullable))completion; +- (void)echoAsyncString:(NSString *)aString + completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; +- (void)callFlutterNoopWithCompletion:(void (^)(FlutterError *_Nullable))completion; +- (void)callFlutterEchoString:(NSString *)aString + completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; @end -extern void HostIntegrationCoreApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void HostIntegrationCoreApiSetup(id binaryMessenger, + NSObject *_Nullable api); /// The codec used by FlutterIntegrationCoreApi. NSObject *FlutterIntegrationCoreApiGetCodec(void); @@ -174,43 +198,65 @@ NSObject *FlutterIntegrationCoreApiGetCodec(void); - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; /// A no-op function taking no arguments and returning no value, to sanity /// test basic calling. -- (void)noopWithCompletion:(void(^)(NSError *_Nullable))completion; +- (void)noopWithCompletion:(void (^)(NSError *_Nullable))completion; /// Returns the passed object, to test serialization and deserialization. -- (void)echoAllTypes:(AllTypes *)everything completion:(void(^)(AllTypes *_Nullable, NSError *_Nullable))completion; +- (void)echoAllTypes:(AllTypes *)everything + completion:(void (^)(AllTypes *_Nullable, NSError *_Nullable))completion; /// Returns the passed object, to test serialization and deserialization. -- (void)echoAllNullableTypes:(AllNullableTypes *)everything completion:(void(^)(AllNullableTypes *_Nullable, NSError *_Nullable))completion; +- (void)echoAllNullableTypes:(AllNullableTypes *)everything + completion:(void (^)(AllNullableTypes *_Nullable, NSError *_Nullable))completion; /// Returns passed in arguments of multiple types. /// /// Tests multiple-arity FlutterApi handling. -- (void)sendMultipleNullableTypesABool:(nullable NSNumber *)aNullableBool anInt:(nullable NSNumber *)aNullableInt aString:(nullable NSString *)aNullableString completion:(void(^)(AllNullableTypes *_Nullable, NSError *_Nullable))completion; +- (void)sendMultipleNullableTypesABool:(nullable NSNumber *)aNullableBool + anInt:(nullable NSNumber *)aNullableInt + aString:(nullable NSString *)aNullableString + completion:(void (^)(AllNullableTypes *_Nullable, + NSError *_Nullable))completion; /// Returns the passed boolean, to test serialization and deserialization. -- (void)echoBool:(NSNumber *)aBool completion:(void(^)(NSNumber *_Nullable, NSError *_Nullable))completion; +- (void)echoBool:(NSNumber *)aBool + completion:(void (^)(NSNumber *_Nullable, NSError *_Nullable))completion; /// Returns the passed int, to test serialization and deserialization. -- (void)echoInt:(NSNumber *)anInt completion:(void(^)(NSNumber *_Nullable, NSError *_Nullable))completion; +- (void)echoInt:(NSNumber *)anInt + completion:(void (^)(NSNumber *_Nullable, NSError *_Nullable))completion; /// Returns the passed double, to test serialization and deserialization. -- (void)echoDouble:(NSNumber *)aDouble completion:(void(^)(NSNumber *_Nullable, NSError *_Nullable))completion; +- (void)echoDouble:(NSNumber *)aDouble + completion:(void (^)(NSNumber *_Nullable, NSError *_Nullable))completion; /// Returns the passed string, to test serialization and deserialization. -- (void)echoString:(NSString *)aString completion:(void(^)(NSString *_Nullable, NSError *_Nullable))completion; +- (void)echoString:(NSString *)aString + completion:(void (^)(NSString *_Nullable, NSError *_Nullable))completion; /// Returns the passed byte list, to test serialization and deserialization. -- (void)echoUint8List:(FlutterStandardTypedData *)aList completion:(void(^)(FlutterStandardTypedData *_Nullable, NSError *_Nullable))completion; +- (void)echoUint8List:(FlutterStandardTypedData *)aList + completion:(void (^)(FlutterStandardTypedData *_Nullable, NSError *_Nullable))completion; /// Returns the passed list, to test serialization and deserialization. -- (void)echoList:(NSArray *)aList completion:(void(^)(NSArray *_Nullable, NSError *_Nullable))completion; +- (void)echoList:(NSArray *)aList + completion:(void (^)(NSArray *_Nullable, NSError *_Nullable))completion; /// Returns the passed map, to test serialization and deserialization. -- (void)echoMap:(NSDictionary *)aMap completion:(void(^)(NSDictionary *_Nullable, NSError *_Nullable))completion; +- (void)echoMap:(NSDictionary *)aMap + completion:(void (^)(NSDictionary *_Nullable, NSError *_Nullable))completion; /// Returns the passed boolean, to test serialization and deserialization. -- (void)echoNullableBool:(nullable NSNumber *)aBool completion:(void(^)(NSNumber *_Nullable, NSError *_Nullable))completion; +- (void)echoNullableBool:(nullable NSNumber *)aBool + completion:(void (^)(NSNumber *_Nullable, NSError *_Nullable))completion; /// Returns the passed int, to test serialization and deserialization. -- (void)echoNullableInt:(nullable NSNumber *)anInt completion:(void(^)(NSNumber *_Nullable, NSError *_Nullable))completion; +- (void)echoNullableInt:(nullable NSNumber *)anInt + completion:(void (^)(NSNumber *_Nullable, NSError *_Nullable))completion; /// Returns the passed double, to test serialization and deserialization. -- (void)echoNullableDouble:(nullable NSNumber *)aDouble completion:(void(^)(NSNumber *_Nullable, NSError *_Nullable))completion; +- (void)echoNullableDouble:(nullable NSNumber *)aDouble + completion:(void (^)(NSNumber *_Nullable, NSError *_Nullable))completion; /// Returns the passed string, to test serialization and deserialization. -- (void)echoNullableString:(nullable NSString *)aString completion:(void(^)(NSString *_Nullable, NSError *_Nullable))completion; +- (void)echoNullableString:(nullable NSString *)aString + completion:(void (^)(NSString *_Nullable, NSError *_Nullable))completion; /// Returns the passed byte list, to test serialization and deserialization. -- (void)echoNullableUint8List:(nullable FlutterStandardTypedData *)aList completion:(void(^)(FlutterStandardTypedData *_Nullable, NSError *_Nullable))completion; +- (void)echoNullableUint8List:(nullable FlutterStandardTypedData *)aList + completion:(void (^)(FlutterStandardTypedData *_Nullable, + NSError *_Nullable))completion; /// Returns the passed list, to test serialization and deserialization. -- (void)echoNullableList:(nullable NSArray *)aList completion:(void(^)(NSArray *_Nullable, NSError *_Nullable))completion; +- (void)echoNullableList:(nullable NSArray *)aList + completion:(void (^)(NSArray *_Nullable, NSError *_Nullable))completion; /// Returns the passed map, to test serialization and deserialization. -- (void)echoNullableMap:(NSDictionary *)aMap completion:(void(^)(NSDictionary *_Nullable, NSError *_Nullable))completion; +- (void)echoNullableMap:(NSDictionary *)aMap + completion: + (void (^)(NSDictionary *_Nullable, NSError *_Nullable))completion; @end /// The codec used by HostTrivialApi. @@ -221,6 +267,7 @@ NSObject *HostTrivialApiGetCodec(void); - (void)noopWithError:(FlutterError *_Nullable *_Nonnull)error; @end -extern void HostTrivialApiSetup(id binaryMessenger, NSObject *_Nullable api); +extern void HostTrivialApiSetup(id binaryMessenger, + NSObject *_Nullable api); NS_ASSUME_NONNULL_END diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m index c6da6c7edca..b92f59f74e2 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m @@ -1,7 +1,7 @@ // 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 (v6.0.4), do not edit directly. // See also: https://pub.dev/packages/pigeon @@ -14,20 +14,21 @@ static NSArray *wrapResult(id result, FlutterError *error) { if (error) { - return @[ error.code ?: [NSNull null], error.message ?: [NSNull null], error.details ?: [NSNull null] ]; + return @[ + error.code ?: [NSNull null], error.message ?: [NSNull null], error.details ?: [NSNull null] + ]; } - return @[ result ?: [NSNull null] ]; + return @[ result ?: [NSNull null] ]; } -static id GetNullableObject(NSDictionary* dict, id key) { +static id GetNullableObject(NSDictionary *dict, id key) { id result = dict[key]; return (result == [NSNull null]) ? nil : result; } -static id GetNullableObjectAtIndex(NSArray* array, NSInteger key) { +static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { id result = array[key]; return (result == [NSNull null]) ? nil : result; } - @interface AllTypes () + (AllTypes *)fromList:(NSArray *)list; + (nullable AllTypes *)nullableFromList:(NSArray *)list; @@ -46,20 +47,19 @@ + (nullable AllNullableTypesWrapper *)nullableFromList:(NSArray *)list; - (NSArray *)toList; @end - @implementation AllTypes + (instancetype)makeWithABool:(NSNumber *)aBool - anInt:(NSNumber *)anInt - aDouble:(NSNumber *)aDouble - aByteArray:(FlutterStandardTypedData *)aByteArray - a4ByteArray:(FlutterStandardTypedData *)a4ByteArray - a8ByteArray:(FlutterStandardTypedData *)a8ByteArray - aFloatArray:(FlutterStandardTypedData *)aFloatArray - aList:(NSArray *)aList - aMap:(NSDictionary *)aMap - anEnum:(AnEnum)anEnum - aString:(NSString *)aString { - AllTypes* pigeonResult = [[AllTypes alloc] init]; + anInt:(NSNumber *)anInt + aDouble:(NSNumber *)aDouble + aByteArray:(FlutterStandardTypedData *)aByteArray + a4ByteArray:(FlutterStandardTypedData *)a4ByteArray + a8ByteArray:(FlutterStandardTypedData *)a8ByteArray + aFloatArray:(FlutterStandardTypedData *)aFloatArray + aList:(NSArray *)aList + aMap:(NSDictionary *)aMap + anEnum:(AnEnum)anEnum + aString:(NSString *)aString { + AllTypes *pigeonResult = [[AllTypes alloc] init]; pigeonResult.aBool = aBool; pigeonResult.anInt = anInt; pigeonResult.aDouble = aDouble; @@ -98,7 +98,9 @@ + (AllTypes *)fromList:(NSArray *)list { NSAssert(pigeonResult.aString != nil, @""); return pigeonResult; } -+ (nullable AllTypes *)nullableFromList:(NSArray *)list { return (list) ? [AllTypes fromList:list] : nil; } ++ (nullable AllTypes *)nullableFromList:(NSArray *)list { + return (list) ? [AllTypes fromList:list] : nil; +} - (NSArray *)toList { return @[ (self.aBool ?: [NSNull null]), @@ -118,20 +120,21 @@ - (NSArray *)toList { @implementation AllNullableTypes + (instancetype)makeWithANullableBool:(nullable NSNumber *)aNullableBool - aNullableInt:(nullable NSNumber *)aNullableInt - aNullableDouble:(nullable NSNumber *)aNullableDouble - aNullableByteArray:(nullable FlutterStandardTypedData *)aNullableByteArray - aNullable4ByteArray:(nullable FlutterStandardTypedData *)aNullable4ByteArray - aNullable8ByteArray:(nullable FlutterStandardTypedData *)aNullable8ByteArray - aNullableFloatArray:(nullable FlutterStandardTypedData *)aNullableFloatArray - aNullableList:(nullable NSArray *)aNullableList - aNullableMap:(nullable NSDictionary *)aNullableMap - nullableNestedList:(nullable NSArray *> *)nullableNestedList - nullableMapWithAnnotations:(nullable NSDictionary *)nullableMapWithAnnotations - nullableMapWithObject:(nullable NSDictionary *)nullableMapWithObject - aNullableEnum:(AnEnum)aNullableEnum - aNullableString:(nullable NSString *)aNullableString { - AllNullableTypes* pigeonResult = [[AllNullableTypes alloc] init]; + aNullableInt:(nullable NSNumber *)aNullableInt + aNullableDouble:(nullable NSNumber *)aNullableDouble + aNullableByteArray:(nullable FlutterStandardTypedData *)aNullableByteArray + aNullable4ByteArray:(nullable FlutterStandardTypedData *)aNullable4ByteArray + aNullable8ByteArray:(nullable FlutterStandardTypedData *)aNullable8ByteArray + aNullableFloatArray:(nullable FlutterStandardTypedData *)aNullableFloatArray + aNullableList:(nullable NSArray *)aNullableList + aNullableMap:(nullable NSDictionary *)aNullableMap + nullableNestedList:(nullable NSArray *> *)nullableNestedList + nullableMapWithAnnotations: + (nullable NSDictionary *)nullableMapWithAnnotations + nullableMapWithObject:(nullable NSDictionary *)nullableMapWithObject + aNullableEnum:(AnEnum)aNullableEnum + aNullableString:(nullable NSString *)aNullableString { + AllNullableTypes *pigeonResult = [[AllNullableTypes alloc] init]; pigeonResult.aNullableBool = aNullableBool; pigeonResult.aNullableInt = aNullableInt; pigeonResult.aNullableDouble = aNullableDouble; @@ -166,7 +169,9 @@ + (AllNullableTypes *)fromList:(NSArray *)list { pigeonResult.aNullableString = GetNullableObjectAtIndex(list, 13); return pigeonResult; } -+ (nullable AllNullableTypes *)nullableFromList:(NSArray *)list { return (list) ? [AllNullableTypes fromList:list] : nil; } ++ (nullable AllNullableTypes *)nullableFromList:(NSArray *)list { + return (list) ? [AllNullableTypes fromList:list] : nil; +} - (NSArray *)toList { return @[ (self.aNullableBool ?: [NSNull null]), @@ -189,7 +194,7 @@ - (NSArray *)toList { @implementation AllNullableTypesWrapper + (instancetype)makeWithValues:(AllNullableTypes *)values { - AllNullableTypesWrapper* pigeonResult = [[AllNullableTypesWrapper alloc] init]; + AllNullableTypesWrapper *pigeonResult = [[AllNullableTypesWrapper alloc] init]; pigeonResult.values = values; return pigeonResult; } @@ -199,7 +204,9 @@ + (AllNullableTypesWrapper *)fromList:(NSArray *)list { NSAssert(pigeonResult.values != nil, @""); return pigeonResult; } -+ (nullable AllNullableTypesWrapper *)nullableFromList:(NSArray *)list { return (list) ? [AllNullableTypesWrapper fromList:list] : nil; } ++ (nullable AllNullableTypesWrapper *)nullableFromList:(NSArray *)list { + return (list) ? [AllNullableTypesWrapper fromList:list] : nil; +} - (NSArray *)toList { return @[ (self.values ? [self.values toList] : [NSNull null]), @@ -210,21 +217,19 @@ - (NSArray *)toList { @interface HostIntegrationCoreApiCodecReader : FlutterStandardReader @end @implementation HostIntegrationCoreApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [AllNullableTypes fromList:[self readValue]]; - - case 129: + + case 129: return [AllNullableTypesWrapper fromList:[self readValue]]; - - case 130: + + case 130: return [AllTypes fromList:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -232,21 +237,17 @@ - (nullable id)readValueOfType:(UInt8)type @interface HostIntegrationCoreApiCodecWriter : FlutterStandardWriter @end @implementation HostIntegrationCoreApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[AllNullableTypes class]]) { [self writeByte:128]; [self writeValue:[value toList]]; - } else - if ([value isKindOfClass:[AllNullableTypesWrapper class]]) { + } else if ([value isKindOfClass:[AllNullableTypesWrapper class]]) { [self writeByte:129]; [self writeValue:[value toList]]; - } else - if ([value isKindOfClass:[AllTypes class]]) { + } else if ([value isKindOfClass:[AllTypes class]]) { [self writeByte:130]; [self writeValue:[value toList]]; - } else -{ + } else { [super writeValue:value]; } } @@ -263,47 +264,50 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { } @end - NSObject *HostIntegrationCoreApiGetCodec() { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - HostIntegrationCoreApiCodecReaderWriter *readerWriter = [[HostIntegrationCoreApiCodecReaderWriter alloc] init]; + HostIntegrationCoreApiCodecReaderWriter *readerWriter = + [[HostIntegrationCoreApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void HostIntegrationCoreApiSetup(id binaryMessenger, NSObject *api) { - /// A no-op function taking no arguments and returning no value, to sanity +void HostIntegrationCoreApiSetup(id binaryMessenger, + NSObject *api) { + /// A no-op function taking no arguments and returning no value, to sanity /// test basic calling. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.noop" + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.noop" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(noopWithError:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(noopWithError:)", api); + NSCAssert([api respondsToSelector:@selector(noopWithError:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(noopWithError:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { FlutterError *error; [api noopWithError:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns the passed object, to test serialization and deserialization. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoAllTypes" + /// Returns the passed object, to test serialization and deserialization. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoAllTypes" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(echoAllTypes:error:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoAllTypes:error:)", api); + NSCAssert( + [api respondsToSelector:@selector(echoAllTypes:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoAllTypes:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; AllTypes *arg_everything = GetNullableObjectAtIndex(args, 0); @@ -311,20 +315,21 @@ void HostIntegrationCoreApiSetup(id binaryMessenger, NSO AllTypes *output = [api echoAllTypes:arg_everything error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns the passed object, to test serialization and deserialization. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoAllNullableTypes" + /// Returns the passed object, to test serialization and deserialization. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoAllNullableTypes" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(echoAllNullableTypes:error:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoAllNullableTypes:error:)", api); + NSCAssert([api respondsToSelector:@selector(echoAllNullableTypes:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to " + @"@selector(echoAllNullableTypes:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; AllNullableTypes *arg_everything = GetNullableObjectAtIndex(args, 0); @@ -332,39 +337,40 @@ void HostIntegrationCoreApiSetup(id binaryMessenger, NSO AllNullableTypes *output = [api echoAllNullableTypes:arg_everything error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns an error, to test error handling. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.throwError" + /// Returns an error, to test error handling. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.throwError" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(throwErrorWithError:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(throwErrorWithError:)", api); + NSCAssert( + [api respondsToSelector:@selector(throwErrorWithError:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(throwErrorWithError:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { FlutterError *error; [api throwErrorWithError:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns passed in int. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoInt" + /// Returns passed in int. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoInt" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(echoInt:error:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoInt:error:)", api); + NSCAssert([api respondsToSelector:@selector(echoInt:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoInt:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_anInt = GetNullableObjectAtIndex(args, 0); @@ -372,20 +378,20 @@ void HostIntegrationCoreApiSetup(id binaryMessenger, NSO NSNumber *output = [api echoInt:arg_anInt error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns passed in double. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoDouble" + /// Returns passed in double. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoDouble" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(echoDouble:error:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoDouble:error:)", api); + NSCAssert([api respondsToSelector:@selector(echoDouble:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoDouble:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_aDouble = GetNullableObjectAtIndex(args, 0); @@ -393,20 +399,20 @@ void HostIntegrationCoreApiSetup(id binaryMessenger, NSO NSNumber *output = [api echoDouble:arg_aDouble error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns the passed in boolean. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoBool" + /// Returns the passed in boolean. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoBool" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(echoBool:error:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoBool:error:)", api); + NSCAssert([api respondsToSelector:@selector(echoBool:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoBool:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_aBool = GetNullableObjectAtIndex(args, 0); @@ -414,20 +420,20 @@ void HostIntegrationCoreApiSetup(id binaryMessenger, NSO NSNumber *output = [api echoBool:arg_aBool error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns the passed in string. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoString" + /// Returns the passed in string. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoString" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(echoString:error:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoString:error:)", api); + NSCAssert([api respondsToSelector:@selector(echoString:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoString:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_aString = GetNullableObjectAtIndex(args, 0); @@ -435,20 +441,21 @@ void HostIntegrationCoreApiSetup(id binaryMessenger, NSO NSString *output = [api echoString:arg_aString error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns the passed in Uint8List. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoUint8List" + /// Returns the passed in Uint8List. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoUint8List" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(echoUint8List:error:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoUint8List:error:)", api); + NSCAssert( + [api respondsToSelector:@selector(echoUint8List:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoUint8List:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FlutterStandardTypedData *arg_aUint8List = GetNullableObjectAtIndex(args, 0); @@ -456,20 +463,20 @@ void HostIntegrationCoreApiSetup(id binaryMessenger, NSO FlutterStandardTypedData *output = [api echoUint8List:arg_aUint8List error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns the passed in generic Object. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoObject" + /// Returns the passed in generic Object. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoObject" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(echoObject:error:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoObject:error:)", api); + NSCAssert([api respondsToSelector:@selector(echoObject:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoObject:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; id arg_anObject = GetNullableObjectAtIndex(args, 0); @@ -477,21 +484,22 @@ void HostIntegrationCoreApiSetup(id binaryMessenger, NSO id output = [api echoObject:arg_anObject error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns the inner `aString` value from the wrapped object, to test + /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.extractNestedNullableString" + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.extractNestedNullableString" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(extractNestedNullableStringFrom:error:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(extractNestedNullableStringFrom:error:)", api); + NSCAssert([api respondsToSelector:@selector(extractNestedNullableStringFrom:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to " + @"@selector(extractNestedNullableStringFrom:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; AllNullableTypesWrapper *arg_wrapper = GetNullableObjectAtIndex(args, 0); @@ -499,65 +507,73 @@ void HostIntegrationCoreApiSetup(id binaryMessenger, NSO NSString *output = [api extractNestedNullableStringFrom:arg_wrapper error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns the inner `aString` value from the wrapped object, to test + /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.createNestedNullableString" + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.createNestedNullableString" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createNestedObjectWithNullableString:error:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(createNestedObjectWithNullableString:error:)", api); + NSCAssert([api respondsToSelector:@selector(createNestedObjectWithNullableString:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to " + @"@selector(createNestedObjectWithNullableString:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_nullableString = GetNullableObjectAtIndex(args, 0); FlutterError *error; - AllNullableTypesWrapper *output = [api createNestedObjectWithNullableString:arg_nullableString error:&error]; + AllNullableTypesWrapper *output = + [api createNestedObjectWithNullableString:arg_nullableString error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns passed in arguments of multiple types. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.sendMultipleNullableTypes" + /// Returns passed in arguments of multiple types. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.sendMultipleNullableTypes" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(sendMultipleNullableTypesABool:anInt:aString:error:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(sendMultipleNullableTypesABool:anInt:aString:error:)", api); + NSCAssert([api respondsToSelector:@selector(sendMultipleNullableTypesABool: + anInt:aString:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to " + @"@selector(sendMultipleNullableTypesABool:anInt:aString:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_aNullableBool = GetNullableObjectAtIndex(args, 0); NSNumber *arg_aNullableInt = GetNullableObjectAtIndex(args, 1); NSString *arg_aNullableString = GetNullableObjectAtIndex(args, 2); FlutterError *error; - AllNullableTypes *output = [api sendMultipleNullableTypesABool:arg_aNullableBool anInt:arg_aNullableInt aString:arg_aNullableString error:&error]; + AllNullableTypes *output = [api sendMultipleNullableTypesABool:arg_aNullableBool + anInt:arg_aNullableInt + aString:arg_aNullableString + error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns passed in int. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableInt" + /// Returns passed in int. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableInt" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(echoNullableInt:error:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoNullableInt:error:)", api); + NSCAssert( + [api respondsToSelector:@selector(echoNullableInt:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoNullableInt:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_aNullableInt = GetNullableObjectAtIndex(args, 0); @@ -565,20 +581,21 @@ void HostIntegrationCoreApiSetup(id binaryMessenger, NSO NSNumber *output = [api echoNullableInt:arg_aNullableInt error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns passed in double. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableDouble" + /// Returns passed in double. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableDouble" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(echoNullableDouble:error:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoNullableDouble:error:)", api); + NSCAssert([api respondsToSelector:@selector(echoNullableDouble:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to " + @"@selector(echoNullableDouble:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_aNullableDouble = GetNullableObjectAtIndex(args, 0); @@ -586,20 +603,21 @@ void HostIntegrationCoreApiSetup(id binaryMessenger, NSO NSNumber *output = [api echoNullableDouble:arg_aNullableDouble error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns the passed in boolean. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableBool" + /// Returns the passed in boolean. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableBool" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(echoNullableBool:error:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoNullableBool:error:)", api); + NSCAssert( + [api respondsToSelector:@selector(echoNullableBool:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoNullableBool:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_aNullableBool = GetNullableObjectAtIndex(args, 0); @@ -607,20 +625,21 @@ void HostIntegrationCoreApiSetup(id binaryMessenger, NSO NSNumber *output = [api echoNullableBool:arg_aNullableBool error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns the passed in string. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableString" + /// Returns the passed in string. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableString" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(echoNullableString:error:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoNullableString:error:)", api); + NSCAssert([api respondsToSelector:@selector(echoNullableString:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to " + @"@selector(echoNullableString:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_aNullableString = GetNullableObjectAtIndex(args, 0); @@ -628,41 +647,44 @@ void HostIntegrationCoreApiSetup(id binaryMessenger, NSO NSString *output = [api echoNullableString:arg_aNullableString error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns the passed in Uint8List. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableUint8List" + /// Returns the passed in Uint8List. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableUint8List" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(echoNullableUint8List:error:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoNullableUint8List:error:)", api); + NSCAssert([api respondsToSelector:@selector(echoNullableUint8List:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to " + @"@selector(echoNullableUint8List:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FlutterStandardTypedData *arg_aNullableUint8List = GetNullableObjectAtIndex(args, 0); FlutterError *error; - FlutterStandardTypedData *output = [api echoNullableUint8List:arg_aNullableUint8List error:&error]; + FlutterStandardTypedData *output = [api echoNullableUint8List:arg_aNullableUint8List + error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns the passed in generic Object. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableObject" + /// Returns the passed in generic Object. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableObject" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(echoNullableObject:error:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoNullableObject:error:)", api); + NSCAssert([api respondsToSelector:@selector(echoNullableObject:error:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to " + @"@selector(echoNullableObject:error:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; id arg_aNullableObject = GetNullableObjectAtIndex(args, 0); @@ -670,87 +692,92 @@ void HostIntegrationCoreApiSetup(id binaryMessenger, NSO id output = [api echoNullableObject:arg_aNullableObject error:&error]; callback(wrapResult(output, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// A no-op function taking no arguments and returning no value, to sanity + /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.noopAsync" + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.noopAsync" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(noopAsyncWithCompletion:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(noopAsyncWithCompletion:)", api); + NSCAssert( + [api respondsToSelector:@selector(noopAsyncWithCompletion:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(noopAsyncWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api noopAsyncWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); }]; }]; - } - else { + } else { [channel setMessageHandler:nil]; } } - /// Returns the passed string asynchronously. -{ - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncString" + /// Returns the passed string asynchronously. + { + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncString" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(echoAsyncString:completion:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(echoAsyncString:completion:)", api); + NSCAssert([api respondsToSelector:@selector(echoAsyncString:completion:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to " + @"@selector(echoAsyncString:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_aString = GetNullableObjectAtIndex(args, 0); - [api echoAsyncString:arg_aString completion:^(NSString *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api echoAsyncString:arg_aString + completion:^(NSString *_Nullable output, FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterNoop" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterNoop" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterNoopWithCompletion:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(callFlutterNoopWithCompletion:)", api); + NSCAssert([api respondsToSelector:@selector(callFlutterNoopWithCompletion:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to " + @"@selector(callFlutterNoopWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api callFlutterNoopWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); }]; }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoString" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoString" binaryMessenger:binaryMessenger - codec:HostIntegrationCoreApiGetCodec()]; + codec:HostIntegrationCoreApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoString:completion:)], @"HostIntegrationCoreApi api (%@) doesn't respond to @selector(callFlutterEchoString:completion:)", api); + NSCAssert([api respondsToSelector:@selector(callFlutterEchoString:completion:)], + @"HostIntegrationCoreApi api (%@) doesn't respond to " + @"@selector(callFlutterEchoString:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_aString = GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoString:arg_aString completion:^(NSString *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api callFlutterEchoString:arg_aString + completion:^(NSString *_Nullable output, FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; - } - else { + } else { [channel setMessageHandler:nil]; } } @@ -758,21 +785,19 @@ void HostIntegrationCoreApiSetup(id binaryMessenger, NSO @interface FlutterIntegrationCoreApiCodecReader : FlutterStandardReader @end @implementation FlutterIntegrationCoreApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [AllNullableTypes fromList:[self readValue]]; - - case 129: + + case 129: return [AllNullableTypesWrapper fromList:[self readValue]]; - - case 130: + + case 130: return [AllTypes fromList:[self readValue]]; - - default: + + default: return [super readValueOfType:type]; - } } @end @@ -780,21 +805,17 @@ - (nullable id)readValueOfType:(UInt8)type @interface FlutterIntegrationCoreApiCodecWriter : FlutterStandardWriter @end @implementation FlutterIntegrationCoreApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[AllNullableTypes class]]) { [self writeByte:128]; [self writeValue:[value toList]]; - } else - if ([value isKindOfClass:[AllNullableTypesWrapper class]]) { + } else if ([value isKindOfClass:[AllNullableTypesWrapper class]]) { [self writeByte:129]; [self writeValue:[value toList]]; - } else - if ([value isKindOfClass:[AllTypes class]]) { + } else if ([value isKindOfClass:[AllTypes class]]) { [self writeByte:130]; [self writeValue:[value toList]]; - } else -{ + } else { [super writeValue:value]; } } @@ -811,19 +832,19 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { } @end - NSObject *FlutterIntegrationCoreApiGetCodec() { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - FlutterIntegrationCoreApiCodecReaderWriter *readerWriter = [[FlutterIntegrationCoreApiCodecReaderWriter alloc] init]; + FlutterIntegrationCoreApiCodecReaderWriter *readerWriter = + [[FlutterIntegrationCoreApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } @interface FlutterIntegrationCoreApi () -@property (nonatomic, strong) NSObject *binaryMessenger; +@property(nonatomic, strong) NSObject *binaryMessenger; @end @implementation FlutterIntegrationCoreApi @@ -835,202 +856,229 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)noopWithCompletion:(void(^)(NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)noopWithCompletion:(void (^)(NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.noop" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:nil reply:^(id reply) { - completion(nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:nil + reply:^(id reply) { + completion(nil); + }]; } -- (void)echoAllTypes:(AllTypes *)arg_everything completion:(void(^)(AllTypes *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)echoAllTypes:(AllTypes *)arg_everything + completion:(void (^)(AllTypes *_Nullable, NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllTypes" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:@[arg_everything ?: [NSNull null]] reply:^(id reply) { - AllTypes *output = reply; - completion(output, nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:@[ arg_everything ?: [NSNull null] ] + reply:^(id reply) { + AllTypes *output = reply; + completion(output, nil); + }]; } -- (void)echoAllNullableTypes:(AllNullableTypes *)arg_everything completion:(void(^)(AllNullableTypes *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)echoAllNullableTypes:(AllNullableTypes *)arg_everything + completion:(void (^)(AllNullableTypes *_Nullable, NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:@[arg_everything ?: [NSNull null]] reply:^(id reply) { - AllNullableTypes *output = reply; - completion(output, nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:@[ arg_everything ?: [NSNull null] ] + reply:^(id reply) { + AllNullableTypes *output = reply; + completion(output, nil); + }]; } -- (void)sendMultipleNullableTypesABool:(nullable NSNumber *)arg_aNullableBool anInt:(nullable NSNumber *)arg_aNullableInt aString:(nullable NSString *)arg_aNullableString completion:(void(^)(AllNullableTypes *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel - messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.sendMultipleNullableTypes" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:@[arg_aNullableBool ?: [NSNull null], arg_aNullableInt ?: [NSNull null], arg_aNullableString ?: [NSNull null]] reply:^(id reply) { - AllNullableTypes *output = reply; - completion(output, nil); - }]; +- (void)sendMultipleNullableTypesABool:(nullable NSNumber *)arg_aNullableBool + anInt:(nullable NSNumber *)arg_aNullableInt + aString:(nullable NSString *)arg_aNullableString + completion:(void (^)(AllNullableTypes *_Nullable, + NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel + messageChannelWithName: + @"dev.flutter.pigeon.FlutterIntegrationCoreApi.sendMultipleNullableTypes" + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:@[ + arg_aNullableBool ?: [NSNull null], arg_aNullableInt ?: [NSNull null], + arg_aNullableString ?: [NSNull null] + ] + reply:^(id reply) { + AllNullableTypes *output = reply; + completion(output, nil); + }]; } -- (void)echoBool:(NSNumber *)arg_aBool completion:(void(^)(NSNumber *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)echoBool:(NSNumber *)arg_aBool + completion:(void (^)(NSNumber *_Nullable, NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.echoBool" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:@[arg_aBool ?: [NSNull null]] reply:^(id reply) { - NSNumber *output = reply; - completion(output, nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:@[ arg_aBool ?: [NSNull null] ] + reply:^(id reply) { + NSNumber *output = reply; + completion(output, nil); + }]; } -- (void)echoInt:(NSNumber *)arg_anInt completion:(void(^)(NSNumber *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)echoInt:(NSNumber *)arg_anInt + completion:(void (^)(NSNumber *_Nullable, NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.echoInt" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:@[arg_anInt ?: [NSNull null]] reply:^(id reply) { - NSNumber *output = reply; - completion(output, nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:@[ arg_anInt ?: [NSNull null] ] + reply:^(id reply) { + NSNumber *output = reply; + completion(output, nil); + }]; } -- (void)echoDouble:(NSNumber *)arg_aDouble completion:(void(^)(NSNumber *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)echoDouble:(NSNumber *)arg_aDouble + completion:(void (^)(NSNumber *_Nullable, NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.echoDouble" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:@[arg_aDouble ?: [NSNull null]] reply:^(id reply) { - NSNumber *output = reply; - completion(output, nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:@[ arg_aDouble ?: [NSNull null] ] + reply:^(id reply) { + NSNumber *output = reply; + completion(output, nil); + }]; } -- (void)echoString:(NSString *)arg_aString completion:(void(^)(NSString *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)echoString:(NSString *)arg_aString + completion:(void (^)(NSString *_Nullable, NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.echoString" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:@[arg_aString ?: [NSNull null]] reply:^(id reply) { - NSString *output = reply; - completion(output, nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:@[ arg_aString ?: [NSNull null] ] + reply:^(id reply) { + NSString *output = reply; + completion(output, nil); + }]; } -- (void)echoUint8List:(FlutterStandardTypedData *)arg_aList completion:(void(^)(FlutterStandardTypedData *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)echoUint8List:(FlutterStandardTypedData *)arg_aList + completion: + (void (^)(FlutterStandardTypedData *_Nullable, NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.echoUint8List" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:@[arg_aList ?: [NSNull null]] reply:^(id reply) { - FlutterStandardTypedData *output = reply; - completion(output, nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:@[ arg_aList ?: [NSNull null] ] + reply:^(id reply) { + FlutterStandardTypedData *output = reply; + completion(output, nil); + }]; } -- (void)echoList:(NSArray *)arg_aList completion:(void(^)(NSArray *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)echoList:(NSArray *)arg_aList + completion:(void (^)(NSArray *_Nullable, NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.echoList" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:@[arg_aList ?: [NSNull null]] reply:^(id reply) { - NSArray *output = reply; - completion(output, nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:@[ arg_aList ?: [NSNull null] ] + reply:^(id reply) { + NSArray *output = reply; + completion(output, nil); + }]; } -- (void)echoMap:(NSDictionary *)arg_aMap completion:(void(^)(NSDictionary *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)echoMap:(NSDictionary *)arg_aMap + completion:(void (^)(NSDictionary *_Nullable, NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.echoMap" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:@[arg_aMap ?: [NSNull null]] reply:^(id reply) { - NSDictionary *output = reply; - completion(output, nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:@[ arg_aMap ?: [NSNull null] ] + reply:^(id reply) { + NSDictionary *output = reply; + completion(output, nil); + }]; } -- (void)echoNullableBool:(nullable NSNumber *)arg_aBool completion:(void(^)(NSNumber *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)echoNullableBool:(nullable NSNumber *)arg_aBool + completion:(void (^)(NSNumber *_Nullable, NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableBool" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:@[arg_aBool ?: [NSNull null]] reply:^(id reply) { - NSNumber *output = reply; - completion(output, nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:@[ arg_aBool ?: [NSNull null] ] + reply:^(id reply) { + NSNumber *output = reply; + completion(output, nil); + }]; } -- (void)echoNullableInt:(nullable NSNumber *)arg_anInt completion:(void(^)(NSNumber *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)echoNullableInt:(nullable NSNumber *)arg_anInt + completion:(void (^)(NSNumber *_Nullable, NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableInt" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:@[arg_anInt ?: [NSNull null]] reply:^(id reply) { - NSNumber *output = reply; - completion(output, nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:@[ arg_anInt ?: [NSNull null] ] + reply:^(id reply) { + NSNumber *output = reply; + completion(output, nil); + }]; } -- (void)echoNullableDouble:(nullable NSNumber *)arg_aDouble completion:(void(^)(NSNumber *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)echoNullableDouble:(nullable NSNumber *)arg_aDouble + completion:(void (^)(NSNumber *_Nullable, NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableDouble" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:@[arg_aDouble ?: [NSNull null]] reply:^(id reply) { - NSNumber *output = reply; - completion(output, nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:@[ arg_aDouble ?: [NSNull null] ] + reply:^(id reply) { + NSNumber *output = reply; + completion(output, nil); + }]; } -- (void)echoNullableString:(nullable NSString *)arg_aString completion:(void(^)(NSString *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)echoNullableString:(nullable NSString *)arg_aString + completion:(void (^)(NSString *_Nullable, NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableString" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:@[arg_aString ?: [NSNull null]] reply:^(id reply) { - NSString *output = reply; - completion(output, nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:@[ arg_aString ?: [NSNull null] ] + reply:^(id reply) { + NSString *output = reply; + completion(output, nil); + }]; } -- (void)echoNullableUint8List:(nullable FlutterStandardTypedData *)arg_aList completion:(void(^)(FlutterStandardTypedData *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)echoNullableUint8List:(nullable FlutterStandardTypedData *)arg_aList + completion:(void (^)(FlutterStandardTypedData *_Nullable, + NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableUint8List" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:@[arg_aList ?: [NSNull null]] reply:^(id reply) { - FlutterStandardTypedData *output = reply; - completion(output, nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:@[ arg_aList ?: [NSNull null] ] + reply:^(id reply) { + FlutterStandardTypedData *output = reply; + completion(output, nil); + }]; } -- (void)echoNullableList:(nullable NSArray *)arg_aList completion:(void(^)(NSArray *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)echoNullableList:(nullable NSArray *)arg_aList + completion:(void (^)(NSArray *_Nullable, NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:@[arg_aList ?: [NSNull null]] reply:^(id reply) { - NSArray *output = reply; - completion(output, nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:@[ arg_aList ?: [NSNull null] ] + reply:^(id reply) { + NSArray *output = reply; + completion(output, nil); + }]; } -- (void)echoNullableMap:(NSDictionary *)arg_aMap completion:(void(^)(NSDictionary *_Nullable, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel +- (void)echoNullableMap:(NSDictionary *)arg_aMap + completion: + (void (^)(NSDictionary *_Nullable, NSError *_Nullable))completion { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap" - binaryMessenger:self.binaryMessenger - codec:FlutterIntegrationCoreApiGetCodec()]; - [channel sendMessage:@[arg_aMap ?: [NSNull null]] reply:^(id reply) { - NSDictionary *output = reply; - completion(output, nil); - }]; + binaryMessenger:self.binaryMessenger + codec:FlutterIntegrationCoreApiGetCodec()]; + [channel sendMessage:@[ arg_aMap ?: [NSNull null] ] + reply:^(id reply) { + NSDictionary *output = reply; + completion(output, nil); + }]; } @end @@ -1040,22 +1088,22 @@ - (void)echoNullableMap:(NSDictionary *)arg_aMap completion:(voi return sSharedObject; } -void HostTrivialApiSetup(id binaryMessenger, NSObject *api) { +void HostTrivialApiSetup(id binaryMessenger, + NSObject *api) { { FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.HostTrivialApi.noop" - binaryMessenger:binaryMessenger - codec:HostTrivialApiGetCodec()]; + [[FlutterBasicMessageChannel alloc] initWithName:@"dev.flutter.pigeon.HostTrivialApi.noop" + binaryMessenger:binaryMessenger + codec:HostTrivialApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(noopWithError:)], @"HostTrivialApi api (%@) doesn't respond to @selector(noopWithError:)", api); + NSCAssert([api respondsToSelector:@selector(noopWithError:)], + @"HostTrivialApi api (%@) doesn't respond to @selector(noopWithError:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { FlutterError *error; [api noopWithError:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } 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 index bf6e201a31b..213aa4855e9 100644 --- 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 @@ -1,7 +1,7 @@ // 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 (v6.0.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 @@ -83,8 +83,7 @@ class AllTypes { aFloatArray: result[6]! as Float64List, aList: result[7]! as List, aMap: result[8]! as Map, - anEnum: AnEnum.values[result[9]! as int] -, + anEnum: AnEnum.values[result[9]! as int], aString: result[10]! as String, ); } @@ -168,11 +167,12 @@ class AllNullableTypes { aNullableList: result[7] as List?, aNullableMap: result[8] as Map?, nullableNestedList: (result[9] as List?)?.cast?>(), - nullableMapWithAnnotations: (result[10] as Map?)?.cast(), - nullableMapWithObject: (result[11] as Map?)?.cast(), - aNullableEnum: result[12] != null - ? AnEnum.values[result[12]! as int] - : null, + nullableMapWithAnnotations: + (result[10] as Map?)?.cast(), + nullableMapWithObject: + (result[11] as Map?)?.cast(), + aNullableEnum: + result[12] != null ? AnEnum.values[result[12]! as int] : null, aNullableString: result[13] as String?, ); } @@ -194,11 +194,11 @@ class AllNullableTypesWrapper { static AllNullableTypesWrapper decode(Object result) { result as List; return AllNullableTypesWrapper( - values: AllNullableTypes.decode(result[0]! as List) -, + values: AllNullableTypes.decode(result[0]! as List), ); } } + class _HostIntegrationCoreApiCodec extends StandardMessageCodec { const _HostIntegrationCoreApiCodec(); @override @@ -220,19 +220,17 @@ class _HostIntegrationCoreApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return AllNullableTypes.decode(readValue(buffer)!); - - case 129: + + case 129: return AllNullableTypesWrapper.decode(readValue(buffer)!); - - case 130: + + case 130: return AllTypes.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -255,8 +253,7 @@ class HostIntegrationCoreApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.HostIntegrationCoreApi.noop', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -302,7 +299,8 @@ class HostIntegrationCoreApi { } /// Returns the passed object, to test serialization and deserialization. - Future echoAllNullableTypes(AllNullableTypes? arg_everything) async { + Future echoAllNullableTypes( + AllNullableTypes? arg_everything) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.HostIntegrationCoreApi.echoAllNullableTypes', codec, binaryMessenger: _binaryMessenger); @@ -329,8 +327,7 @@ class HostIntegrationCoreApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.HostIntegrationCoreApi.throwError', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -517,9 +514,11 @@ class HostIntegrationCoreApi { /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. - Future extractNestedNullableString(AllNullableTypesWrapper arg_wrapper) async { + Future extractNestedNullableString( + AllNullableTypesWrapper arg_wrapper) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.HostIntegrationCoreApi.extractNestedNullableString', codec, + 'dev.flutter.pigeon.HostIntegrationCoreApi.extractNestedNullableString', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_wrapper]) as List?; @@ -541,9 +540,11 @@ class HostIntegrationCoreApi { /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. - Future createNestedNullableString(String? arg_nullableString) async { + Future createNestedNullableString( + String? arg_nullableString) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.HostIntegrationCoreApi.createNestedNullableString', codec, + 'dev.flutter.pigeon.HostIntegrationCoreApi.createNestedNullableString', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_nullableString]) as List?; @@ -569,12 +570,15 @@ class HostIntegrationCoreApi { } /// Returns passed in arguments of multiple types. - Future sendMultipleNullableTypes(bool? arg_aNullableBool, int? arg_aNullableInt, String? arg_aNullableString) async { + Future sendMultipleNullableTypes(bool? arg_aNullableBool, + int? arg_aNullableInt, String? arg_aNullableString) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.HostIntegrationCoreApi.sendMultipleNullableTypes', codec, + 'dev.flutter.pigeon.HostIntegrationCoreApi.sendMultipleNullableTypes', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aNullableBool, arg_aNullableInt, arg_aNullableString]) as List?; + final List? replyList = await channel.send( + [arg_aNullableBool, arg_aNullableInt, arg_aNullableString]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -689,9 +693,11 @@ class HostIntegrationCoreApi { } /// Returns the passed in Uint8List. - Future echoNullableUint8List(Uint8List? arg_aNullableUint8List) async { + Future echoNullableUint8List( + Uint8List? arg_aNullableUint8List) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableUint8List', codec, + 'dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableUint8List', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_aNullableUint8List]) as List?; @@ -740,8 +746,7 @@ class HostIntegrationCoreApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.HostIntegrationCoreApi.noopAsync', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -790,8 +795,7 @@ class HostIntegrationCoreApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterNoop', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -810,7 +814,8 @@ class HostIntegrationCoreApi { Future callFlutterEchoString(String arg_aString) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoString', codec, + 'dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoString', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_aString]) as List?; @@ -835,6 +840,7 @@ class HostIntegrationCoreApi { } } } + class _FlutterIntegrationCoreApiCodec extends StandardMessageCodec { const _FlutterIntegrationCoreApiCodec(); @override @@ -856,19 +862,17 @@ class _FlutterIntegrationCoreApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return AllNullableTypes.decode(readValue(buffer)!); - - case 129: + + case 129: return AllNullableTypesWrapper.decode(readValue(buffer)!); - - case 130: + + case 130: return AllTypes.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -891,7 +895,8 @@ abstract class FlutterIntegrationCoreApi { /// Returns passed in arguments of multiple types. /// /// Tests multiple-arity FlutterApi handling. - AllNullableTypes sendMultipleNullableTypes(bool? aNullableBool, int? aNullableInt, String? aNullableString); + AllNullableTypes sendMultipleNullableTypes( + bool? aNullableBool, int? aNullableInt, String? aNullableString); /// Returns the passed boolean, to test serialization and deserialization. bool echoBool(bool aBool); @@ -935,7 +940,8 @@ abstract class FlutterIntegrationCoreApi { /// Returns the passed map, to test serialization and deserialization. Map echoNullableMap(Map aMap); - static void setup(FlutterIntegrationCoreApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(FlutterIntegrationCoreApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.FlutterIntegrationCoreApi.noop', codec, @@ -959,10 +965,11 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllTypes was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoAllTypes was null, expected non-null AllTypes.'); + assert(arg_everything != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllTypes was null, expected non-null AllTypes.'); final AllTypes output = api.echoAllTypes(arg_everything!); return output; }); @@ -970,37 +977,43 @@ abstract class FlutterIntegrationCoreApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes', codec, + 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoAllNullableTypes was null, expected non-null AllNullableTypes.'); - final AllNullableTypes output = api.echoAllNullableTypes(arg_everything!); + final AllNullableTypes? arg_everything = + (args[0] as AllNullableTypes?); + assert(arg_everything != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes was null, expected non-null AllNullableTypes.'); + final AllNullableTypes output = + api.echoAllNullableTypes(arg_everything!); return output; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterIntegrationCoreApi.sendMultipleNullableTypes', codec, + 'dev.flutter.pigeon.FlutterIntegrationCoreApi.sendMultipleNullableTypes', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.sendMultipleNullableTypes was null.'); + 'Argument for dev.flutter.pigeon.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); + final AllNullableTypes output = api.sendMultipleNullableTypes( + arg_aNullableBool, arg_aNullableInt, arg_aNullableString); return output; }); } @@ -1014,10 +1027,11 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoBool was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoBool was null, expected non-null bool.'); + assert(arg_aBool != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoBool was null, expected non-null bool.'); final bool output = api.echoBool(arg_aBool!); return output; }); @@ -1032,10 +1046,11 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoInt was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoInt was null, expected non-null int.'); + assert(arg_anInt != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoInt was null, expected non-null int.'); final int output = api.echoInt(arg_anInt!); return output; }); @@ -1050,10 +1065,11 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoDouble was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoDouble was null, expected non-null double.'); + assert(arg_aDouble != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoDouble was null, expected non-null double.'); final double output = api.echoDouble(arg_aDouble!); return output; }); @@ -1068,10 +1084,11 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoString was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoString was null, expected non-null String.'); + assert(arg_aString != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoString was null, expected non-null String.'); final String output = api.echoString(arg_aString!); return output; }); @@ -1086,10 +1103,11 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoUint8List was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoUint8List was null, expected non-null Uint8List.'); + assert(arg_aList != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoUint8List was null, expected non-null Uint8List.'); final Uint8List output = api.echoUint8List(arg_aList!); return output; }); @@ -1104,10 +1122,12 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoList was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoList was null, expected non-null List.'); + final List? arg_aList = + (args[0] as List?)?.cast(); + assert(arg_aList != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoList was null, expected non-null List.'); final List output = api.echoList(arg_aList!); return output; }); @@ -1122,10 +1142,12 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoMap was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoMap was null, expected non-null Map.'); + final Map? arg_aMap = + (args[0] as Map?)?.cast(); + assert(arg_aMap != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoMap was null, expected non-null Map.'); final Map output = api.echoMap(arg_aMap!); return output; }); @@ -1133,14 +1155,15 @@ abstract class FlutterIntegrationCoreApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableBool', codec, + 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableBool', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableBool was null.'); + 'Argument for dev.flutter.pigeon.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); @@ -1157,7 +1180,7 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableInt was null.'); + 'Argument for dev.flutter.pigeon.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); @@ -1167,14 +1190,15 @@ abstract class FlutterIntegrationCoreApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableDouble', codec, + 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableDouble', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableDouble was null.'); + 'Argument for dev.flutter.pigeon.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); @@ -1184,14 +1208,15 @@ abstract class FlutterIntegrationCoreApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableString', codec, + 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableString', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableString was null.'); + 'Argument for dev.flutter.pigeon.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); @@ -1201,14 +1226,15 @@ abstract class FlutterIntegrationCoreApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableUint8List', codec, + 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableUint8List', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableUint8List was null.'); + 'Argument for dev.flutter.pigeon.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); @@ -1218,16 +1244,18 @@ abstract class FlutterIntegrationCoreApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList', codec, + 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList was null.'); + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList was null.'); final List args = (message as List?)!; - final List? arg_aList = (args[0] as List?)?.cast(); + final List? arg_aList = + (args[0] as List?)?.cast(); final List? output = api.echoNullableList(arg_aList); return output; }); @@ -1242,10 +1270,12 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap was null.'); + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap 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.FlutterIntegrationCoreApi.echoNullableMap was null, expected non-null Map.'); + final Map? arg_aMap = + (args[0] as Map?)?.cast(); + assert(arg_aMap != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap was null, expected non-null Map.'); final Map output = api.echoNullableMap(arg_aMap!); return output; }); @@ -1269,8 +1299,7 @@ class HostTrivialApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.HostTrivialApi.noop', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/multiple_arity.gen.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/multiple_arity.gen.dart index 913b97011d9..32325c58162 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/multiple_arity.gen.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/multiple_arity.gen.dart @@ -1,7 +1,7 @@ // 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 (v6.0.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 @@ -55,7 +55,8 @@ abstract class MultipleArityFlutterApi { int subtract(int x, int y); - static void setup(MultipleArityFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(MultipleArityFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.MultipleArityFlutterApi.subtract', codec, @@ -65,12 +66,14 @@ abstract class MultipleArityFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.MultipleArityFlutterApi.subtract was null.'); + 'Argument for dev.flutter.pigeon.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.MultipleArityFlutterApi.subtract was null, expected non-null int.'); + assert(arg_x != null, + 'Argument for dev.flutter.pigeon.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.MultipleArityFlutterApi.subtract was null, expected non-null int.'); + assert(arg_y != null, + 'Argument for dev.flutter.pigeon.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/flutter_null_safe_unit_tests/lib/non_null_fields.gen.dart index 62b21ac1d4e..cf6d1c1f80b 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/non_null_fields.gen.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/non_null_fields.gen.dart @@ -1,7 +1,7 @@ // 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 (v6.0.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 @@ -99,13 +99,12 @@ class NonNullFieldSearchReply { result: result[0]! as String, error: result[1]! as String, indices: (result[2] as List?)!.cast(), - extraData: ExtraData.decode(result[3]! as List) -, - type: ReplyType.values[result[4]! as int] -, + extraData: ExtraData.decode(result[3]! as List), + type: ReplyType.values[result[4]! as int], ); } } + class _NonNullFieldHostApiCodec extends StandardMessageCodec { const _NonNullFieldHostApiCodec(); @override @@ -127,19 +126,17 @@ class _NonNullFieldHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return ExtraData.decode(readValue(buffer)!); - - case 129: + + case 129: return NonNullFieldSearchReply.decode(readValue(buffer)!); - - case 130: + + case 130: return NonNullFieldSearchRequest.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -154,7 +151,8 @@ class NonNullFieldHostApi { static const MessageCodec codec = _NonNullFieldHostApiCodec(); - Future search(NonNullFieldSearchRequest arg_nested) async { + Future search( + NonNullFieldSearchRequest arg_nested) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NonNullFieldHostApi.search', codec, binaryMessenger: _binaryMessenger); @@ -181,6 +179,7 @@ class NonNullFieldHostApi { } } } + class _NonNullFieldFlutterApiCodec extends StandardMessageCodec { const _NonNullFieldFlutterApiCodec(); @override @@ -202,19 +201,17 @@ class _NonNullFieldFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return ExtraData.decode(readValue(buffer)!); - - case 129: + + case 129: return NonNullFieldSearchReply.decode(readValue(buffer)!); - - case 130: + + case 130: return NonNullFieldSearchRequest.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -224,7 +221,8 @@ abstract class NonNullFieldFlutterApi { NonNullFieldSearchReply search(NonNullFieldSearchRequest request); - static void setup(NonNullFieldFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(NonNullFieldFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NonNullFieldFlutterApi.search', codec, @@ -234,10 +232,12 @@ abstract class NonNullFieldFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.NonNullFieldFlutterApi.search was null.'); + 'Argument for dev.flutter.pigeon.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.NonNullFieldFlutterApi.search was null, expected non-null NonNullFieldSearchRequest.'); + final NonNullFieldSearchRequest? arg_request = + (args[0] as NonNullFieldSearchRequest?); + assert(arg_request != null, + 'Argument for dev.flutter.pigeon.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/flutter_null_safe_unit_tests/lib/null_fields.gen.dart index 15c27fafb68..c3720c48a6e 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_fields.gen.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_fields.gen.dart @@ -1,7 +1,7 @@ // 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 (v6.0.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 @@ -87,6 +87,7 @@ class NullFieldsSearchReply { ); } } + class _NullFieldsHostApiCodec extends StandardMessageCodec { const _NullFieldsHostApiCodec(); @override @@ -105,16 +106,14 @@ class _NullFieldsHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NullFieldsSearchReply.decode(readValue(buffer)!); - - case 129: + + case 129: return NullFieldsSearchRequest.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -129,7 +128,8 @@ class NullFieldsHostApi { static const MessageCodec codec = _NullFieldsHostApiCodec(); - Future search(NullFieldsSearchRequest arg_nested) async { + Future search( + NullFieldsSearchRequest arg_nested) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NullFieldsHostApi.search', codec, binaryMessenger: _binaryMessenger); @@ -156,6 +156,7 @@ class NullFieldsHostApi { } } } + class _NullFieldsFlutterApiCodec extends StandardMessageCodec { const _NullFieldsFlutterApiCodec(); @override @@ -174,16 +175,14 @@ class _NullFieldsFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return NullFieldsSearchReply.decode(readValue(buffer)!); - - case 129: + + case 129: return NullFieldsSearchRequest.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -193,7 +192,8 @@ abstract class NullFieldsFlutterApi { NullFieldsSearchReply search(NullFieldsSearchRequest request); - static void setup(NullFieldsFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(NullFieldsFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NullFieldsFlutterApi.search', codec, @@ -203,10 +203,12 @@ abstract class NullFieldsFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.NullFieldsFlutterApi.search was null.'); + 'Argument for dev.flutter.pigeon.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.NullFieldsFlutterApi.search was null, expected non-null NullFieldsSearchRequest.'); + final NullFieldsSearchRequest? arg_request = + (args[0] as NullFieldsSearchRequest?); + assert(arg_request != null, + 'Argument for dev.flutter.pigeon.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/null_safe_pigeon.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_safe_pigeon.dart index d477c897380..09af9d96844 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_safe_pigeon.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_safe_pigeon.dart @@ -1,7 +1,7 @@ // 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 (v6.0.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 @@ -100,6 +100,7 @@ class FlutterSearchReplies { ); } } + class _ApiCodec extends StandardMessageCodec { const _ApiCodec(); @override @@ -124,22 +125,20 @@ class _ApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return FlutterSearchReplies.decode(readValue(buffer)!); - - case 129: + + case 129: return FlutterSearchReply.decode(readValue(buffer)!); - - case 130: + + case 130: return FlutterSearchRequest.decode(readValue(buffer)!); - - case 131: + + case 131: return FlutterSearchRequests.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -148,8 +147,7 @@ class Api { /// Constructor for [Api]. 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. - Api({BinaryMessenger? binaryMessenger}) - : _binaryMessenger = binaryMessenger; + Api({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _ApiCodec(); @@ -181,7 +179,8 @@ class Api { } } - Future doSearches(FlutterSearchRequests arg_request) async { + Future doSearches( + FlutterSearchRequests arg_request) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.Api.doSearches', codec, binaryMessenger: _binaryMessenger); diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/nullable_returns.gen.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/nullable_returns.gen.dart index 1f0574faf2f..f02f793ef8b 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/nullable_returns.gen.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/nullable_returns.gen.dart @@ -1,7 +1,7 @@ // 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 (v6.0.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 @@ -26,8 +26,7 @@ class NullableReturnHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NullableReturnHostApi.doit', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -50,7 +49,8 @@ abstract class NullableReturnFlutterApi { int? doit(); - static void setup(NullableReturnFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(NullableReturnFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NullableReturnFlutterApi.doit', codec, @@ -111,7 +111,8 @@ abstract class NullableArgFlutterApi { int doit(int? x); - static void setup(NullableArgFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(NullableArgFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NullableArgFlutterApi.doit', codec, @@ -121,7 +122,7 @@ abstract class NullableArgFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.NullableArgFlutterApi.doit was null.'); + 'Argument for dev.flutter.pigeon.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); @@ -146,8 +147,7 @@ class NullableCollectionReturnHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NullableCollectionReturnHostApi.doit', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -170,7 +170,8 @@ abstract class NullableCollectionReturnFlutterApi { List? doit(); - static void setup(NullableCollectionReturnFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(NullableCollectionReturnFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NullableCollectionReturnFlutterApi.doit', codec, @@ -231,7 +232,8 @@ abstract class NullableCollectionArgFlutterApi { List doit(List? x); - static void setup(NullableCollectionArgFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(NullableCollectionArgFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NullableCollectionArgFlutterApi.doit', codec, @@ -241,9 +243,10 @@ abstract class NullableCollectionArgFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.NullableCollectionArgFlutterApi.doit was null.'); + 'Argument for dev.flutter.pigeon.NullableCollectionArgFlutterApi.doit was null.'); final List args = (message as List?)!; - final List? arg_x = (args[0] as List?)?.cast(); + final List? arg_x = + (args[0] as List?)?.cast(); final List output = api.doit(arg_x); return output; }); diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.dart index 3ff03d79f7c..e7e9dc0527c 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.dart @@ -1,7 +1,7 @@ // 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 (v6.0.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 @@ -287,7 +287,8 @@ abstract class PrimitiveFlutterApi { Map aStringIntMap(Map value); - static void setup(PrimitiveFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(PrimitiveFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PrimitiveFlutterApi.anInt', codec, @@ -297,10 +298,11 @@ abstract class PrimitiveFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PrimitiveFlutterApi.anInt was null.'); + 'Argument for dev.flutter.pigeon.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.PrimitiveFlutterApi.anInt was null, expected non-null int.'); + assert(arg_value != null, + 'Argument for dev.flutter.pigeon.PrimitiveFlutterApi.anInt was null, expected non-null int.'); final int output = api.anInt(arg_value!); return output; }); @@ -315,10 +317,11 @@ abstract class PrimitiveFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PrimitiveFlutterApi.aBool was null.'); + 'Argument for dev.flutter.pigeon.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.PrimitiveFlutterApi.aBool was null, expected non-null bool.'); + assert(arg_value != null, + 'Argument for dev.flutter.pigeon.PrimitiveFlutterApi.aBool was null, expected non-null bool.'); final bool output = api.aBool(arg_value!); return output; }); @@ -333,10 +336,11 @@ abstract class PrimitiveFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PrimitiveFlutterApi.aString was null.'); + 'Argument for dev.flutter.pigeon.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.PrimitiveFlutterApi.aString was null, expected non-null String.'); + assert(arg_value != null, + 'Argument for dev.flutter.pigeon.PrimitiveFlutterApi.aString was null, expected non-null String.'); final String output = api.aString(arg_value!); return output; }); @@ -351,10 +355,11 @@ abstract class PrimitiveFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PrimitiveFlutterApi.aDouble was null.'); + 'Argument for dev.flutter.pigeon.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.PrimitiveFlutterApi.aDouble was null, expected non-null double.'); + assert(arg_value != null, + 'Argument for dev.flutter.pigeon.PrimitiveFlutterApi.aDouble was null, expected non-null double.'); final double output = api.aDouble(arg_value!); return output; }); @@ -369,10 +374,12 @@ abstract class PrimitiveFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PrimitiveFlutterApi.aMap was null.'); + 'Argument for dev.flutter.pigeon.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.PrimitiveFlutterApi.aMap was null, expected non-null Map.'); + final Map? arg_value = + (args[0] as Map?); + assert(arg_value != null, + 'Argument for dev.flutter.pigeon.PrimitiveFlutterApi.aMap was null, expected non-null Map.'); final Map output = api.aMap(arg_value!); return output; }); @@ -387,10 +394,11 @@ abstract class PrimitiveFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PrimitiveFlutterApi.aList was null.'); + 'Argument for dev.flutter.pigeon.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.PrimitiveFlutterApi.aList was null, expected non-null List.'); + assert(arg_value != null, + 'Argument for dev.flutter.pigeon.PrimitiveFlutterApi.aList was null, expected non-null List.'); final List output = api.aList(arg_value!); return output; }); @@ -405,10 +413,11 @@ abstract class PrimitiveFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PrimitiveFlutterApi.anInt32List was null.'); + 'Argument for dev.flutter.pigeon.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.PrimitiveFlutterApi.anInt32List was null, expected non-null Int32List.'); + assert(arg_value != null, + 'Argument for dev.flutter.pigeon.PrimitiveFlutterApi.anInt32List was null, expected non-null Int32List.'); final Int32List output = api.anInt32List(arg_value!); return output; }); @@ -423,10 +432,12 @@ abstract class PrimitiveFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PrimitiveFlutterApi.aBoolList was null.'); + 'Argument for dev.flutter.pigeon.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.PrimitiveFlutterApi.aBoolList was null, expected non-null List.'); + final List? arg_value = + (args[0] as List?)?.cast(); + assert(arg_value != null, + 'Argument for dev.flutter.pigeon.PrimitiveFlutterApi.aBoolList was null, expected non-null List.'); final List output = api.aBoolList(arg_value!); return output; }); @@ -441,10 +452,12 @@ abstract class PrimitiveFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PrimitiveFlutterApi.aStringIntMap was null.'); + 'Argument for dev.flutter.pigeon.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.PrimitiveFlutterApi.aStringIntMap was null, expected non-null Map.'); + final Map? arg_value = + (args[0] as Map?)?.cast(); + assert(arg_value != null, + 'Argument for dev.flutter.pigeon.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/lib/src/generated/core_tests.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart index bf6e201a31b..213aa4855e9 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart @@ -1,7 +1,7 @@ // 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 (v6.0.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 @@ -83,8 +83,7 @@ class AllTypes { aFloatArray: result[6]! as Float64List, aList: result[7]! as List, aMap: result[8]! as Map, - anEnum: AnEnum.values[result[9]! as int] -, + anEnum: AnEnum.values[result[9]! as int], aString: result[10]! as String, ); } @@ -168,11 +167,12 @@ class AllNullableTypes { aNullableList: result[7] as List?, aNullableMap: result[8] as Map?, nullableNestedList: (result[9] as List?)?.cast?>(), - nullableMapWithAnnotations: (result[10] as Map?)?.cast(), - nullableMapWithObject: (result[11] as Map?)?.cast(), - aNullableEnum: result[12] != null - ? AnEnum.values[result[12]! as int] - : null, + nullableMapWithAnnotations: + (result[10] as Map?)?.cast(), + nullableMapWithObject: + (result[11] as Map?)?.cast(), + aNullableEnum: + result[12] != null ? AnEnum.values[result[12]! as int] : null, aNullableString: result[13] as String?, ); } @@ -194,11 +194,11 @@ class AllNullableTypesWrapper { static AllNullableTypesWrapper decode(Object result) { result as List; return AllNullableTypesWrapper( - values: AllNullableTypes.decode(result[0]! as List) -, + values: AllNullableTypes.decode(result[0]! as List), ); } } + class _HostIntegrationCoreApiCodec extends StandardMessageCodec { const _HostIntegrationCoreApiCodec(); @override @@ -220,19 +220,17 @@ class _HostIntegrationCoreApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return AllNullableTypes.decode(readValue(buffer)!); - - case 129: + + case 129: return AllNullableTypesWrapper.decode(readValue(buffer)!); - - case 130: + + case 130: return AllTypes.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -255,8 +253,7 @@ class HostIntegrationCoreApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.HostIntegrationCoreApi.noop', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -302,7 +299,8 @@ class HostIntegrationCoreApi { } /// Returns the passed object, to test serialization and deserialization. - Future echoAllNullableTypes(AllNullableTypes? arg_everything) async { + Future echoAllNullableTypes( + AllNullableTypes? arg_everything) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.HostIntegrationCoreApi.echoAllNullableTypes', codec, binaryMessenger: _binaryMessenger); @@ -329,8 +327,7 @@ class HostIntegrationCoreApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.HostIntegrationCoreApi.throwError', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -517,9 +514,11 @@ class HostIntegrationCoreApi { /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. - Future extractNestedNullableString(AllNullableTypesWrapper arg_wrapper) async { + Future extractNestedNullableString( + AllNullableTypesWrapper arg_wrapper) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.HostIntegrationCoreApi.extractNestedNullableString', codec, + 'dev.flutter.pigeon.HostIntegrationCoreApi.extractNestedNullableString', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_wrapper]) as List?; @@ -541,9 +540,11 @@ class HostIntegrationCoreApi { /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. - Future createNestedNullableString(String? arg_nullableString) async { + Future createNestedNullableString( + String? arg_nullableString) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.HostIntegrationCoreApi.createNestedNullableString', codec, + 'dev.flutter.pigeon.HostIntegrationCoreApi.createNestedNullableString', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_nullableString]) as List?; @@ -569,12 +570,15 @@ class HostIntegrationCoreApi { } /// Returns passed in arguments of multiple types. - Future sendMultipleNullableTypes(bool? arg_aNullableBool, int? arg_aNullableInt, String? arg_aNullableString) async { + Future sendMultipleNullableTypes(bool? arg_aNullableBool, + int? arg_aNullableInt, String? arg_aNullableString) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.HostIntegrationCoreApi.sendMultipleNullableTypes', codec, + 'dev.flutter.pigeon.HostIntegrationCoreApi.sendMultipleNullableTypes', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_aNullableBool, arg_aNullableInt, arg_aNullableString]) as List?; + final List? replyList = await channel.send( + [arg_aNullableBool, arg_aNullableInt, arg_aNullableString]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -689,9 +693,11 @@ class HostIntegrationCoreApi { } /// Returns the passed in Uint8List. - Future echoNullableUint8List(Uint8List? arg_aNullableUint8List) async { + Future echoNullableUint8List( + Uint8List? arg_aNullableUint8List) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableUint8List', codec, + 'dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableUint8List', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_aNullableUint8List]) as List?; @@ -740,8 +746,7 @@ class HostIntegrationCoreApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.HostIntegrationCoreApi.noopAsync', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -790,8 +795,7 @@ class HostIntegrationCoreApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterNoop', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -810,7 +814,8 @@ class HostIntegrationCoreApi { Future callFlutterEchoString(String arg_aString) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoString', codec, + 'dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoString', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_aString]) as List?; @@ -835,6 +840,7 @@ class HostIntegrationCoreApi { } } } + class _FlutterIntegrationCoreApiCodec extends StandardMessageCodec { const _FlutterIntegrationCoreApiCodec(); @override @@ -856,19 +862,17 @@ class _FlutterIntegrationCoreApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return AllNullableTypes.decode(readValue(buffer)!); - - case 129: + + case 129: return AllNullableTypesWrapper.decode(readValue(buffer)!); - - case 130: + + case 130: return AllTypes.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } @@ -891,7 +895,8 @@ abstract class FlutterIntegrationCoreApi { /// Returns passed in arguments of multiple types. /// /// Tests multiple-arity FlutterApi handling. - AllNullableTypes sendMultipleNullableTypes(bool? aNullableBool, int? aNullableInt, String? aNullableString); + AllNullableTypes sendMultipleNullableTypes( + bool? aNullableBool, int? aNullableInt, String? aNullableString); /// Returns the passed boolean, to test serialization and deserialization. bool echoBool(bool aBool); @@ -935,7 +940,8 @@ abstract class FlutterIntegrationCoreApi { /// Returns the passed map, to test serialization and deserialization. Map echoNullableMap(Map aMap); - static void setup(FlutterIntegrationCoreApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(FlutterIntegrationCoreApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.FlutterIntegrationCoreApi.noop', codec, @@ -959,10 +965,11 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllTypes was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoAllTypes was null, expected non-null AllTypes.'); + assert(arg_everything != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllTypes was null, expected non-null AllTypes.'); final AllTypes output = api.echoAllTypes(arg_everything!); return output; }); @@ -970,37 +977,43 @@ abstract class FlutterIntegrationCoreApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes', codec, + 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoAllNullableTypes was null, expected non-null AllNullableTypes.'); - final AllNullableTypes output = api.echoAllNullableTypes(arg_everything!); + final AllNullableTypes? arg_everything = + (args[0] as AllNullableTypes?); + assert(arg_everything != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes was null, expected non-null AllNullableTypes.'); + final AllNullableTypes output = + api.echoAllNullableTypes(arg_everything!); return output; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterIntegrationCoreApi.sendMultipleNullableTypes', codec, + 'dev.flutter.pigeon.FlutterIntegrationCoreApi.sendMultipleNullableTypes', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.sendMultipleNullableTypes was null.'); + 'Argument for dev.flutter.pigeon.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); + final AllNullableTypes output = api.sendMultipleNullableTypes( + arg_aNullableBool, arg_aNullableInt, arg_aNullableString); return output; }); } @@ -1014,10 +1027,11 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoBool was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoBool was null, expected non-null bool.'); + assert(arg_aBool != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoBool was null, expected non-null bool.'); final bool output = api.echoBool(arg_aBool!); return output; }); @@ -1032,10 +1046,11 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoInt was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoInt was null, expected non-null int.'); + assert(arg_anInt != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoInt was null, expected non-null int.'); final int output = api.echoInt(arg_anInt!); return output; }); @@ -1050,10 +1065,11 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoDouble was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoDouble was null, expected non-null double.'); + assert(arg_aDouble != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoDouble was null, expected non-null double.'); final double output = api.echoDouble(arg_aDouble!); return output; }); @@ -1068,10 +1084,11 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoString was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoString was null, expected non-null String.'); + assert(arg_aString != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoString was null, expected non-null String.'); final String output = api.echoString(arg_aString!); return output; }); @@ -1086,10 +1103,11 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoUint8List was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoUint8List was null, expected non-null Uint8List.'); + assert(arg_aList != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoUint8List was null, expected non-null Uint8List.'); final Uint8List output = api.echoUint8List(arg_aList!); return output; }); @@ -1104,10 +1122,12 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoList was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoList was null, expected non-null List.'); + final List? arg_aList = + (args[0] as List?)?.cast(); + assert(arg_aList != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoList was null, expected non-null List.'); final List output = api.echoList(arg_aList!); return output; }); @@ -1122,10 +1142,12 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoMap was null.'); + 'Argument for dev.flutter.pigeon.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.FlutterIntegrationCoreApi.echoMap was null, expected non-null Map.'); + final Map? arg_aMap = + (args[0] as Map?)?.cast(); + assert(arg_aMap != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoMap was null, expected non-null Map.'); final Map output = api.echoMap(arg_aMap!); return output; }); @@ -1133,14 +1155,15 @@ abstract class FlutterIntegrationCoreApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableBool', codec, + 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableBool', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableBool was null.'); + 'Argument for dev.flutter.pigeon.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); @@ -1157,7 +1180,7 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableInt was null.'); + 'Argument for dev.flutter.pigeon.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); @@ -1167,14 +1190,15 @@ abstract class FlutterIntegrationCoreApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableDouble', codec, + 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableDouble', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableDouble was null.'); + 'Argument for dev.flutter.pigeon.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); @@ -1184,14 +1208,15 @@ abstract class FlutterIntegrationCoreApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableString', codec, + 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableString', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableString was null.'); + 'Argument for dev.flutter.pigeon.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); @@ -1201,14 +1226,15 @@ abstract class FlutterIntegrationCoreApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableUint8List', codec, + 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableUint8List', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableUint8List was null.'); + 'Argument for dev.flutter.pigeon.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); @@ -1218,16 +1244,18 @@ abstract class FlutterIntegrationCoreApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList', codec, + 'dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList was null.'); + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList was null.'); final List args = (message as List?)!; - final List? arg_aList = (args[0] as List?)?.cast(); + final List? arg_aList = + (args[0] as List?)?.cast(); final List? output = api.echoNullableList(arg_aList); return output; }); @@ -1242,10 +1270,12 @@ abstract class FlutterIntegrationCoreApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap was null.'); + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap 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.FlutterIntegrationCoreApi.echoNullableMap was null, expected non-null Map.'); + final Map? arg_aMap = + (args[0] as Map?)?.cast(); + assert(arg_aMap != null, + 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap was null, expected non-null Map.'); final Map output = api.echoNullableMap(arg_aMap!); return output; }); @@ -1269,8 +1299,7 @@ class HostTrivialApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.HostTrivialApi.noop', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', diff --git a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp index 6884ffcc7a4..98d83ea4bbf 100644 --- a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp +++ b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp @@ -1,7 +1,7 @@ // 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 (v6.0.4), do not edit directly. // See also: https://pub.dev/packages/pigeon @@ -31,43 +31,65 @@ void AllTypes::set_an_int(int64_t value_arg) { an_int_ = value_arg; } double AllTypes::a_double() const { return a_double_; } void AllTypes::set_a_double(double value_arg) { a_double_ = value_arg; } -const std::vector& AllTypes::a_byte_array() const { return a_byte_array_; } -void AllTypes::set_a_byte_array(const std::vector& value_arg) { a_byte_array_ = value_arg; } +const std::vector& AllTypes::a_byte_array() const { + return a_byte_array_; +} +void AllTypes::set_a_byte_array(const std::vector& value_arg) { + a_byte_array_ = value_arg; +} -const std::vector& AllTypes::a4_byte_array() const { return a4_byte_array_; } -void AllTypes::set_a4_byte_array(const std::vector& value_arg) { a4_byte_array_ = value_arg; } +const std::vector& AllTypes::a4_byte_array() const { + return a4_byte_array_; +} +void AllTypes::set_a4_byte_array(const std::vector& value_arg) { + a4_byte_array_ = value_arg; +} -const std::vector& AllTypes::a8_byte_array() const { return a8_byte_array_; } -void AllTypes::set_a8_byte_array(const std::vector& value_arg) { a8_byte_array_ = value_arg; } +const std::vector& AllTypes::a8_byte_array() const { + return a8_byte_array_; +} +void AllTypes::set_a8_byte_array(const std::vector& value_arg) { + a8_byte_array_ = value_arg; +} -const std::vector& AllTypes::a_float_array() const { return a_float_array_; } -void AllTypes::set_a_float_array(const std::vector& value_arg) { a_float_array_ = value_arg; } +const std::vector& AllTypes::a_float_array() const { + return a_float_array_; +} +void AllTypes::set_a_float_array(const std::vector& value_arg) { + a_float_array_ = value_arg; +} const flutter::EncodableList& AllTypes::a_list() const { return a_list_; } -void AllTypes::set_a_list(const flutter::EncodableList& value_arg) { a_list_ = value_arg; } +void AllTypes::set_a_list(const flutter::EncodableList& value_arg) { + a_list_ = value_arg; +} const flutter::EncodableMap& AllTypes::a_map() const { return a_map_; } -void AllTypes::set_a_map(const flutter::EncodableMap& value_arg) { a_map_ = value_arg; } +void AllTypes::set_a_map(const flutter::EncodableMap& value_arg) { + a_map_ = value_arg; +} const AnEnum& AllTypes::an_enum() const { return an_enum_; } void AllTypes::set_an_enum(const AnEnum& value_arg) { an_enum_ = value_arg; } const std::string& AllTypes::a_string() const { return a_string_; } -void AllTypes::set_a_string(std::string_view value_arg) { a_string_ = value_arg; } +void AllTypes::set_a_string(std::string_view value_arg) { + a_string_ = value_arg; +} flutter::EncodableList AllTypes::ToEncodableList() const { -return flutter::EncodableList{ - flutter::EncodableValue(a_bool_), - flutter::EncodableValue(an_int_), - flutter::EncodableValue(a_double_), - flutter::EncodableValue(a_byte_array_), - flutter::EncodableValue(a4_byte_array_), - flutter::EncodableValue(a8_byte_array_), - flutter::EncodableValue(a_float_array_), - flutter::EncodableValue(a_list_), - flutter::EncodableValue(a_map_), - flutter::EncodableValue((int)an_enum_), - flutter::EncodableValue(a_string_), + return flutter::EncodableList{ + flutter::EncodableValue(a_bool_), + flutter::EncodableValue(an_int_), + flutter::EncodableValue(a_double_), + flutter::EncodableValue(a_byte_array_), + flutter::EncodableValue(a4_byte_array_), + flutter::EncodableValue(a8_byte_array_), + flutter::EncodableValue(a_float_array_), + flutter::EncodableValue(a_list_), + flutter::EncodableValue(a_map_), + flutter::EncodableValue((int)an_enum_), + flutter::EncodableValue(a_string_), }; } @@ -81,119 +103,273 @@ AllTypes::AllTypes(const flutter::EncodableList& list) { auto& encodable_an_int = list[1]; if (const int32_t* pointer_an_int = std::get_if(&encodable_an_int)) an_int_ = *pointer_an_int; - else if (const int64_t* pointer_an_int_64 = std::get_if(&encodable_an_int)) + else if (const int64_t* pointer_an_int_64 = + std::get_if(&encodable_an_int)) an_int_ = *pointer_an_int_64; auto& encodable_a_double = list[2]; - if (const double* pointer_a_double = std::get_if(&encodable_a_double)) { + if (const double* pointer_a_double = + std::get_if(&encodable_a_double)) { a_double_ = *pointer_a_double; } auto& encodable_a_byte_array = list[3]; - if (const std::vector* pointer_a_byte_array = std::get_if>(&encodable_a_byte_array)) { + if (const std::vector* pointer_a_byte_array = + std::get_if>(&encodable_a_byte_array)) { a_byte_array_ = *pointer_a_byte_array; } auto& encodable_a4_byte_array = list[4]; - if (const std::vector* pointer_a4_byte_array = std::get_if>(&encodable_a4_byte_array)) { + if (const std::vector* pointer_a4_byte_array = + std::get_if>(&encodable_a4_byte_array)) { a4_byte_array_ = *pointer_a4_byte_array; } auto& encodable_a8_byte_array = list[5]; - if (const std::vector* pointer_a8_byte_array = std::get_if>(&encodable_a8_byte_array)) { + if (const std::vector* pointer_a8_byte_array = + std::get_if>(&encodable_a8_byte_array)) { a8_byte_array_ = *pointer_a8_byte_array; } auto& encodable_a_float_array = list[6]; - if (const std::vector* pointer_a_float_array = std::get_if>(&encodable_a_float_array)) { + if (const std::vector* pointer_a_float_array = + std::get_if>(&encodable_a_float_array)) { a_float_array_ = *pointer_a_float_array; } auto& encodable_a_list = list[7]; - if (const flutter::EncodableList* pointer_a_list = std::get_if(&encodable_a_list)) { + if (const flutter::EncodableList* pointer_a_list = + std::get_if(&encodable_a_list)) { a_list_ = *pointer_a_list; } auto& encodable_a_map = list[8]; - if (const flutter::EncodableMap* pointer_a_map = std::get_if(&encodable_a_map)) { + if (const flutter::EncodableMap* pointer_a_map = + std::get_if(&encodable_a_map)) { a_map_ = *pointer_a_map; } auto& encodable_an_enum = list[9]; - if (const int32_t* pointer_an_enum = std::get_if(&encodable_an_enum)) an_enum_ = (AnEnum)*pointer_an_enum; + if (const int32_t* pointer_an_enum = std::get_if(&encodable_an_enum)) + an_enum_ = (AnEnum)*pointer_an_enum; auto& encodable_a_string = list[10]; - if (const std::string* pointer_a_string = std::get_if(&encodable_a_string)) { + if (const std::string* pointer_a_string = + std::get_if(&encodable_a_string)) { a_string_ = *pointer_a_string; } } - // AllNullableTypes -const bool* AllNullableTypes::a_nullable_bool() const { return a_nullable_bool_ ? &(*a_nullable_bool_) : nullptr; } -void AllNullableTypes::set_a_nullable_bool(const bool* value_arg) { a_nullable_bool_ = value_arg ? std::optional(*value_arg) : std::nullopt; } -void AllNullableTypes::set_a_nullable_bool(bool value_arg) { a_nullable_bool_ = value_arg; } +const bool* AllNullableTypes::a_nullable_bool() const { + return a_nullable_bool_ ? &(*a_nullable_bool_) : nullptr; +} +void AllNullableTypes::set_a_nullable_bool(const bool* value_arg) { + a_nullable_bool_ = value_arg ? std::optional(*value_arg) : std::nullopt; +} +void AllNullableTypes::set_a_nullable_bool(bool value_arg) { + a_nullable_bool_ = value_arg; +} -const int64_t* AllNullableTypes::a_nullable_int() const { return a_nullable_int_ ? &(*a_nullable_int_) : nullptr; } -void AllNullableTypes::set_a_nullable_int(const int64_t* value_arg) { a_nullable_int_ = value_arg ? std::optional(*value_arg) : std::nullopt; } -void AllNullableTypes::set_a_nullable_int(int64_t value_arg) { a_nullable_int_ = value_arg; } +const int64_t* AllNullableTypes::a_nullable_int() const { + return a_nullable_int_ ? &(*a_nullable_int_) : nullptr; +} +void AllNullableTypes::set_a_nullable_int(const int64_t* value_arg) { + a_nullable_int_ = + value_arg ? std::optional(*value_arg) : std::nullopt; +} +void AllNullableTypes::set_a_nullable_int(int64_t value_arg) { + a_nullable_int_ = value_arg; +} -const double* AllNullableTypes::a_nullable_double() const { return a_nullable_double_ ? &(*a_nullable_double_) : nullptr; } -void AllNullableTypes::set_a_nullable_double(const double* value_arg) { a_nullable_double_ = value_arg ? std::optional(*value_arg) : std::nullopt; } -void AllNullableTypes::set_a_nullable_double(double value_arg) { a_nullable_double_ = value_arg; } +const double* AllNullableTypes::a_nullable_double() const { + return a_nullable_double_ ? &(*a_nullable_double_) : nullptr; +} +void AllNullableTypes::set_a_nullable_double(const double* value_arg) { + a_nullable_double_ = + value_arg ? std::optional(*value_arg) : std::nullopt; +} +void AllNullableTypes::set_a_nullable_double(double value_arg) { + a_nullable_double_ = value_arg; +} -const std::vector* AllNullableTypes::a_nullable_byte_array() const { return a_nullable_byte_array_ ? &(*a_nullable_byte_array_) : nullptr; } -void AllNullableTypes::set_a_nullable_byte_array(const std::vector* value_arg) { a_nullable_byte_array_ = value_arg ? std::optional>(*value_arg) : std::nullopt; } -void AllNullableTypes::set_a_nullable_byte_array(const std::vector& value_arg) { a_nullable_byte_array_ = value_arg; } +const std::vector* AllNullableTypes::a_nullable_byte_array() const { + return a_nullable_byte_array_ ? &(*a_nullable_byte_array_) : nullptr; +} +void AllNullableTypes::set_a_nullable_byte_array( + const std::vector* value_arg) { + a_nullable_byte_array_ = value_arg + ? std::optional>(*value_arg) + : std::nullopt; +} +void AllNullableTypes::set_a_nullable_byte_array( + const std::vector& value_arg) { + a_nullable_byte_array_ = value_arg; +} -const std::vector* AllNullableTypes::a_nullable4_byte_array() const { return a_nullable4_byte_array_ ? &(*a_nullable4_byte_array_) : nullptr; } -void AllNullableTypes::set_a_nullable4_byte_array(const std::vector* value_arg) { a_nullable4_byte_array_ = value_arg ? std::optional>(*value_arg) : std::nullopt; } -void AllNullableTypes::set_a_nullable4_byte_array(const std::vector& value_arg) { a_nullable4_byte_array_ = value_arg; } +const std::vector* AllNullableTypes::a_nullable4_byte_array() const { + return a_nullable4_byte_array_ ? &(*a_nullable4_byte_array_) : nullptr; +} +void AllNullableTypes::set_a_nullable4_byte_array( + const std::vector* value_arg) { + a_nullable4_byte_array_ = + value_arg ? std::optional>(*value_arg) + : std::nullopt; +} +void AllNullableTypes::set_a_nullable4_byte_array( + const std::vector& value_arg) { + a_nullable4_byte_array_ = value_arg; +} -const std::vector* AllNullableTypes::a_nullable8_byte_array() const { return a_nullable8_byte_array_ ? &(*a_nullable8_byte_array_) : nullptr; } -void AllNullableTypes::set_a_nullable8_byte_array(const std::vector* value_arg) { a_nullable8_byte_array_ = value_arg ? std::optional>(*value_arg) : std::nullopt; } -void AllNullableTypes::set_a_nullable8_byte_array(const std::vector& value_arg) { a_nullable8_byte_array_ = value_arg; } +const std::vector* AllNullableTypes::a_nullable8_byte_array() const { + return a_nullable8_byte_array_ ? &(*a_nullable8_byte_array_) : nullptr; +} +void AllNullableTypes::set_a_nullable8_byte_array( + const std::vector* value_arg) { + a_nullable8_byte_array_ = + value_arg ? std::optional>(*value_arg) + : std::nullopt; +} +void AllNullableTypes::set_a_nullable8_byte_array( + const std::vector& value_arg) { + a_nullable8_byte_array_ = value_arg; +} -const std::vector* AllNullableTypes::a_nullable_float_array() const { return a_nullable_float_array_ ? &(*a_nullable_float_array_) : nullptr; } -void AllNullableTypes::set_a_nullable_float_array(const std::vector* value_arg) { a_nullable_float_array_ = value_arg ? std::optional>(*value_arg) : std::nullopt; } -void AllNullableTypes::set_a_nullable_float_array(const std::vector& value_arg) { a_nullable_float_array_ = value_arg; } +const std::vector* AllNullableTypes::a_nullable_float_array() const { + return a_nullable_float_array_ ? &(*a_nullable_float_array_) : nullptr; +} +void AllNullableTypes::set_a_nullable_float_array( + const std::vector* value_arg) { + a_nullable_float_array_ = + value_arg ? std::optional>(*value_arg) : std::nullopt; +} +void AllNullableTypes::set_a_nullable_float_array( + const std::vector& value_arg) { + a_nullable_float_array_ = value_arg; +} -const flutter::EncodableList* AllNullableTypes::a_nullable_list() const { return a_nullable_list_ ? &(*a_nullable_list_) : nullptr; } -void AllNullableTypes::set_a_nullable_list(const flutter::EncodableList* value_arg) { a_nullable_list_ = value_arg ? std::optional(*value_arg) : std::nullopt; } -void AllNullableTypes::set_a_nullable_list(const flutter::EncodableList& value_arg) { a_nullable_list_ = value_arg; } +const flutter::EncodableList* AllNullableTypes::a_nullable_list() const { + return a_nullable_list_ ? &(*a_nullable_list_) : nullptr; +} +void AllNullableTypes::set_a_nullable_list( + const flutter::EncodableList* value_arg) { + a_nullable_list_ = value_arg + ? std::optional(*value_arg) + : std::nullopt; +} +void AllNullableTypes::set_a_nullable_list( + const flutter::EncodableList& value_arg) { + a_nullable_list_ = value_arg; +} -const flutter::EncodableMap* AllNullableTypes::a_nullable_map() const { return a_nullable_map_ ? &(*a_nullable_map_) : nullptr; } -void AllNullableTypes::set_a_nullable_map(const flutter::EncodableMap* value_arg) { a_nullable_map_ = value_arg ? std::optional(*value_arg) : std::nullopt; } -void AllNullableTypes::set_a_nullable_map(const flutter::EncodableMap& value_arg) { a_nullable_map_ = value_arg; } +const flutter::EncodableMap* AllNullableTypes::a_nullable_map() const { + return a_nullable_map_ ? &(*a_nullable_map_) : nullptr; +} +void AllNullableTypes::set_a_nullable_map( + const flutter::EncodableMap* value_arg) { + a_nullable_map_ = value_arg ? std::optional(*value_arg) + : std::nullopt; +} +void AllNullableTypes::set_a_nullable_map( + const flutter::EncodableMap& value_arg) { + a_nullable_map_ = value_arg; +} -const flutter::EncodableList* AllNullableTypes::nullable_nested_list() const { return nullable_nested_list_ ? &(*nullable_nested_list_) : nullptr; } -void AllNullableTypes::set_nullable_nested_list(const flutter::EncodableList* value_arg) { nullable_nested_list_ = value_arg ? std::optional(*value_arg) : std::nullopt; } -void AllNullableTypes::set_nullable_nested_list(const flutter::EncodableList& value_arg) { nullable_nested_list_ = value_arg; } +const flutter::EncodableList* AllNullableTypes::nullable_nested_list() const { + return nullable_nested_list_ ? &(*nullable_nested_list_) : nullptr; +} +void AllNullableTypes::set_nullable_nested_list( + const flutter::EncodableList* value_arg) { + nullable_nested_list_ = + value_arg ? std::optional(*value_arg) + : std::nullopt; +} +void AllNullableTypes::set_nullable_nested_list( + const flutter::EncodableList& value_arg) { + nullable_nested_list_ = value_arg; +} -const flutter::EncodableMap* AllNullableTypes::nullable_map_with_annotations() const { return nullable_map_with_annotations_ ? &(*nullable_map_with_annotations_) : nullptr; } -void AllNullableTypes::set_nullable_map_with_annotations(const flutter::EncodableMap* value_arg) { nullable_map_with_annotations_ = value_arg ? std::optional(*value_arg) : std::nullopt; } -void AllNullableTypes::set_nullable_map_with_annotations(const flutter::EncodableMap& value_arg) { nullable_map_with_annotations_ = value_arg; } +const flutter::EncodableMap* AllNullableTypes::nullable_map_with_annotations() + const { + return nullable_map_with_annotations_ ? &(*nullable_map_with_annotations_) + : nullptr; +} +void AllNullableTypes::set_nullable_map_with_annotations( + const flutter::EncodableMap* value_arg) { + nullable_map_with_annotations_ = + value_arg ? std::optional(*value_arg) + : std::nullopt; +} +void AllNullableTypes::set_nullable_map_with_annotations( + const flutter::EncodableMap& value_arg) { + nullable_map_with_annotations_ = value_arg; +} -const flutter::EncodableMap* AllNullableTypes::nullable_map_with_object() const { return nullable_map_with_object_ ? &(*nullable_map_with_object_) : nullptr; } -void AllNullableTypes::set_nullable_map_with_object(const flutter::EncodableMap* value_arg) { nullable_map_with_object_ = value_arg ? std::optional(*value_arg) : std::nullopt; } -void AllNullableTypes::set_nullable_map_with_object(const flutter::EncodableMap& value_arg) { nullable_map_with_object_ = value_arg; } +const flutter::EncodableMap* AllNullableTypes::nullable_map_with_object() + const { + return nullable_map_with_object_ ? &(*nullable_map_with_object_) : nullptr; +} +void AllNullableTypes::set_nullable_map_with_object( + const flutter::EncodableMap* value_arg) { + nullable_map_with_object_ = + value_arg ? std::optional(*value_arg) + : std::nullopt; +} +void AllNullableTypes::set_nullable_map_with_object( + const flutter::EncodableMap& value_arg) { + nullable_map_with_object_ = value_arg; +} -const AnEnum* AllNullableTypes::a_nullable_enum() const { return a_nullable_enum_ ? &(*a_nullable_enum_) : nullptr; } -void AllNullableTypes::set_a_nullable_enum(const AnEnum* value_arg) { a_nullable_enum_ = value_arg ? std::optional(*value_arg) : std::nullopt; } -void AllNullableTypes::set_a_nullable_enum(const AnEnum& value_arg) { a_nullable_enum_ = value_arg; } +const AnEnum* AllNullableTypes::a_nullable_enum() const { + return a_nullable_enum_ ? &(*a_nullable_enum_) : nullptr; +} +void AllNullableTypes::set_a_nullable_enum(const AnEnum* value_arg) { + a_nullable_enum_ = + value_arg ? std::optional(*value_arg) : std::nullopt; +} +void AllNullableTypes::set_a_nullable_enum(const AnEnum& value_arg) { + a_nullable_enum_ = value_arg; +} -const std::string* AllNullableTypes::a_nullable_string() const { return a_nullable_string_ ? &(*a_nullable_string_) : nullptr; } -void AllNullableTypes::set_a_nullable_string(const std::string_view* value_arg) { a_nullable_string_ = value_arg ? std::optional(*value_arg) : std::nullopt; } -void AllNullableTypes::set_a_nullable_string(std::string_view value_arg) { a_nullable_string_ = value_arg; } +const std::string* AllNullableTypes::a_nullable_string() const { + return a_nullable_string_ ? &(*a_nullable_string_) : nullptr; +} +void AllNullableTypes::set_a_nullable_string( + const std::string_view* value_arg) { + a_nullable_string_ = + value_arg ? std::optional(*value_arg) : std::nullopt; +} +void AllNullableTypes::set_a_nullable_string(std::string_view value_arg) { + a_nullable_string_ = value_arg; +} flutter::EncodableList AllNullableTypes::ToEncodableList() const { -return flutter::EncodableList{ - a_nullable_bool_ ? flutter::EncodableValue(*a_nullable_bool_) : flutter::EncodableValue(), - a_nullable_int_ ? flutter::EncodableValue(*a_nullable_int_) : flutter::EncodableValue(), - a_nullable_double_ ? flutter::EncodableValue(*a_nullable_double_) : flutter::EncodableValue(), - a_nullable_byte_array_ ? flutter::EncodableValue(*a_nullable_byte_array_) : flutter::EncodableValue(), - a_nullable4_byte_array_ ? flutter::EncodableValue(*a_nullable4_byte_array_) : flutter::EncodableValue(), - a_nullable8_byte_array_ ? flutter::EncodableValue(*a_nullable8_byte_array_) : flutter::EncodableValue(), - a_nullable_float_array_ ? flutter::EncodableValue(*a_nullable_float_array_) : flutter::EncodableValue(), - a_nullable_list_ ? flutter::EncodableValue(*a_nullable_list_) : flutter::EncodableValue(), - a_nullable_map_ ? flutter::EncodableValue(*a_nullable_map_) : flutter::EncodableValue(), - nullable_nested_list_ ? flutter::EncodableValue(*nullable_nested_list_) : flutter::EncodableValue(), - nullable_map_with_annotations_ ? flutter::EncodableValue(*nullable_map_with_annotations_) : flutter::EncodableValue(), - nullable_map_with_object_ ? flutter::EncodableValue(*nullable_map_with_object_) : flutter::EncodableValue(), - a_nullable_enum_ ? flutter::EncodableValue((int)(*a_nullable_enum_)) : flutter::EncodableValue(), - a_nullable_string_ ? flutter::EncodableValue(*a_nullable_string_) : flutter::EncodableValue(), + return flutter::EncodableList{ + a_nullable_bool_ ? flutter::EncodableValue(*a_nullable_bool_) + : flutter::EncodableValue(), + a_nullable_int_ ? flutter::EncodableValue(*a_nullable_int_) + : flutter::EncodableValue(), + a_nullable_double_ ? flutter::EncodableValue(*a_nullable_double_) + : flutter::EncodableValue(), + a_nullable_byte_array_ ? flutter::EncodableValue(*a_nullable_byte_array_) + : flutter::EncodableValue(), + a_nullable4_byte_array_ + ? flutter::EncodableValue(*a_nullable4_byte_array_) + : flutter::EncodableValue(), + a_nullable8_byte_array_ + ? flutter::EncodableValue(*a_nullable8_byte_array_) + : flutter::EncodableValue(), + a_nullable_float_array_ + ? flutter::EncodableValue(*a_nullable_float_array_) + : flutter::EncodableValue(), + a_nullable_list_ ? flutter::EncodableValue(*a_nullable_list_) + : flutter::EncodableValue(), + a_nullable_map_ ? flutter::EncodableValue(*a_nullable_map_) + : flutter::EncodableValue(), + nullable_nested_list_ ? flutter::EncodableValue(*nullable_nested_list_) + : flutter::EncodableValue(), + nullable_map_with_annotations_ + ? flutter::EncodableValue(*nullable_map_with_annotations_) + : flutter::EncodableValue(), + nullable_map_with_object_ + ? flutter::EncodableValue(*nullable_map_with_object_) + : flutter::EncodableValue(), + a_nullable_enum_ ? flutter::EncodableValue((int)(*a_nullable_enum_)) + : flutter::EncodableValue(), + a_nullable_string_ ? flutter::EncodableValue(*a_nullable_string_) + : flutter::EncodableValue(), }; } @@ -201,115 +377,157 @@ AllNullableTypes::AllNullableTypes() {} AllNullableTypes::AllNullableTypes(const flutter::EncodableList& list) { auto& encodable_a_nullable_bool = list[0]; - if (const bool* pointer_a_nullable_bool = std::get_if(&encodable_a_nullable_bool)) { + if (const bool* pointer_a_nullable_bool = + std::get_if(&encodable_a_nullable_bool)) { a_nullable_bool_ = *pointer_a_nullable_bool; } auto& encodable_a_nullable_int = list[1]; - if (const int32_t* pointer_a_nullable_int = std::get_if(&encodable_a_nullable_int)) + if (const int32_t* pointer_a_nullable_int = + std::get_if(&encodable_a_nullable_int)) a_nullable_int_ = *pointer_a_nullable_int; - else if (const int64_t* pointer_a_nullable_int_64 = std::get_if(&encodable_a_nullable_int)) + else if (const int64_t* pointer_a_nullable_int_64 = + std::get_if(&encodable_a_nullable_int)) a_nullable_int_ = *pointer_a_nullable_int_64; auto& encodable_a_nullable_double = list[2]; - if (const double* pointer_a_nullable_double = std::get_if(&encodable_a_nullable_double)) { + if (const double* pointer_a_nullable_double = + std::get_if(&encodable_a_nullable_double)) { a_nullable_double_ = *pointer_a_nullable_double; } auto& encodable_a_nullable_byte_array = list[3]; - if (const std::vector* pointer_a_nullable_byte_array = std::get_if>(&encodable_a_nullable_byte_array)) { + if (const std::vector* pointer_a_nullable_byte_array = + std::get_if>(&encodable_a_nullable_byte_array)) { a_nullable_byte_array_ = *pointer_a_nullable_byte_array; } auto& encodable_a_nullable4_byte_array = list[4]; - if (const std::vector* pointer_a_nullable4_byte_array = std::get_if>(&encodable_a_nullable4_byte_array)) { + if (const std::vector* pointer_a_nullable4_byte_array = + std::get_if>( + &encodable_a_nullable4_byte_array)) { a_nullable4_byte_array_ = *pointer_a_nullable4_byte_array; } auto& encodable_a_nullable8_byte_array = list[5]; - if (const std::vector* pointer_a_nullable8_byte_array = std::get_if>(&encodable_a_nullable8_byte_array)) { + if (const std::vector* pointer_a_nullable8_byte_array = + std::get_if>( + &encodable_a_nullable8_byte_array)) { a_nullable8_byte_array_ = *pointer_a_nullable8_byte_array; } auto& encodable_a_nullable_float_array = list[6]; - if (const std::vector* pointer_a_nullable_float_array = std::get_if>(&encodable_a_nullable_float_array)) { + if (const std::vector* pointer_a_nullable_float_array = + std::get_if>(&encodable_a_nullable_float_array)) { a_nullable_float_array_ = *pointer_a_nullable_float_array; } auto& encodable_a_nullable_list = list[7]; - if (const flutter::EncodableList* pointer_a_nullable_list = std::get_if(&encodable_a_nullable_list)) { + if (const flutter::EncodableList* pointer_a_nullable_list = + std::get_if(&encodable_a_nullable_list)) { a_nullable_list_ = *pointer_a_nullable_list; } auto& encodable_a_nullable_map = list[8]; - if (const flutter::EncodableMap* pointer_a_nullable_map = std::get_if(&encodable_a_nullable_map)) { + if (const flutter::EncodableMap* pointer_a_nullable_map = + std::get_if(&encodable_a_nullable_map)) { a_nullable_map_ = *pointer_a_nullable_map; } auto& encodable_nullable_nested_list = list[9]; - if (const flutter::EncodableList* pointer_nullable_nested_list = std::get_if(&encodable_nullable_nested_list)) { + if (const flutter::EncodableList* pointer_nullable_nested_list = + std::get_if( + &encodable_nullable_nested_list)) { nullable_nested_list_ = *pointer_nullable_nested_list; } auto& encodable_nullable_map_with_annotations = list[10]; - if (const flutter::EncodableMap* pointer_nullable_map_with_annotations = std::get_if(&encodable_nullable_map_with_annotations)) { + if (const flutter::EncodableMap* pointer_nullable_map_with_annotations = + std::get_if( + &encodable_nullable_map_with_annotations)) { nullable_map_with_annotations_ = *pointer_nullable_map_with_annotations; } auto& encodable_nullable_map_with_object = list[11]; - if (const flutter::EncodableMap* pointer_nullable_map_with_object = std::get_if(&encodable_nullable_map_with_object)) { + if (const flutter::EncodableMap* pointer_nullable_map_with_object = + std::get_if( + &encodable_nullable_map_with_object)) { nullable_map_with_object_ = *pointer_nullable_map_with_object; } auto& encodable_a_nullable_enum = list[12]; - if (const int32_t* pointer_a_nullable_enum = std::get_if(&encodable_a_nullable_enum)) a_nullable_enum_ = (AnEnum)*pointer_a_nullable_enum; + if (const int32_t* pointer_a_nullable_enum = + std::get_if(&encodable_a_nullable_enum)) + a_nullable_enum_ = (AnEnum)*pointer_a_nullable_enum; auto& encodable_a_nullable_string = list[13]; - if (const std::string* pointer_a_nullable_string = std::get_if(&encodable_a_nullable_string)) { + if (const std::string* pointer_a_nullable_string = + std::get_if(&encodable_a_nullable_string)) { a_nullable_string_ = *pointer_a_nullable_string; } } - // AllNullableTypesWrapper -const AllNullableTypes& AllNullableTypesWrapper::values() const { return values_; } -void AllNullableTypesWrapper::set_values(const AllNullableTypes& value_arg) { values_ = value_arg; } +const AllNullableTypes& AllNullableTypesWrapper::values() const { + return values_; +} +void AllNullableTypesWrapper::set_values(const AllNullableTypes& value_arg) { + values_ = value_arg; +} flutter::EncodableList AllNullableTypesWrapper::ToEncodableList() const { -return flutter::EncodableList{ - flutter::EncodableValue(values_.ToEncodableList()), + return flutter::EncodableList{ + flutter::EncodableValue(values_.ToEncodableList()), }; } AllNullableTypesWrapper::AllNullableTypesWrapper() {} -AllNullableTypesWrapper::AllNullableTypesWrapper(const flutter::EncodableList& list) { +AllNullableTypesWrapper::AllNullableTypesWrapper( + const flutter::EncodableList& list) { auto& encodable_values = list[0]; - if (const flutter::EncodableList* pointer_values = std::get_if(&encodable_values)) { + if (const flutter::EncodableList* pointer_values = + std::get_if(&encodable_values)) { values_ = AllNullableTypes(*pointer_values); } } -HostIntegrationCoreApiCodecSerializer::HostIntegrationCoreApiCodecSerializer() {} -flutter::EncodableValue HostIntegrationCoreApiCodecSerializer::ReadValueOfType(uint8_t type, flutter::ByteStreamReader* stream) const { +HostIntegrationCoreApiCodecSerializer::HostIntegrationCoreApiCodecSerializer() { +} +flutter::EncodableValue HostIntegrationCoreApiCodecSerializer::ReadValueOfType( + uint8_t type, flutter::ByteStreamReader* stream) const { switch (type) { - case 128: - return flutter::CustomEncodableValue(AllNullableTypes(std::get(ReadValue(stream)))); - - case 129: - return flutter::CustomEncodableValue(AllNullableTypesWrapper(std::get(ReadValue(stream)))); - - case 130: - return flutter::CustomEncodableValue(AllTypes(std::get(ReadValue(stream)))); - - default: + case 128: + return flutter::CustomEncodableValue(AllNullableTypes( + std::get(ReadValue(stream)))); + + case 129: + return flutter::CustomEncodableValue(AllNullableTypesWrapper( + std::get(ReadValue(stream)))); + + case 130: + return flutter::CustomEncodableValue( + AllTypes(std::get(ReadValue(stream)))); + + default: return flutter::StandardCodecSerializer::ReadValueOfType(type, stream); - } + } } -void HostIntegrationCoreApiCodecSerializer::WriteValue(const flutter::EncodableValue& value, flutter::ByteStreamWriter* stream) const { - if (const flutter::CustomEncodableValue* custom_value = std::get_if(&value)) { +void HostIntegrationCoreApiCodecSerializer::WriteValue( + const flutter::EncodableValue& value, + flutter::ByteStreamWriter* stream) const { + if (const flutter::CustomEncodableValue* custom_value = + std::get_if(&value)) { if (custom_value->type() == typeid(AllNullableTypes)) { stream->WriteByte(128); - WriteValue(flutter::EncodableValue(std::any_cast(*custom_value).ToEncodableList()), stream); + WriteValue( + flutter::EncodableValue( + std::any_cast(*custom_value).ToEncodableList()), + stream); return; } if (custom_value->type() == typeid(AllNullableTypesWrapper)) { stream->WriteByte(129); - WriteValue(flutter::EncodableValue(std::any_cast(*custom_value).ToEncodableList()), stream); + WriteValue(flutter::EncodableValue( + std::any_cast(*custom_value) + .ToEncodableList()), + stream); return; } if (custom_value->type() == typeid(AllTypes)) { stream->WriteByte(130); - WriteValue(flutter::EncodableValue(std::any_cast(*custom_value).ToEncodableList()), stream); + WriteValue(flutter::EncodableValue( + std::any_cast(*custom_value).ToEncodableList()), + stream); return; } } @@ -318,986 +536,1366 @@ void HostIntegrationCoreApiCodecSerializer::WriteValue(const flutter::EncodableV /// The codec used by HostIntegrationCoreApi. const flutter::StandardMessageCodec& HostIntegrationCoreApi::GetCodec() { - return flutter::StandardMessageCodec::GetInstance(&HostIntegrationCoreApiCodecSerializer::GetInstance()); + return flutter::StandardMessageCodec::GetInstance( + &HostIntegrationCoreApiCodecSerializer::GetInstance()); } -// Sets up an instance of `HostIntegrationCoreApi` to handle messages through the `binary_messenger`. -void HostIntegrationCoreApi::SetUp(flutter::BinaryMessenger* binary_messenger, HostIntegrationCoreApi* api) { +// Sets up an instance of `HostIntegrationCoreApi` to handle messages through +// the `binary_messenger`. +void HostIntegrationCoreApi::SetUp(flutter::BinaryMessenger* binary_messenger, + HostIntegrationCoreApi* api) { { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.noop", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.noop", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - std::optional output = api->Noop(); - if (output.has_value()) { - reply(WrapError(output.value())); - return; - } - flutter::EncodableList wrapped; - wrapped.push_back(flutter::EncodableValue()); - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + std::optional output = api->Noop(); + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + flutter::EncodableList wrapped; + wrapped.push_back(flutter::EncodableValue()); + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAllTypes", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoAllTypes", &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_everything_arg = args.at(0); - if (encodable_everything_arg.IsNull()) { - reply(WrapError("everything_arg unexpectedly null.")); - return; - } - const auto& everything_arg = std::any_cast(std::get(encodable_everything_arg)); - ErrorOr output = api->EchoAllTypes(everything_arg); - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - flutter::EncodableList wrapped; - wrapped.push_back(flutter::CustomEncodableValue(std::move(output).TakeValue())); - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_everything_arg = args.at(0); + if (encodable_everything_arg.IsNull()) { + reply(WrapError("everything_arg unexpectedly null.")); + return; + } + const auto& everything_arg = std::any_cast( + std::get( + encodable_everything_arg)); + ErrorOr output = api->EchoAllTypes(everything_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + wrapped.push_back( + flutter::CustomEncodableValue(std::move(output).TakeValue())); + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAllNullableTypes", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoAllNullableTypes", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_everything_arg = args.at(0); - const auto* everything_arg = &(std::any_cast(std::get(encodable_everything_arg))); - ErrorOr> output = api->EchoAllNullableTypes(everything_arg); - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - flutter::EncodableList wrapped; - auto output_optional = std::move(output).TakeValue(); - if (output_optional) { - wrapped.push_back(flutter::CustomEncodableValue(std::move(output_optional).value())); - } else { - wrapped.push_back(flutter::EncodableValue()); - } - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_everything_arg = args.at(0); + const auto* everything_arg = + &(std::any_cast( + std::get( + encodable_everything_arg))); + ErrorOr> output = + api->EchoAllNullableTypes(everything_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + auto output_optional = std::move(output).TakeValue(); + if (output_optional) { + wrapped.push_back(flutter::CustomEncodableValue( + std::move(output_optional).value())); + } else { + wrapped.push_back(flutter::EncodableValue()); + } + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.throwError", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.throwError", &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - std::optional output = api->ThrowError(); - if (output.has_value()) { - reply(WrapError(output.value())); - return; - } - flutter::EncodableList wrapped; - wrapped.push_back(flutter::EncodableValue()); - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + std::optional output = api->ThrowError(); + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + flutter::EncodableList wrapped; + wrapped.push_back(flutter::EncodableValue()); + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoInt", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoInt", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_an_int_arg = args.at(0); - if (encodable_an_int_arg.IsNull()) { - reply(WrapError("an_int_arg unexpectedly null.")); - return; - } - const int64_t an_int_arg = encodable_an_int_arg.LongValue(); - ErrorOr output = api->EchoInt(an_int_arg); - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - flutter::EncodableList wrapped; - wrapped.push_back(flutter::EncodableValue(std::move(output).TakeValue())); - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_an_int_arg = args.at(0); + if (encodable_an_int_arg.IsNull()) { + reply(WrapError("an_int_arg unexpectedly null.")); + return; + } + const int64_t an_int_arg = encodable_an_int_arg.LongValue(); + ErrorOr output = api->EchoInt(an_int_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + wrapped.push_back( + flutter::EncodableValue(std::move(output).TakeValue())); + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoDouble", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoDouble", &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_a_double_arg = args.at(0); - if (encodable_a_double_arg.IsNull()) { - reply(WrapError("a_double_arg unexpectedly null.")); - return; - } - const auto& a_double_arg = std::get(encodable_a_double_arg); - ErrorOr output = api->EchoDouble(a_double_arg); - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - flutter::EncodableList wrapped; - wrapped.push_back(flutter::EncodableValue(std::move(output).TakeValue())); - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_a_double_arg = args.at(0); + if (encodable_a_double_arg.IsNull()) { + reply(WrapError("a_double_arg unexpectedly null.")); + return; + } + const auto& a_double_arg = + std::get(encodable_a_double_arg); + ErrorOr output = api->EchoDouble(a_double_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + wrapped.push_back( + flutter::EncodableValue(std::move(output).TakeValue())); + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoBool", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoBool", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_a_bool_arg = args.at(0); - if (encodable_a_bool_arg.IsNull()) { - reply(WrapError("a_bool_arg unexpectedly null.")); - return; - } - const auto& a_bool_arg = std::get(encodable_a_bool_arg); - ErrorOr output = api->EchoBool(a_bool_arg); - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - flutter::EncodableList wrapped; - wrapped.push_back(flutter::EncodableValue(std::move(output).TakeValue())); - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_a_bool_arg = args.at(0); + if (encodable_a_bool_arg.IsNull()) { + reply(WrapError("a_bool_arg unexpectedly null.")); + return; + } + const auto& a_bool_arg = std::get(encodable_a_bool_arg); + ErrorOr output = api->EchoBool(a_bool_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + wrapped.push_back( + flutter::EncodableValue(std::move(output).TakeValue())); + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoString", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoString", &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_a_string_arg = args.at(0); - if (encodable_a_string_arg.IsNull()) { - reply(WrapError("a_string_arg unexpectedly null.")); - return; - } - const auto& a_string_arg = std::get(encodable_a_string_arg); - ErrorOr output = api->EchoString(a_string_arg); - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - flutter::EncodableList wrapped; - wrapped.push_back(flutter::EncodableValue(std::move(output).TakeValue())); - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_a_string_arg = args.at(0); + if (encodable_a_string_arg.IsNull()) { + reply(WrapError("a_string_arg unexpectedly null.")); + return; + } + const auto& a_string_arg = + std::get(encodable_a_string_arg); + ErrorOr output = api->EchoString(a_string_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + wrapped.push_back( + flutter::EncodableValue(std::move(output).TakeValue())); + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoUint8List", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoUint8List", &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_a_uint8_list_arg = args.at(0); - if (encodable_a_uint8_list_arg.IsNull()) { - reply(WrapError("a_uint8_list_arg unexpectedly null.")); - return; - } - const auto& a_uint8_list_arg = std::get>(encodable_a_uint8_list_arg); - ErrorOr> output = api->EchoUint8List(a_uint8_list_arg); - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - flutter::EncodableList wrapped; - wrapped.push_back(flutter::EncodableValue(std::move(output).TakeValue())); - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_a_uint8_list_arg = args.at(0); + if (encodable_a_uint8_list_arg.IsNull()) { + reply(WrapError("a_uint8_list_arg unexpectedly null.")); + return; + } + const auto& a_uint8_list_arg = + std::get>(encodable_a_uint8_list_arg); + ErrorOr> output = + api->EchoUint8List(a_uint8_list_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + wrapped.push_back( + flutter::EncodableValue(std::move(output).TakeValue())); + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoObject", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoObject", &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_an_object_arg = args.at(0); - if (encodable_an_object_arg.IsNull()) { - reply(WrapError("an_object_arg unexpectedly null.")); - return; - } - const auto& an_object_arg = encodable_an_object_arg; - ErrorOr output = api->EchoObject(an_object_arg); - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - flutter::EncodableList wrapped; - wrapped.push_back(flutter::EncodableValue(std::move(output).TakeValue())); - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_an_object_arg = args.at(0); + if (encodable_an_object_arg.IsNull()) { + reply(WrapError("an_object_arg unexpectedly null.")); + return; + } + const auto& an_object_arg = encodable_an_object_arg; + ErrorOr output = + api->EchoObject(an_object_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + wrapped.push_back( + flutter::EncodableValue(std::move(output).TakeValue())); + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.extractNestedNullableString", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.extractNestedNullableString", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_wrapper_arg = args.at(0); - if (encodable_wrapper_arg.IsNull()) { - reply(WrapError("wrapper_arg unexpectedly null.")); - return; - } - const auto& wrapper_arg = std::any_cast(std::get(encodable_wrapper_arg)); - ErrorOr> output = api->ExtractNestedNullableString(wrapper_arg); - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - flutter::EncodableList wrapped; - auto output_optional = std::move(output).TakeValue(); - if (output_optional) { - wrapped.push_back(flutter::EncodableValue(std::move(output_optional).value())); - } else { - wrapped.push_back(flutter::EncodableValue()); - } - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_wrapper_arg = args.at(0); + if (encodable_wrapper_arg.IsNull()) { + reply(WrapError("wrapper_arg unexpectedly null.")); + return; + } + const auto& wrapper_arg = + std::any_cast( + std::get( + encodable_wrapper_arg)); + ErrorOr> output = + api->ExtractNestedNullableString(wrapper_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + auto output_optional = std::move(output).TakeValue(); + if (output_optional) { + wrapped.push_back(flutter::EncodableValue( + std::move(output_optional).value())); + } else { + wrapped.push_back(flutter::EncodableValue()); + } + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.createNestedNullableString", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.createNestedNullableString", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_nullable_string_arg = args.at(0); - const auto* nullable_string_arg = std::get_if(&encodable_nullable_string_arg); - ErrorOr output = api->CreateNestedNullableString(nullable_string_arg); - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - flutter::EncodableList wrapped; - wrapped.push_back(flutter::CustomEncodableValue(std::move(output).TakeValue())); - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_nullable_string_arg = args.at(0); + const auto* nullable_string_arg = + std::get_if(&encodable_nullable_string_arg); + ErrorOr output = + api->CreateNestedNullableString(nullable_string_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + wrapped.push_back( + flutter::CustomEncodableValue(std::move(output).TakeValue())); + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.sendMultipleNullableTypes", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.sendMultipleNullableTypes", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_a_nullable_bool_arg = args.at(0); - const auto* a_nullable_bool_arg = std::get_if(&encodable_a_nullable_bool_arg); - const auto& encodable_a_nullable_int_arg = args.at(1); - const int64_t a_nullable_int_arg_value = encodable_a_nullable_int_arg.IsNull() ? 0 : encodable_a_nullable_int_arg.LongValue(); - const auto* a_nullable_int_arg = encodable_a_nullable_int_arg.IsNull() ? nullptr : &a_nullable_int_arg_value; - const auto& encodable_a_nullable_string_arg = args.at(2); - const auto* a_nullable_string_arg = std::get_if(&encodable_a_nullable_string_arg); - ErrorOr output = api->SendMultipleNullableTypes(a_nullable_bool_arg, a_nullable_int_arg, a_nullable_string_arg); - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - flutter::EncodableList wrapped; - wrapped.push_back(flutter::CustomEncodableValue(std::move(output).TakeValue())); - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_a_nullable_bool_arg = args.at(0); + const auto* a_nullable_bool_arg = + std::get_if(&encodable_a_nullable_bool_arg); + const auto& encodable_a_nullable_int_arg = args.at(1); + const int64_t a_nullable_int_arg_value = + encodable_a_nullable_int_arg.IsNull() + ? 0 + : encodable_a_nullable_int_arg.LongValue(); + const auto* a_nullable_int_arg = + encodable_a_nullable_int_arg.IsNull() + ? nullptr + : &a_nullable_int_arg_value; + const auto& encodable_a_nullable_string_arg = args.at(2); + const auto* a_nullable_string_arg = + std::get_if(&encodable_a_nullable_string_arg); + ErrorOr output = api->SendMultipleNullableTypes( + a_nullable_bool_arg, a_nullable_int_arg, + a_nullable_string_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + wrapped.push_back( + flutter::CustomEncodableValue(std::move(output).TakeValue())); + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableInt", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableInt", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_a_nullable_int_arg = args.at(0); - const int64_t a_nullable_int_arg_value = encodable_a_nullable_int_arg.IsNull() ? 0 : encodable_a_nullable_int_arg.LongValue(); - const auto* a_nullable_int_arg = encodable_a_nullable_int_arg.IsNull() ? nullptr : &a_nullable_int_arg_value; - ErrorOr> output = api->EchoNullableInt(a_nullable_int_arg); - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - flutter::EncodableList wrapped; - auto output_optional = std::move(output).TakeValue(); - if (output_optional) { - wrapped.push_back(flutter::EncodableValue(std::move(output_optional).value())); - } else { - wrapped.push_back(flutter::EncodableValue()); - } - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_a_nullable_int_arg = args.at(0); + const int64_t a_nullable_int_arg_value = + encodable_a_nullable_int_arg.IsNull() + ? 0 + : encodable_a_nullable_int_arg.LongValue(); + const auto* a_nullable_int_arg = + encodable_a_nullable_int_arg.IsNull() + ? nullptr + : &a_nullable_int_arg_value; + ErrorOr> output = + api->EchoNullableInt(a_nullable_int_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + auto output_optional = std::move(output).TakeValue(); + if (output_optional) { + wrapped.push_back(flutter::EncodableValue( + std::move(output_optional).value())); + } else { + wrapped.push_back(flutter::EncodableValue()); + } + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableDouble", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableDouble", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_a_nullable_double_arg = args.at(0); - const auto* a_nullable_double_arg = std::get_if(&encodable_a_nullable_double_arg); - ErrorOr> output = api->EchoNullableDouble(a_nullable_double_arg); - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - flutter::EncodableList wrapped; - auto output_optional = std::move(output).TakeValue(); - if (output_optional) { - wrapped.push_back(flutter::EncodableValue(std::move(output_optional).value())); - } else { - wrapped.push_back(flutter::EncodableValue()); - } - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_a_nullable_double_arg = args.at(0); + const auto* a_nullable_double_arg = + std::get_if(&encodable_a_nullable_double_arg); + ErrorOr> output = + api->EchoNullableDouble(a_nullable_double_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + auto output_optional = std::move(output).TakeValue(); + if (output_optional) { + wrapped.push_back(flutter::EncodableValue( + std::move(output_optional).value())); + } else { + wrapped.push_back(flutter::EncodableValue()); + } + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableBool", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableBool", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_a_nullable_bool_arg = args.at(0); - const auto* a_nullable_bool_arg = std::get_if(&encodable_a_nullable_bool_arg); - ErrorOr> output = api->EchoNullableBool(a_nullable_bool_arg); - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - flutter::EncodableList wrapped; - auto output_optional = std::move(output).TakeValue(); - if (output_optional) { - wrapped.push_back(flutter::EncodableValue(std::move(output_optional).value())); - } else { - wrapped.push_back(flutter::EncodableValue()); - } - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_a_nullable_bool_arg = args.at(0); + const auto* a_nullable_bool_arg = + std::get_if(&encodable_a_nullable_bool_arg); + ErrorOr> output = + api->EchoNullableBool(a_nullable_bool_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + auto output_optional = std::move(output).TakeValue(); + if (output_optional) { + wrapped.push_back(flutter::EncodableValue( + std::move(output_optional).value())); + } else { + wrapped.push_back(flutter::EncodableValue()); + } + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableString", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableString", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_a_nullable_string_arg = args.at(0); - const auto* a_nullable_string_arg = std::get_if(&encodable_a_nullable_string_arg); - ErrorOr> output = api->EchoNullableString(a_nullable_string_arg); - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - flutter::EncodableList wrapped; - auto output_optional = std::move(output).TakeValue(); - if (output_optional) { - wrapped.push_back(flutter::EncodableValue(std::move(output_optional).value())); - } else { - wrapped.push_back(flutter::EncodableValue()); - } - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_a_nullable_string_arg = args.at(0); + const auto* a_nullable_string_arg = + std::get_if(&encodable_a_nullable_string_arg); + ErrorOr> output = + api->EchoNullableString(a_nullable_string_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + auto output_optional = std::move(output).TakeValue(); + if (output_optional) { + wrapped.push_back(flutter::EncodableValue( + std::move(output_optional).value())); + } else { + wrapped.push_back(flutter::EncodableValue()); + } + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableUint8List", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableUint8List", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_a_nullable_uint8_list_arg = args.at(0); - const auto* a_nullable_uint8_list_arg = std::get_if>(&encodable_a_nullable_uint8_list_arg); - ErrorOr>> output = api->EchoNullableUint8List(a_nullable_uint8_list_arg); - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - flutter::EncodableList wrapped; - auto output_optional = std::move(output).TakeValue(); - if (output_optional) { - wrapped.push_back(flutter::EncodableValue(std::move(output_optional).value())); - } else { - wrapped.push_back(flutter::EncodableValue()); - } - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_a_nullable_uint8_list_arg = args.at(0); + const auto* a_nullable_uint8_list_arg = + std::get_if>( + &encodable_a_nullable_uint8_list_arg); + ErrorOr>> output = + api->EchoNullableUint8List(a_nullable_uint8_list_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + auto output_optional = std::move(output).TakeValue(); + if (output_optional) { + wrapped.push_back(flutter::EncodableValue( + std::move(output_optional).value())); + } else { + wrapped.push_back(flutter::EncodableValue()); + } + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableObject", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableObject", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_a_nullable_object_arg = args.at(0); - const auto* a_nullable_object_arg = &encodable_a_nullable_object_arg; - ErrorOr> output = api->EchoNullableObject(a_nullable_object_arg); - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - flutter::EncodableList wrapped; - auto output_optional = std::move(output).TakeValue(); - if (output_optional) { - wrapped.push_back(flutter::EncodableValue(std::move(output_optional).value())); - } else { - wrapped.push_back(flutter::EncodableValue()); - } - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_a_nullable_object_arg = args.at(0); + const auto* a_nullable_object_arg = + &encodable_a_nullable_object_arg; + ErrorOr> output = + api->EchoNullableObject(a_nullable_object_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + auto output_optional = std::move(output).TakeValue(); + if (output_optional) { + wrapped.push_back(flutter::EncodableValue( + std::move(output_optional).value())); + } else { + wrapped.push_back(flutter::EncodableValue()); + } + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.noopAsync", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.noopAsync", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - api->NoopAsync([reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + api->NoopAsync([reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + flutter::EncodableList wrapped; + wrapped.push_back(flutter::EncodableValue()); + reply(flutter::EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); } - flutter::EncodableList wrapped; - wrapped.push_back(flutter::EncodableValue()); - reply(flutter::EncodableValue(std::move(wrapped))); }); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncString", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncString", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_a_string_arg = args.at(0); - if (encodable_a_string_arg.IsNull()) { - reply(WrapError("a_string_arg unexpectedly null.")); - return; - } - const auto& a_string_arg = std::get(encodable_a_string_arg); - api->EchoAsyncString(a_string_arg, [reply](ErrorOr&& output) { - if (output.has_error()) { - reply(WrapError(output.error())); - return; + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_a_string_arg = args.at(0); + if (encodable_a_string_arg.IsNull()) { + reply(WrapError("a_string_arg unexpectedly null.")); + return; + } + const auto& a_string_arg = + std::get(encodable_a_string_arg); + api->EchoAsyncString( + a_string_arg, [reply](ErrorOr&& output) { + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + wrapped.push_back( + flutter::EncodableValue(std::move(output).TakeValue())); + reply(flutter::EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); } - flutter::EncodableList wrapped; - wrapped.push_back(flutter::EncodableValue(std::move(output).TakeValue())); - reply(flutter::EncodableValue(std::move(wrapped))); }); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterNoop", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterNoop", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - api->CallFlutterNoop([reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + api->CallFlutterNoop( + [reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + flutter::EncodableList wrapped; + wrapped.push_back(flutter::EncodableValue()); + reply(flutter::EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); } - flutter::EncodableList wrapped; - wrapped.push_back(flutter::EncodableValue()); - reply(flutter::EncodableValue(std::move(wrapped))); }); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); } else { channel->SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoString", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, + "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoString", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_a_string_arg = args.at(0); - if (encodable_a_string_arg.IsNull()) { - reply(WrapError("a_string_arg unexpectedly null.")); - return; - } - const auto& a_string_arg = std::get(encodable_a_string_arg); - api->CallFlutterEchoString(a_string_arg, [reply](ErrorOr&& output) { - if (output.has_error()) { - reply(WrapError(output.error())); - return; + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_a_string_arg = args.at(0); + if (encodable_a_string_arg.IsNull()) { + reply(WrapError("a_string_arg unexpectedly null.")); + return; + } + const auto& a_string_arg = + std::get(encodable_a_string_arg); + api->CallFlutterEchoString( + a_string_arg, [reply](ErrorOr&& output) { + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + flutter::EncodableList wrapped; + wrapped.push_back( + flutter::EncodableValue(std::move(output).TakeValue())); + reply(flutter::EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); } - flutter::EncodableList wrapped; - wrapped.push_back(flutter::EncodableValue(std::move(output).TakeValue())); - reply(flutter::EncodableValue(std::move(wrapped))); }); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); } else { channel->SetMessageHandler(nullptr); } } } -flutter::EncodableValue HostIntegrationCoreApi::WrapError(std::string_view error_message) { +flutter::EncodableValue HostIntegrationCoreApi::WrapError( + std::string_view error_message) { return flutter::EncodableValue(flutter::EncodableList{ - flutter::EncodableValue(std::string(error_message)), - flutter::EncodableValue("Error"), - flutter::EncodableValue() - }); + flutter::EncodableValue(std::string(error_message)), + flutter::EncodableValue("Error"), flutter::EncodableValue()}); } -flutter::EncodableValue HostIntegrationCoreApi::WrapError(const FlutterError& error) { +flutter::EncodableValue HostIntegrationCoreApi::WrapError( + const FlutterError& error) { return flutter::EncodableValue(flutter::EncodableList{ - flutter::EncodableValue(error.message()), - flutter::EncodableValue(error.code()), - error.details() - }); + flutter::EncodableValue(error.message()), + flutter::EncodableValue(error.code()), error.details()}); } -FlutterIntegrationCoreApiCodecSerializer::FlutterIntegrationCoreApiCodecSerializer() {} -flutter::EncodableValue FlutterIntegrationCoreApiCodecSerializer::ReadValueOfType(uint8_t type, flutter::ByteStreamReader* stream) const { +FlutterIntegrationCoreApiCodecSerializer:: + FlutterIntegrationCoreApiCodecSerializer() {} +flutter::EncodableValue +FlutterIntegrationCoreApiCodecSerializer::ReadValueOfType( + uint8_t type, flutter::ByteStreamReader* stream) const { switch (type) { - case 128: - return flutter::CustomEncodableValue(AllNullableTypes(std::get(ReadValue(stream)))); - - case 129: - return flutter::CustomEncodableValue(AllNullableTypesWrapper(std::get(ReadValue(stream)))); - - case 130: - return flutter::CustomEncodableValue(AllTypes(std::get(ReadValue(stream)))); - - default: + case 128: + return flutter::CustomEncodableValue(AllNullableTypes( + std::get(ReadValue(stream)))); + + case 129: + return flutter::CustomEncodableValue(AllNullableTypesWrapper( + std::get(ReadValue(stream)))); + + case 130: + return flutter::CustomEncodableValue( + AllTypes(std::get(ReadValue(stream)))); + + default: return flutter::StandardCodecSerializer::ReadValueOfType(type, stream); - } + } } -void FlutterIntegrationCoreApiCodecSerializer::WriteValue(const flutter::EncodableValue& value, flutter::ByteStreamWriter* stream) const { - if (const flutter::CustomEncodableValue* custom_value = std::get_if(&value)) { +void FlutterIntegrationCoreApiCodecSerializer::WriteValue( + const flutter::EncodableValue& value, + flutter::ByteStreamWriter* stream) const { + if (const flutter::CustomEncodableValue* custom_value = + std::get_if(&value)) { if (custom_value->type() == typeid(AllNullableTypes)) { stream->WriteByte(128); - WriteValue(flutter::EncodableValue(std::any_cast(*custom_value).ToEncodableList()), stream); + WriteValue( + flutter::EncodableValue( + std::any_cast(*custom_value).ToEncodableList()), + stream); return; } if (custom_value->type() == typeid(AllNullableTypesWrapper)) { stream->WriteByte(129); - WriteValue(flutter::EncodableValue(std::any_cast(*custom_value).ToEncodableList()), stream); + WriteValue(flutter::EncodableValue( + std::any_cast(*custom_value) + .ToEncodableList()), + stream); return; } if (custom_value->type() == typeid(AllTypes)) { stream->WriteByte(130); - WriteValue(flutter::EncodableValue(std::any_cast(*custom_value).ToEncodableList()), stream); + WriteValue(flutter::EncodableValue( + std::any_cast(*custom_value).ToEncodableList()), + stream); return; } } flutter::StandardCodecSerializer::WriteValue(value, stream); } -// Generated class from Pigeon that represents Flutter messages that can be called from C++. -FlutterIntegrationCoreApi::FlutterIntegrationCoreApi(flutter::BinaryMessenger* binary_messenger) { +// Generated class from Pigeon that represents Flutter messages that can be +// called from C++. +FlutterIntegrationCoreApi::FlutterIntegrationCoreApi( + flutter::BinaryMessenger* binary_messenger) { this->binary_messenger_ = binary_messenger; } const flutter::StandardMessageCodec& FlutterIntegrationCoreApi::GetCodec() { - return flutter::StandardMessageCodec::GetInstance(&FlutterIntegrationCoreApiCodecSerializer::GetInstance()); + return flutter::StandardMessageCodec::GetInstance( + &FlutterIntegrationCoreApiCodecSerializer::GetInstance()); } -void FlutterIntegrationCoreApi::Noop(std::function&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.noop", &GetCodec()); +void FlutterIntegrationCoreApi::Noop( + std::function&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.noop", + &GetCodec()); flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - on_success(); - }); -} -void FlutterIntegrationCoreApi::EchoAllTypes(const AllTypes& everything_arg, std::function&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllTypes", &GetCodec()); - flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(flutter::EncodableList{ - flutter::EncodableValue(everything_arg.ToEncodableList()), - }); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto& return_value = std::any_cast(std::get(encodable_return_value)); - on_success(return_value); - }); -} -void FlutterIntegrationCoreApi::EchoAllNullableTypes(const AllNullableTypes& everything_arg, std::function&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes", &GetCodec()); - flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(flutter::EncodableList{ - flutter::EncodableValue(everything_arg.ToEncodableList()), - }); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto& return_value = std::any_cast(std::get(encodable_return_value)); - on_success(return_value); - }); -} -void FlutterIntegrationCoreApi::SendMultipleNullableTypes(const bool* a_nullable_bool_arg, const int64_t* a_nullable_int_arg, const std::string* a_nullable_string_arg, std::function&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.sendMultipleNullableTypes", &GetCodec()); - flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(flutter::EncodableList{ - a_nullable_bool_arg ? flutter::EncodableValue(*a_nullable_bool_arg) : flutter::EncodableValue(), - a_nullable_int_arg ? flutter::EncodableValue(*a_nullable_int_arg) : flutter::EncodableValue(), - a_nullable_string_arg ? flutter::EncodableValue(*a_nullable_string_arg) : flutter::EncodableValue(), - }); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto& return_value = std::any_cast(std::get(encodable_return_value)); - on_success(return_value); - }); -} -void FlutterIntegrationCoreApi::EchoBool(bool a_bool_arg, std::function&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoBool", &GetCodec()); - flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(flutter::EncodableList{ - flutter::EncodableValue(a_bool_arg), - }); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto& return_value = std::get(encodable_return_value); - on_success(return_value); - }); -} -void FlutterIntegrationCoreApi::EchoInt(int64_t an_int_arg, std::function&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoInt", &GetCodec()); - flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(flutter::EncodableList{ - flutter::EncodableValue(an_int_arg), - }); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const int64_t return_value = encodable_return_value.LongValue(); - on_success(return_value); - }); -} -void FlutterIntegrationCoreApi::EchoDouble(double a_double_arg, std::function&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoDouble", &GetCodec()); - flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(flutter::EncodableList{ - flutter::EncodableValue(a_double_arg), - }); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto& return_value = std::get(encodable_return_value); - on_success(return_value); - }); -} -void FlutterIntegrationCoreApi::EchoString(const std::string& a_string_arg, std::function&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoString", &GetCodec()); - flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(flutter::EncodableList{ - flutter::EncodableValue(a_string_arg), - }); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto& return_value = std::get(encodable_return_value); - on_success(return_value); - }); -} -void FlutterIntegrationCoreApi::EchoUint8List(const std::vector& a_list_arg, std::function&)>&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoUint8List", &GetCodec()); - flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(flutter::EncodableList{ - flutter::EncodableValue(a_list_arg), - }); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto& return_value = std::get>(encodable_return_value); - on_success(return_value); - }); -} -void FlutterIntegrationCoreApi::EchoList(const flutter::EncodableList& a_list_arg, std::function&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoList", &GetCodec()); - flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(flutter::EncodableList{ - flutter::EncodableValue(a_list_arg), - }); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto& return_value = std::get(encodable_return_value); - on_success(return_value); - }); -} -void FlutterIntegrationCoreApi::EchoMap(const flutter::EncodableMap& a_map_arg, std::function&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoMap", &GetCodec()); - flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(flutter::EncodableList{ - flutter::EncodableValue(a_map_arg), - }); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto& return_value = std::get(encodable_return_value); - on_success(return_value); - }); -} -void FlutterIntegrationCoreApi::EchoNullableBool(const bool* a_bool_arg, std::function&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableBool", &GetCodec()); - flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(flutter::EncodableList{ - a_bool_arg ? flutter::EncodableValue(*a_bool_arg) : flutter::EncodableValue(), - }); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto* return_value = std::get_if(&encodable_return_value); - on_success(return_value); - }); -} -void FlutterIntegrationCoreApi::EchoNullableInt(const int64_t* an_int_arg, std::function&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableInt", &GetCodec()); - flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(flutter::EncodableList{ - an_int_arg ? flutter::EncodableValue(*an_int_arg) : flutter::EncodableValue(), - }); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const int64_t return_value_value = encodable_return_value.IsNull() ? 0 : encodable_return_value.LongValue(); - const auto* return_value = encodable_return_value.IsNull() ? nullptr : &return_value_value; - on_success(return_value); - }); -} -void FlutterIntegrationCoreApi::EchoNullableDouble(const double* a_double_arg, std::function&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableDouble", &GetCodec()); - flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(flutter::EncodableList{ - a_double_arg ? flutter::EncodableValue(*a_double_arg) : flutter::EncodableValue(), - }); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto* return_value = std::get_if(&encodable_return_value); - on_success(return_value); - }); -} -void FlutterIntegrationCoreApi::EchoNullableString(const std::string* a_string_arg, std::function&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableString", &GetCodec()); - flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(flutter::EncodableList{ - a_string_arg ? flutter::EncodableValue(*a_string_arg) : flutter::EncodableValue(), - }); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto* return_value = std::get_if(&encodable_return_value); - on_success(return_value); - }); -} -void FlutterIntegrationCoreApi::EchoNullableUint8List(const std::vector* a_list_arg, std::function*)>&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableUint8List", &GetCodec()); - flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(flutter::EncodableList{ - a_list_arg ? flutter::EncodableValue(*a_list_arg) : flutter::EncodableValue(), - }); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto* return_value = std::get_if>(&encodable_return_value); - on_success(return_value); - }); -} -void FlutterIntegrationCoreApi::EchoNullableList(const flutter::EncodableList* a_list_arg, std::function&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList", &GetCodec()); - flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(flutter::EncodableList{ - a_list_arg ? flutter::EncodableValue(*a_list_arg) : flutter::EncodableValue(), - }); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto* return_value = std::get_if(&encodable_return_value); - on_success(return_value); - }); -} -void FlutterIntegrationCoreApi::EchoNullableMap(const flutter::EncodableMap& a_map_arg, std::function&& on_success, std::function&& on_error) { - auto channel = std::make_unique>(binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap", &GetCodec()); - flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(flutter::EncodableList{ - flutter::EncodableValue(a_map_arg), - }); - channel->Send(encoded_api_arguments, [on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto& return_value = std::get(encodable_return_value); - on_success(return_value); - }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { on_success(); }); +} +void FlutterIntegrationCoreApi::EchoAllTypes( + const AllTypes& everything_arg, + std::function&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllTypes", &GetCodec()); + flutter::EncodableValue encoded_api_arguments = + flutter::EncodableValue(flutter::EncodableList{ + flutter::EncodableValue(everything_arg.ToEncodableList()), + }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto& return_value = std::any_cast( + std::get(encodable_return_value)); + on_success(return_value); + }); +} +void FlutterIntegrationCoreApi::EchoAllNullableTypes( + const AllNullableTypes& everything_arg, + std::function&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes", + &GetCodec()); + flutter::EncodableValue encoded_api_arguments = + flutter::EncodableValue(flutter::EncodableList{ + flutter::EncodableValue(everything_arg.ToEncodableList()), + }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto& return_value = std::any_cast( + std::get(encodable_return_value)); + on_success(return_value); + }); +} +void FlutterIntegrationCoreApi::SendMultipleNullableTypes( + const bool* a_nullable_bool_arg, const int64_t* a_nullable_int_arg, + const std::string* a_nullable_string_arg, + std::function&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.sendMultipleNullableTypes", + &GetCodec()); + flutter::EncodableValue encoded_api_arguments = + flutter::EncodableValue(flutter::EncodableList{ + a_nullable_bool_arg ? flutter::EncodableValue(*a_nullable_bool_arg) + : flutter::EncodableValue(), + a_nullable_int_arg ? flutter::EncodableValue(*a_nullable_int_arg) + : flutter::EncodableValue(), + a_nullable_string_arg + ? flutter::EncodableValue(*a_nullable_string_arg) + : flutter::EncodableValue(), + }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto& return_value = std::any_cast( + std::get(encodable_return_value)); + on_success(return_value); + }); +} +void FlutterIntegrationCoreApi::EchoBool( + bool a_bool_arg, std::function&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoBool", &GetCodec()); + flutter::EncodableValue encoded_api_arguments = + flutter::EncodableValue(flutter::EncodableList{ + flutter::EncodableValue(a_bool_arg), + }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto& return_value = std::get(encodable_return_value); + on_success(return_value); + }); +} +void FlutterIntegrationCoreApi::EchoInt( + int64_t an_int_arg, std::function&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoInt", + &GetCodec()); + flutter::EncodableValue encoded_api_arguments = + flutter::EncodableValue(flutter::EncodableList{ + flutter::EncodableValue(an_int_arg), + }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const int64_t return_value = encodable_return_value.LongValue(); + on_success(return_value); + }); +} +void FlutterIntegrationCoreApi::EchoDouble( + double a_double_arg, std::function&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoDouble", &GetCodec()); + flutter::EncodableValue encoded_api_arguments = + flutter::EncodableValue(flutter::EncodableList{ + flutter::EncodableValue(a_double_arg), + }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto& return_value = std::get(encodable_return_value); + on_success(return_value); + }); +} +void FlutterIntegrationCoreApi::EchoString( + const std::string& a_string_arg, + std::function&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoString", &GetCodec()); + flutter::EncodableValue encoded_api_arguments = + flutter::EncodableValue(flutter::EncodableList{ + flutter::EncodableValue(a_string_arg), + }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto& return_value = + std::get(encodable_return_value); + on_success(return_value); + }); +} +void FlutterIntegrationCoreApi::EchoUint8List( + const std::vector& a_list_arg, + std::function&)>&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoUint8List", + &GetCodec()); + flutter::EncodableValue encoded_api_arguments = + flutter::EncodableValue(flutter::EncodableList{ + flutter::EncodableValue(a_list_arg), + }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto& return_value = + std::get>(encodable_return_value); + on_success(return_value); + }); +} +void FlutterIntegrationCoreApi::EchoList( + const flutter::EncodableList& a_list_arg, + std::function&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoList", &GetCodec()); + flutter::EncodableValue encoded_api_arguments = + flutter::EncodableValue(flutter::EncodableList{ + flutter::EncodableValue(a_list_arg), + }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto& return_value = + std::get(encodable_return_value); + on_success(return_value); + }); +} +void FlutterIntegrationCoreApi::EchoMap( + const flutter::EncodableMap& a_map_arg, + std::function&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoMap", + &GetCodec()); + flutter::EncodableValue encoded_api_arguments = + flutter::EncodableValue(flutter::EncodableList{ + flutter::EncodableValue(a_map_arg), + }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto& return_value = + std::get(encodable_return_value); + on_success(return_value); + }); +} +void FlutterIntegrationCoreApi::EchoNullableBool( + const bool* a_bool_arg, std::function&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableBool", + &GetCodec()); + flutter::EncodableValue encoded_api_arguments = + flutter::EncodableValue(flutter::EncodableList{ + a_bool_arg ? flutter::EncodableValue(*a_bool_arg) + : flutter::EncodableValue(), + }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto* return_value = std::get_if(&encodable_return_value); + on_success(return_value); + }); +} +void FlutterIntegrationCoreApi::EchoNullableInt( + const int64_t* an_int_arg, std::function&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableInt", + &GetCodec()); + flutter::EncodableValue encoded_api_arguments = + flutter::EncodableValue(flutter::EncodableList{ + an_int_arg ? flutter::EncodableValue(*an_int_arg) + : flutter::EncodableValue(), + }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const int64_t return_value_value = + encodable_return_value.IsNull() + ? 0 + : encodable_return_value.LongValue(); + const auto* return_value = + encodable_return_value.IsNull() ? nullptr : &return_value_value; + on_success(return_value); + }); +} +void FlutterIntegrationCoreApi::EchoNullableDouble( + const double* a_double_arg, std::function&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableDouble", + &GetCodec()); + flutter::EncodableValue encoded_api_arguments = + flutter::EncodableValue(flutter::EncodableList{ + a_double_arg ? flutter::EncodableValue(*a_double_arg) + : flutter::EncodableValue(), + }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto* return_value = std::get_if(&encodable_return_value); + on_success(return_value); + }); +} +void FlutterIntegrationCoreApi::EchoNullableString( + const std::string* a_string_arg, + std::function&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableString", + &GetCodec()); + flutter::EncodableValue encoded_api_arguments = + flutter::EncodableValue(flutter::EncodableList{ + a_string_arg ? flutter::EncodableValue(*a_string_arg) + : flutter::EncodableValue(), + }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto* return_value = + std::get_if(&encodable_return_value); + on_success(return_value); + }); +} +void FlutterIntegrationCoreApi::EchoNullableUint8List( + const std::vector* a_list_arg, + std::function*)>&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableUint8List", + &GetCodec()); + flutter::EncodableValue encoded_api_arguments = + flutter::EncodableValue(flutter::EncodableList{ + a_list_arg ? flutter::EncodableValue(*a_list_arg) + : flutter::EncodableValue(), + }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto* return_value = + std::get_if>(&encodable_return_value); + on_success(return_value); + }); +} +void FlutterIntegrationCoreApi::EchoNullableList( + const flutter::EncodableList* a_list_arg, + std::function&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList", + &GetCodec()); + flutter::EncodableValue encoded_api_arguments = + flutter::EncodableValue(flutter::EncodableList{ + a_list_arg ? flutter::EncodableValue(*a_list_arg) + : flutter::EncodableValue(), + }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto* return_value = + std::get_if(&encodable_return_value); + on_success(return_value); + }); +} +void FlutterIntegrationCoreApi::EchoNullableMap( + const flutter::EncodableMap& a_map_arg, + std::function&& on_success, + std::function&& on_error) { + auto channel = std::make_unique>( + binary_messenger_, + "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap", + &GetCodec()); + flutter::EncodableValue encoded_api_arguments = + flutter::EncodableValue(flutter::EncodableList{ + flutter::EncodableValue(a_map_arg), + }); + channel->Send( + encoded_api_arguments, + [on_success = std::move(on_success), on_error = std::move(on_error)]( + const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = + GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto& return_value = + std::get(encodable_return_value); + on_success(return_value); + }); } /// The codec used by HostTrivialApi. const flutter::StandardMessageCodec& HostTrivialApi::GetCodec() { - return flutter::StandardMessageCodec::GetInstance(&flutter::StandardCodecSerializer::GetInstance()); + return flutter::StandardMessageCodec::GetInstance( + &flutter::StandardCodecSerializer::GetInstance()); } -// Sets up an instance of `HostTrivialApi` to handle messages through the `binary_messenger`. -void HostTrivialApi::SetUp(flutter::BinaryMessenger* binary_messenger, HostTrivialApi* api) { +// Sets up an instance of `HostTrivialApi` to handle messages through the +// `binary_messenger`. +void HostTrivialApi::SetUp(flutter::BinaryMessenger* binary_messenger, + HostTrivialApi* api) { { - auto channel = std::make_unique>(binary_messenger, "dev.flutter.pigeon.HostTrivialApi.noop", &GetCodec()); + auto channel = std::make_unique>( + binary_messenger, "dev.flutter.pigeon.HostTrivialApi.noop", + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler([api](const flutter::EncodableValue& message, const flutter::MessageReply& reply) { - try { - std::optional output = api->Noop(); - if (output.has_value()) { - reply(WrapError(output.value())); - return; - } - flutter::EncodableList wrapped; - wrapped.push_back(flutter::EncodableValue()); - reply(flutter::EncodableValue(std::move(wrapped))); - } - catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); + channel->SetMessageHandler( + [api](const flutter::EncodableValue& message, + const flutter::MessageReply& reply) { + try { + std::optional output = api->Noop(); + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + flutter::EncodableList wrapped; + wrapped.push_back(flutter::EncodableValue()); + reply(flutter::EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); } else { channel->SetMessageHandler(nullptr); } } } -flutter::EncodableValue HostTrivialApi::WrapError(std::string_view error_message) { +flutter::EncodableValue HostTrivialApi::WrapError( + std::string_view error_message) { return flutter::EncodableValue(flutter::EncodableList{ - flutter::EncodableValue(std::string(error_message)), - flutter::EncodableValue("Error"), - flutter::EncodableValue() - }); + flutter::EncodableValue(std::string(error_message)), + flutter::EncodableValue("Error"), flutter::EncodableValue()}); } flutter::EncodableValue HostTrivialApi::WrapError(const FlutterError& error) { return flutter::EncodableValue(flutter::EncodableList{ - flutter::EncodableValue(error.message()), - flutter::EncodableValue(error.code()), - error.details() - }); + flutter::EncodableValue(error.message()), + flutter::EncodableValue(error.code()), error.details()}); } } // namespace core_tests_pigeontest diff --git a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h index f0e72b5663d..9bc1617e493 100644 --- a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h +++ b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h @@ -1,7 +1,7 @@ // 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 (v6.0.4), do not edit directly. // See also: https://pub.dev/packages/pigeon @@ -24,12 +24,12 @@ class CoreTestsTest; class FlutterError { public: - explicit FlutterError(const std::string& code) - : code_(code) {} + explicit FlutterError(const std::string& code) : code_(code) {} explicit FlutterError(const std::string& code, const std::string& message) - : code_(code), message_(message) {} - explicit FlutterError(const std::string& code, const std::string& message, const flutter::EncodableValue& details) - : code_(code), message_(message), details_(details) {} + : code_(code), message_(message) {} + explicit FlutterError(const std::string& code, const std::string& message, + const flutter::EncodableValue& details) + : code_(code), message_(message), details_(details) {} const std::string& code() const { return code_; } const std::string& message() const { return message_; } @@ -41,13 +41,12 @@ class FlutterError { flutter::EncodableValue details_; }; -template class ErrorOr { +template +class ErrorOr { public: - ErrorOr(const T& rhs) { new(&v_) T(rhs); } + ErrorOr(const T& rhs) { new (&v_) T(rhs); } ErrorOr(const T&& rhs) { v_ = std::move(rhs); } - ErrorOr(const FlutterError& rhs) { - new(&v_) FlutterError(rhs); - } + ErrorOr(const FlutterError& rhs) { new (&v_) FlutterError(rhs); } ErrorOr(const FlutterError&& rhs) { v_ = std::move(rhs); } bool has_error() const { return std::holds_alternative(v_); } @@ -64,12 +63,7 @@ template class ErrorOr { std::variant v_; }; - -enum class AnEnum { - one = 0, - two = 1, - three = 2 -}; +enum class AnEnum { one = 0, two = 1, three = 2 }; // Generated class from Pigeon that represents data sent in messages. class AllTypes { @@ -108,7 +102,6 @@ class AllTypes { const std::string& a_string() const; void set_a_string(std::string_view value_arg); - private: AllTypes(const flutter::EncodableList& list); flutter::EncodableList ToEncodableList() const; @@ -130,10 +123,8 @@ class AllTypes { flutter::EncodableMap a_map_; AnEnum an_enum_; std::string a_string_; - }; - // Generated class from Pigeon that represents data sent in messages. class AllNullableTypes { public: @@ -179,8 +170,10 @@ class AllNullableTypes { void set_nullable_nested_list(const flutter::EncodableList& value_arg); const flutter::EncodableMap* nullable_map_with_annotations() const; - void set_nullable_map_with_annotations(const flutter::EncodableMap* value_arg); - void set_nullable_map_with_annotations(const flutter::EncodableMap& value_arg); + void set_nullable_map_with_annotations( + const flutter::EncodableMap* value_arg); + void set_nullable_map_with_annotations( + const flutter::EncodableMap& value_arg); const flutter::EncodableMap* nullable_map_with_object() const; void set_nullable_map_with_object(const flutter::EncodableMap* value_arg); @@ -194,7 +187,6 @@ class AllNullableTypes { void set_a_nullable_string(const std::string_view* value_arg); void set_a_nullable_string(std::string_view value_arg); - private: AllNullableTypes(const flutter::EncodableList& list); flutter::EncodableList ToEncodableList() const; @@ -220,10 +212,8 @@ class AllNullableTypes { std::optional nullable_map_with_object_; std::optional a_nullable_enum_; std::optional a_nullable_string_; - }; - // Generated class from Pigeon that represents data sent in messages. class AllNullableTypesWrapper { public: @@ -231,7 +221,6 @@ class AllNullableTypesWrapper { const AllNullableTypes& values() const; void set_values(const AllNullableTypes& value_arg); - private: AllNullableTypesWrapper(const flutter::EncodableList& list); flutter::EncodableList ToEncodableList() const; @@ -243,12 +232,11 @@ class AllNullableTypesWrapper { friend class HostTrivialApiCodecSerializer; friend class CoreTestsTest; AllNullableTypes values_; - }; -class HostIntegrationCoreApiCodecSerializer : public flutter::StandardCodecSerializer { +class HostIntegrationCoreApiCodecSerializer + : public flutter::StandardCodecSerializer { public: - inline static HostIntegrationCoreApiCodecSerializer& GetInstance() { static HostIntegrationCoreApiCodecSerializer sInstance; return sInstance; @@ -257,29 +245,32 @@ class HostIntegrationCoreApiCodecSerializer : public flutter::StandardCodecSeria HostIntegrationCoreApiCodecSerializer(); public: - void WriteValue(const flutter::EncodableValue& value, flutter::ByteStreamWriter* stream) const override; + void WriteValue(const flutter::EncodableValue& value, + flutter::ByteStreamWriter* stream) const override; protected: - flutter::EncodableValue ReadValueOfType(uint8_t type, flutter::ByteStreamReader* stream) const override; - + flutter::EncodableValue ReadValueOfType( + uint8_t type, flutter::ByteStreamReader* stream) const override; }; // The core interface that each host language plugin must implement in // platform_test integration tests. // -// Generated interface from Pigeon that represents a handler of messages from Flutter. +// Generated interface from Pigeon that represents a handler of messages from +// Flutter. class HostIntegrationCoreApi { public: HostIntegrationCoreApi(const HostIntegrationCoreApi&) = delete; HostIntegrationCoreApi& operator=(const HostIntegrationCoreApi&) = delete; - virtual ~HostIntegrationCoreApi() { }; + virtual ~HostIntegrationCoreApi(){}; // A no-op function taking no arguments and returning no value, to sanity // test basic calling. virtual std::optional Noop() = 0; // Returns the passed object, to test serialization and deserialization. virtual ErrorOr EchoAllTypes(const AllTypes& everything) = 0; // Returns the passed object, to test serialization and deserialization. - virtual ErrorOr> EchoAllNullableTypes(const AllNullableTypes* everything) = 0; + virtual ErrorOr> EchoAllNullableTypes( + const AllNullableTypes* everything) = 0; // Returns an error, to test error handling. virtual std::optional ThrowError() = 0; // Returns passed in int. @@ -291,51 +282,70 @@ class HostIntegrationCoreApi { // Returns the passed in string. virtual ErrorOr EchoString(const std::string& a_string) = 0; // Returns the passed in Uint8List. - virtual ErrorOr> EchoUint8List(const std::vector& a_uint8_list) = 0; + virtual ErrorOr> EchoUint8List( + const std::vector& a_uint8_list) = 0; // Returns the passed in generic Object. - virtual ErrorOr EchoObject(const flutter::EncodableValue& an_object) = 0; + virtual ErrorOr EchoObject( + const flutter::EncodableValue& an_object) = 0; // Returns the inner `aString` value from the wrapped object, to test // sending of nested objects. - virtual ErrorOr> ExtractNestedNullableString(const AllNullableTypesWrapper& wrapper) = 0; + virtual ErrorOr> ExtractNestedNullableString( + const AllNullableTypesWrapper& wrapper) = 0; // Returns the inner `aString` value from the wrapped object, to test // sending of nested objects. - virtual ErrorOr CreateNestedNullableString(const std::string* nullable_string) = 0; + virtual ErrorOr CreateNestedNullableString( + const std::string* nullable_string) = 0; // Returns passed in arguments of multiple types. - virtual ErrorOr SendMultipleNullableTypes(const bool* a_nullable_bool, const int64_t* a_nullable_int, const std::string* a_nullable_string) = 0; + virtual ErrorOr SendMultipleNullableTypes( + const bool* a_nullable_bool, const int64_t* a_nullable_int, + const std::string* a_nullable_string) = 0; // Returns passed in int. - virtual ErrorOr> EchoNullableInt(const int64_t* a_nullable_int) = 0; + virtual ErrorOr> EchoNullableInt( + const int64_t* a_nullable_int) = 0; // Returns passed in double. - virtual ErrorOr> EchoNullableDouble(const double* a_nullable_double) = 0; + virtual ErrorOr> EchoNullableDouble( + const double* a_nullable_double) = 0; // Returns the passed in boolean. - virtual ErrorOr> EchoNullableBool(const bool* a_nullable_bool) = 0; + virtual ErrorOr> EchoNullableBool( + const bool* a_nullable_bool) = 0; // Returns the passed in string. - virtual ErrorOr> EchoNullableString(const std::string* a_nullable_string) = 0; + virtual ErrorOr> EchoNullableString( + const std::string* a_nullable_string) = 0; // Returns the passed in Uint8List. - virtual ErrorOr>> EchoNullableUint8List(const std::vector* a_nullable_uint8_list) = 0; + virtual ErrorOr>> EchoNullableUint8List( + const std::vector* a_nullable_uint8_list) = 0; // Returns the passed in generic Object. - virtual ErrorOr> EchoNullableObject(const flutter::EncodableValue* a_nullable_object) = 0; + virtual ErrorOr> EchoNullableObject( + const flutter::EncodableValue* a_nullable_object) = 0; // A no-op function taking no arguments and returning no value, to sanity // test basic asynchronous calling. - virtual void NoopAsync(std::function reply)> result) = 0; + virtual void NoopAsync( + std::function reply)> result) = 0; // Returns the passed string asynchronously. - virtual void EchoAsyncString(const std::string& a_string, std::function reply)> result) = 0; - virtual void CallFlutterNoop(std::function reply)> result) = 0; - virtual void CallFlutterEchoString(const std::string& a_string, std::function reply)> result) = 0; + virtual void EchoAsyncString( + const std::string& a_string, + std::function reply)> result) = 0; + virtual void CallFlutterNoop( + std::function reply)> result) = 0; + virtual void CallFlutterEchoString( + const std::string& a_string, + std::function reply)> result) = 0; // The codec used by HostIntegrationCoreApi. static const flutter::StandardMessageCodec& GetCodec(); - // Sets up an instance of `HostIntegrationCoreApi` to handle messages through the `binary_messenger`. - static void SetUp(flutter::BinaryMessenger* binary_messenger, HostIntegrationCoreApi* api); + // Sets up an instance of `HostIntegrationCoreApi` to handle messages through + // the `binary_messenger`. + static void SetUp(flutter::BinaryMessenger* binary_messenger, + HostIntegrationCoreApi* api); static flutter::EncodableValue WrapError(std::string_view error_message); static flutter::EncodableValue WrapError(const FlutterError& error); protected: HostIntegrationCoreApi() = default; - }; -class FlutterIntegrationCoreApiCodecSerializer : public flutter::StandardCodecSerializer { +class FlutterIntegrationCoreApiCodecSerializer + : public flutter::StandardCodecSerializer { public: - inline static FlutterIntegrationCoreApiCodecSerializer& GetInstance() { static FlutterIntegrationCoreApiCodecSerializer sInstance; return sInstance; @@ -344,17 +354,19 @@ class FlutterIntegrationCoreApiCodecSerializer : public flutter::StandardCodecSe FlutterIntegrationCoreApiCodecSerializer(); public: - void WriteValue(const flutter::EncodableValue& value, flutter::ByteStreamWriter* stream) const override; + void WriteValue(const flutter::EncodableValue& value, + flutter::ByteStreamWriter* stream) const override; protected: - flutter::EncodableValue ReadValueOfType(uint8_t type, flutter::ByteStreamReader* stream) const override; - + flutter::EncodableValue ReadValueOfType( + uint8_t type, flutter::ByteStreamReader* stream) const override; }; // The core interface that the Dart platform_test code implements for host // integration tests to call into. // -// Generated class from Pigeon that represents Flutter messages that can be called from C++. +// Generated class from Pigeon that represents Flutter messages that can be +// called from C++. class FlutterIntegrationCoreApi { private: flutter::BinaryMessenger* binary_messenger_; @@ -364,66 +376,106 @@ class FlutterIntegrationCoreApi { static const flutter::StandardMessageCodec& GetCodec(); // A no-op function taking no arguments and returning no value, to sanity // test basic calling. - void Noop(std::function&& on_success, std::function&& on_error); + void Noop(std::function&& on_success, + std::function&& on_error); // Returns the passed object, to test serialization and deserialization. - void EchoAllTypes(const AllTypes& everything, std::function&& on_success, std::function&& on_error); + void EchoAllTypes(const AllTypes& everything, + std::function&& on_success, + std::function&& on_error); // Returns the passed object, to test serialization and deserialization. - void EchoAllNullableTypes(const AllNullableTypes& everything, std::function&& on_success, std::function&& on_error); + void EchoAllNullableTypes( + const AllNullableTypes& everything, + std::function&& on_success, + std::function&& on_error); // Returns passed in arguments of multiple types. // // Tests multiple-arity FlutterApi handling. - void SendMultipleNullableTypes(const bool* a_nullable_bool, const int64_t* a_nullable_int, const std::string* a_nullable_string, std::function&& on_success, std::function&& on_error); + void SendMultipleNullableTypes( + const bool* a_nullable_bool, const int64_t* a_nullable_int, + const std::string* a_nullable_string, + std::function&& on_success, + std::function&& on_error); // Returns the passed boolean, to test serialization and deserialization. - void EchoBool(bool a_bool, std::function&& on_success, std::function&& on_error); + void EchoBool(bool a_bool, std::function&& on_success, + std::function&& on_error); // Returns the passed int, to test serialization and deserialization. - void EchoInt(int64_t an_int, std::function&& on_success, std::function&& on_error); + void EchoInt(int64_t an_int, std::function&& on_success, + std::function&& on_error); // Returns the passed double, to test serialization and deserialization. - void EchoDouble(double a_double, std::function&& on_success, std::function&& on_error); + void EchoDouble(double a_double, std::function&& on_success, + std::function&& on_error); // Returns the passed string, to test serialization and deserialization. - void EchoString(const std::string& a_string, std::function&& on_success, std::function&& on_error); + void EchoString(const std::string& a_string, + std::function&& on_success, + std::function&& on_error); // Returns the passed byte list, to test serialization and deserialization. - void EchoUint8List(const std::vector& a_list, std::function&)>&& on_success, std::function&& on_error); + void EchoUint8List( + const std::vector& a_list, + std::function&)>&& on_success, + std::function&& on_error); // Returns the passed list, to test serialization and deserialization. - void EchoList(const flutter::EncodableList& a_list, std::function&& on_success, std::function&& on_error); + void EchoList(const flutter::EncodableList& a_list, + std::function&& on_success, + std::function&& on_error); // Returns the passed map, to test serialization and deserialization. - void EchoMap(const flutter::EncodableMap& a_map, std::function&& on_success, std::function&& on_error); + void EchoMap(const flutter::EncodableMap& a_map, + std::function&& on_success, + std::function&& on_error); // Returns the passed boolean, to test serialization and deserialization. - void EchoNullableBool(const bool* a_bool, std::function&& on_success, std::function&& on_error); + void EchoNullableBool(const bool* a_bool, + std::function&& on_success, + std::function&& on_error); // Returns the passed int, to test serialization and deserialization. - void EchoNullableInt(const int64_t* an_int, std::function&& on_success, std::function&& on_error); + void EchoNullableInt(const int64_t* an_int, + std::function&& on_success, + std::function&& on_error); // Returns the passed double, to test serialization and deserialization. - void EchoNullableDouble(const double* a_double, std::function&& on_success, std::function&& on_error); + void EchoNullableDouble(const double* a_double, + std::function&& on_success, + std::function&& on_error); // Returns the passed string, to test serialization and deserialization. - void EchoNullableString(const std::string* a_string, std::function&& on_success, std::function&& on_error); + void EchoNullableString(const std::string* a_string, + std::function&& on_success, + std::function&& on_error); // Returns the passed byte list, to test serialization and deserialization. - void EchoNullableUint8List(const std::vector* a_list, std::function*)>&& on_success, std::function&& on_error); + void EchoNullableUint8List( + const std::vector* a_list, + std::function*)>&& on_success, + std::function&& on_error); // Returns the passed list, to test serialization and deserialization. - void EchoNullableList(const flutter::EncodableList* a_list, std::function&& on_success, std::function&& on_error); + void EchoNullableList( + const flutter::EncodableList* a_list, + std::function&& on_success, + std::function&& on_error); // Returns the passed map, to test serialization and deserialization. - void EchoNullableMap(const flutter::EncodableMap& a_map, std::function&& on_success, std::function&& on_error); - + void EchoNullableMap( + const flutter::EncodableMap& a_map, + std::function&& on_success, + std::function&& on_error); }; // An API that can be implemented for minimal, compile-only tests. // -// Generated interface from Pigeon that represents a handler of messages from Flutter. +// Generated interface from Pigeon that represents a handler of messages from +// Flutter. class HostTrivialApi { public: HostTrivialApi(const HostTrivialApi&) = delete; HostTrivialApi& operator=(const HostTrivialApi&) = delete; - virtual ~HostTrivialApi() { }; + virtual ~HostTrivialApi(){}; virtual std::optional Noop() = 0; // The codec used by HostTrivialApi. static const flutter::StandardMessageCodec& GetCodec(); - // Sets up an instance of `HostTrivialApi` to handle messages through the `binary_messenger`. - static void SetUp(flutter::BinaryMessenger* binary_messenger, HostTrivialApi* api); + // Sets up an instance of `HostTrivialApi` to handle messages through the + // `binary_messenger`. + static void SetUp(flutter::BinaryMessenger* binary_messenger, + HostTrivialApi* api); static flutter::EncodableValue WrapError(std::string_view error_message); static flutter::EncodableValue WrapError(const FlutterError& error); protected: HostTrivialApi() = default; - }; } // namespace core_tests_pigeontest #endif // PIGEON_CORE_TESTS_GEN_H_ From a8c90f0926deb164176f10c26bad4360be79ee1f Mon Sep 17 00:00:00 2001 From: Ailton Vieira Pinto Filho Date: Wed, 18 Jan 2023 16:48:35 -0300 Subject: [PATCH 16/26] Update macos Swift tests --- .../macos/Classes/TestPlugin.swift | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/packages/pigeon/platform_tests/test_plugin/macos/Classes/TestPlugin.swift b/packages/pigeon/platform_tests/test_plugin/macos/Classes/TestPlugin.swift index 2cfe48764a7..4687719ba2b 100644 --- a/packages/pigeon/platform_tests/test_plugin/macos/Classes/TestPlugin.swift +++ b/packages/pigeon/platform_tests/test_plugin/macos/Classes/TestPlugin.swift @@ -23,14 +23,14 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { // MARK: HostIntegrationCoreApi implementation - func noop() { + func noop() { } - func echoAllTypes(everything: AllTypes) -> AllTypes { + func echo(allTypes everything: AllTypes) -> AllTypes { return everything } - func echoAllNullableTypes(everything: AllNullableTypes?) -> AllNullableTypes? { + func echo(allNullableTypes everything: AllNullableTypes?) -> AllNullableTypes? { return everything } @@ -39,64 +39,64 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { // https://github.com/flutter/flutter/issues/112483 } - func echoInt(anInt: Int32) -> Int32 { + func echo(int anInt: Int32) -> Int32 { return anInt } - func echoDouble(aDouble: Double) -> Double { + func echo(double aDouble: Double) -> Double { return aDouble } - func echoBool(aBool: Bool) -> Bool { + func echo(bool aBool: Bool) -> Bool { return aBool } - func echoString(aString: String) -> String { + func echo(string aString: String) -> String { return aString } - func echoUint8List(aUint8List: FlutterStandardTypedData) -> FlutterStandardTypedData { + func echo(uint8List aUint8List: FlutterStandardTypedData) -> FlutterStandardTypedData { return aUint8List } - func echoObject(anObject: Any) -> Any { + func echo(object anObject: Any) -> Any { return anObject } - func extractNestedNullableString(wrapper: AllNullableTypesWrapper) -> String? { + func extractNestedNullableString(from wrapper: AllNullableTypesWrapper) -> String? { return wrapper.values.aNullableString; } - func createNestedNullableString(nullableString: String?) -> AllNullableTypesWrapper { + func createNestedObject(with nullableString: String?) -> AllNullableTypesWrapper { return AllNullableTypesWrapper(values: AllNullableTypes(aNullableString: nullableString)) } - func sendMultipleNullableTypes(aNullableBool: Bool?, aNullableInt: Int32?, aNullableString: String?) -> AllNullableTypes { + func sendMultipleNullableTypes(aBool aNullableBool: Bool?, anInt aNullableInt: Int32?, aString aNullableString: String?) -> AllNullableTypes { let someThings = AllNullableTypes(aNullableBool: aNullableBool, aNullableInt: aNullableInt, aNullableString: aNullableString) return someThings } - func echoNullableInt(aNullableInt: Int32?) -> Int32? { + func echo(nullableInt aNullableInt: Int32?) -> Int32? { return aNullableInt } - func echoNullableDouble(aNullableDouble: Double?) -> Double? { + func echo(nullableDouble aNullableDouble: Double?) -> Double? { return aNullableDouble } - func echoNullableBool(aNullableBool: Bool?) -> Bool? { + func echo(nullableBool aNullableBool: Bool?) -> Bool? { return aNullableBool } - func echoNullableString(aNullableString: String?) -> String? { + func echo(nullableString aNullableString: String?) -> String? { return aNullableString } - func echoNullableUint8List(aNullableUint8List: FlutterStandardTypedData?) -> FlutterStandardTypedData? { + func echo(nullableUint8List aNullableUint8List: FlutterStandardTypedData?) -> FlutterStandardTypedData? { return aNullableUint8List } - func echoNullableObject(aNullableObject: Any?) -> Any? { + func echo(nullableObject aNullableObject: Any?) -> Any? { return aNullableObject } @@ -104,7 +104,7 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { completion() } - func echoAsyncString(aString: String, completion: @escaping (String) -> Void) { + func echoAsync(string aString: String, completion: @escaping (String) -> Void) { completion(aString) } @@ -114,8 +114,8 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { } } - func callFlutterEchoString(aString: String, completion: @escaping (String) -> Void) { - flutterAPI.echoString(aString: aString) { flutterString in + func callFlutterEcho(string aString: String, completion: @escaping (String) -> Void) { + flutterAPI.echo(string: aString) { flutterString in completion(flutterString) } } From 1bdde7154cb009fa9f03203e283f76686f5c6bd8 Mon Sep 17 00:00:00 2001 From: Ailton Vieira Pinto Filho Date: Wed, 18 Jan 2023 17:38:16 -0300 Subject: [PATCH 17/26] Bump version to 7.0.0 --- packages/pigeon/CHANGELOG.md | 2 +- packages/pigeon/lib/generator_tools.dart | 2 +- packages/pigeon/mock_handler_tester/test/message.dart | 2 +- packages/pigeon/mock_handler_tester/test/test.dart | 2 +- .../com/example/alternate_language_test_plugin/CoreTests.java | 2 +- .../alternate_language_test_plugin/ios/Classes/CoreTests.gen.h | 2 +- .../alternate_language_test_plugin/ios/Classes/CoreTests.gen.m | 2 +- .../flutter_null_safe_unit_tests/lib/core_tests.gen.dart | 2 +- .../flutter_null_safe_unit_tests/lib/multiple_arity.gen.dart | 2 +- .../flutter_null_safe_unit_tests/lib/non_null_fields.gen.dart | 2 +- .../flutter_null_safe_unit_tests/lib/null_fields.gen.dart | 2 +- .../flutter_null_safe_unit_tests/lib/null_safe_pigeon.dart | 2 +- .../flutter_null_safe_unit_tests/lib/nullable_returns.gen.dart | 2 +- .../flutter_null_safe_unit_tests/lib/primitive.dart | 2 +- .../lib/src/generated/core_tests.gen.dart | 2 +- .../src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt | 2 +- .../platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift | 2 +- .../test_plugin/macos/Classes/CoreTests.gen.swift | 2 +- .../test_plugin/windows/pigeon/core_tests.gen.cpp | 2 +- .../platform_tests/test_plugin/windows/pigeon/core_tests.gen.h | 2 +- packages/pigeon/pubspec.yaml | 2 +- 21 files changed, 21 insertions(+), 21 deletions(-) diff --git a/packages/pigeon/CHANGELOG.md b/packages/pigeon/CHANGELOG.md index fc6c5e886b9..2e0abbb6c51 100644 --- a/packages/pigeon/CHANGELOG.md +++ b/packages/pigeon/CHANGELOG.md @@ -1,4 +1,4 @@ -## 6.0.4 +## 7.0.0 * Adds `@SwiftFunction` annotation for specifying custom swift function signature. diff --git a/packages/pigeon/lib/generator_tools.dart b/packages/pigeon/lib/generator_tools.dart index 4a1dcf36de3..5cfbcc54fb6 100644 --- a/packages/pigeon/lib/generator_tools.dart +++ b/packages/pigeon/lib/generator_tools.dart @@ -9,7 +9,7 @@ import 'dart:mirrors'; import 'ast.dart'; /// The current version of pigeon. This must match the version in pubspec.yaml. -const String pigeonVersion = '6.0.4'; +const String pigeonVersion = '7.0.0'; /// Read all the content from [stdin] to a String. String readStdin() { diff --git a/packages/pigeon/mock_handler_tester/test/message.dart b/packages/pigeon/mock_handler_tester/test/message.dart index cad4e02e903..8b15d220066 100644 --- a/packages/pigeon/mock_handler_tester/test/message.dart +++ b/packages/pigeon/mock_handler_tester/test/message.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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v7.0.0), 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 diff --git a/packages/pigeon/mock_handler_tester/test/test.dart b/packages/pigeon/mock_handler_tester/test/test.dart index dd1df05774f..7ca3642f0d9 100644 --- a/packages/pigeon/mock_handler_tester/test/test.dart +++ b/packages/pigeon/mock_handler_tester/test/test.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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v7.0.0), 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, unnecessary_import // ignore_for_file: avoid_relative_lib_imports diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java index a0b058a13d9..270cfd7c965 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java @@ -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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v7.0.0), do not edit directly. // See also: https://pub.dev/packages/pigeon package com.example.alternate_language_test_plugin; diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h index 1f7196621ec..f3139e267d2 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h @@ -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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v7.0.0), do not edit directly. // See also: https://pub.dev/packages/pigeon #import diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m index b92f59f74e2..772ba63b8ff 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m @@ -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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v7.0.0), do not edit directly. // See also: https://pub.dev/packages/pigeon #import "CoreTests.gen.h" 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 index 213aa4855e9..014742f5914 100644 --- 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 @@ -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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v7.0.0), 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 diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/multiple_arity.gen.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/multiple_arity.gen.dart index 32325c58162..c549d7fb022 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/multiple_arity.gen.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v7.0.0), 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 diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/non_null_fields.gen.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/non_null_fields.gen.dart index cf6d1c1f80b..83bfa88634a 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/non_null_fields.gen.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v7.0.0), 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 diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_fields.gen.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_fields.gen.dart index c3720c48a6e..688334d4dca 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_fields.gen.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v7.0.0), 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 diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_safe_pigeon.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_safe_pigeon.dart index 09af9d96844..9b49e637f1f 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_safe_pigeon.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_safe_pigeon.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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v7.0.0), 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 diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/nullable_returns.gen.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/nullable_returns.gen.dart index f02f793ef8b..2ac5d489326 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/nullable_returns.gen.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v7.0.0), 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 diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.dart index e7e9dc0527c..8475c622f7d 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v7.0.0), 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 diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart index 213aa4855e9..014742f5914 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart @@ -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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v7.0.0), 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 diff --git a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt index 858949da036..2660b6ff125 100644 --- a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt +++ b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt @@ -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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v7.0.0), do not edit directly. // See also: https://pub.dev/packages/pigeon package com.example.test_plugin diff --git a/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift b/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift index 32a59695d30..9451096a6b1 100644 --- a/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift +++ b/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift @@ -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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v7.0.0), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation diff --git a/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift b/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift index 32a59695d30..9451096a6b1 100644 --- a/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift +++ b/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift @@ -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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v7.0.0), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation diff --git a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp index 98d83ea4bbf..7cf56a549b5 100644 --- a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp +++ b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp @@ -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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v7.0.0), do not edit directly. // See also: https://pub.dev/packages/pigeon #undef _HAS_EXCEPTIONS diff --git a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h index 9bc1617e493..6517c56c18c 100644 --- a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h +++ b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h @@ -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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v7.0.0), do not edit directly. // See also: https://pub.dev/packages/pigeon #ifndef PIGEON_CORE_TESTS_GEN_H_ diff --git a/packages/pigeon/pubspec.yaml b/packages/pigeon/pubspec.yaml index 2b3dce54089..f4a883cdc3b 100644 --- a/packages/pigeon/pubspec.yaml +++ b/packages/pigeon/pubspec.yaml @@ -2,7 +2,7 @@ name: pigeon description: Code generator tool to make communication between Flutter and the host platform type-safe and easier. repository: https://github.com/flutter/packages/tree/main/packages/pigeon issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3Apigeon -version: 6.0.4 # This must match the version in lib/generator_tools.dart +version: 7.0.0 # This must match the version in lib/generator_tools.dart environment: sdk: ">=2.12.0 <3.0.0" From b13b7cac8b95b883788b1c5d9dd76bb3e90476ea Mon Sep 17 00:00:00 2001 From: tarrinneal Date: Wed, 18 Jan 2023 12:48:29 -0800 Subject: [PATCH 18/26] revert version change --- packages/pigeon/CHANGELOG.md | 2 +- packages/pigeon/lib/generator_tools.dart | 2 +- .../src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt | 2 +- .../platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift | 2 +- .../test_plugin/macos/Classes/CoreTests.gen.swift | 2 +- packages/pigeon/pubspec.yaml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/pigeon/CHANGELOG.md b/packages/pigeon/CHANGELOG.md index 2e0abbb6c51..fc6c5e886b9 100644 --- a/packages/pigeon/CHANGELOG.md +++ b/packages/pigeon/CHANGELOG.md @@ -1,4 +1,4 @@ -## 7.0.0 +## 6.0.4 * Adds `@SwiftFunction` annotation for specifying custom swift function signature. diff --git a/packages/pigeon/lib/generator_tools.dart b/packages/pigeon/lib/generator_tools.dart index 5cfbcc54fb6..4a1dcf36de3 100644 --- a/packages/pigeon/lib/generator_tools.dart +++ b/packages/pigeon/lib/generator_tools.dart @@ -9,7 +9,7 @@ import 'dart:mirrors'; import 'ast.dart'; /// The current version of pigeon. This must match the version in pubspec.yaml. -const String pigeonVersion = '7.0.0'; +const String pigeonVersion = '6.0.4'; /// Read all the content from [stdin] to a String. String readStdin() { diff --git a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt index 2660b6ff125..858949da036 100644 --- a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt +++ b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt @@ -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 (v7.0.0), do not edit directly. +// Autogenerated from Pigeon (v6.0.4), do not edit directly. // See also: https://pub.dev/packages/pigeon package com.example.test_plugin diff --git a/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift b/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift index 9451096a6b1..32a59695d30 100644 --- a/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift +++ b/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift @@ -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 (v7.0.0), do not edit directly. +// Autogenerated from Pigeon (v6.0.4), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation diff --git a/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift b/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift index 9451096a6b1..32a59695d30 100644 --- a/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift +++ b/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift @@ -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 (v7.0.0), do not edit directly. +// Autogenerated from Pigeon (v6.0.4), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation diff --git a/packages/pigeon/pubspec.yaml b/packages/pigeon/pubspec.yaml index f4a883cdc3b..2b3dce54089 100644 --- a/packages/pigeon/pubspec.yaml +++ b/packages/pigeon/pubspec.yaml @@ -2,7 +2,7 @@ name: pigeon description: Code generator tool to make communication between Flutter and the host platform type-safe and easier. repository: https://github.com/flutter/packages/tree/main/packages/pigeon issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3Apigeon -version: 7.0.0 # This must match the version in lib/generator_tools.dart +version: 6.0.4 # This must match the version in lib/generator_tools.dart environment: sdk: ">=2.12.0 <3.0.0" From ef9b5d012c0ba232bda89a889889b02ba0dd525b Mon Sep 17 00:00:00 2001 From: Ailton Vieira Pinto Filho Date: Wed, 18 Jan 2023 18:59:42 -0300 Subject: [PATCH 19/26] Improve some code of SwiftGenerator --- packages/pigeon/lib/swift_generator.dart | 78 +++++++++++------------- 1 file changed, 34 insertions(+), 44 deletions(-) diff --git a/packages/pigeon/lib/swift_generator.dart b/packages/pigeon/lib/swift_generator.dart index 5cb4aa680f0..ce604bb6dfe 100644 --- a/packages/pigeon/lib/swift_generator.dart +++ b/packages/pigeon/lib/swift_generator.dart @@ -314,12 +314,8 @@ import FlutterMacOS .map((NamedType e) => _nullsafeSwiftTypeForDartType(e.type)); final Iterable argLabels = indexMap(components.arguments, (int index, _SwiftFunctionArgument argument) { - final String? label = argument.label; - if (label == null) { - return _getArgumentName(index, argument.namedType); - } else { - return label; - } + return argument.label ?? + _getArgumentName(index, argument.namedType); }); final Iterable argNames = indexMap(func.arguments, _getSafeArgumentName); @@ -395,11 +391,7 @@ import FlutterMacOS final String? label = argument.label; final String name = argument.name; final String type = _nullsafeSwiftTypeForDartType(argument.type); - if (label != null) { - return '$label $name: $type'; - } else { - return '$name: $type'; - } + return '${label == null ? '' : '$label '}$name: $type'; }).toList(); final String returnType = method.returnType.isVoid @@ -714,9 +706,9 @@ String _nullsafeSwiftTypeForDartType(TypeDeclaration type) { class _SwiftFunctionArgument { _SwiftFunctionArgument({ required this.name, - this.label, required this.type, required this.namedType, + this.label, }); final String name; @@ -739,43 +731,41 @@ class _SwiftFunctionComponents { name: method.name, returnType: method.returnType, arguments: method.arguments - .map((NamedType e) => _SwiftFunctionArgument( - name: e.name, - type: e.type, - namedType: e, + .map((NamedType field) => _SwiftFunctionArgument( + name: field.name, + type: field.type, + namedType: field, )) .toList(), method: method, ); - } else { - final String argsCapturator = - repeat(r'(\w+):', method.arguments.length).join(); - final RegExp signatureRegex = - RegExp(r'(\w+) *\(' + argsCapturator + r'\)'); - final RegExpMatch match = - signatureRegex.firstMatch(method.swiftFunction)!; - - final Iterable customComponents = match - .groups(List.generate( - method.arguments.length, (int index) => index + 2)) - .whereType(); - - return _SwiftFunctionComponents._( - name: match.group(1)!, - returnType: method.returnType, - arguments: map2( - method.arguments, - customComponents, - (NamedType t, String u) => _SwiftFunctionArgument( - name: t.name, - label: u == t.name ? null : u, - type: t.type, - namedType: t, - ), - ).toList(), - method: method, - ); } + + final String argsExtractor = + repeat(r'(\w+):', method.arguments.length).join(); + final RegExp signatureRegex = RegExp(r'(\w+) *\(' + argsExtractor + r'\)'); + final RegExpMatch match = signatureRegex.firstMatch(method.swiftFunction)!; + + final Iterable labels = match + .groups(List.generate( + method.arguments.length, (int index) => index + 2)) + .whereType(); + + return _SwiftFunctionComponents._( + name: match.group(1)!, + returnType: method.returnType, + arguments: map2( + method.arguments, + labels, + (NamedType field, String label) => _SwiftFunctionArgument( + name: field.name, + label: label == field.name ? null : label, + type: field.type, + namedType: field, + ), + ).toList(), + method: method, + ); } final String name; From a44aa18079dcb7a5e7f69bad011e6f4d94b25a1f Mon Sep 17 00:00:00 2001 From: Ailton Vieira Pinto Filho Date: Wed, 18 Jan 2023 19:00:33 -0300 Subject: [PATCH 20/26] Bump version to 6.1.0 --- packages/pigeon/CHANGELOG.md | 2 +- packages/pigeon/lib/generator_tools.dart | 2 +- packages/pigeon/mock_handler_tester/test/message.dart | 2 +- packages/pigeon/mock_handler_tester/test/test.dart | 2 +- .../com/example/alternate_language_test_plugin/CoreTests.java | 2 +- .../alternate_language_test_plugin/ios/Classes/CoreTests.gen.h | 2 +- .../alternate_language_test_plugin/ios/Classes/CoreTests.gen.m | 2 +- .../flutter_null_safe_unit_tests/lib/core_tests.gen.dart | 2 +- .../flutter_null_safe_unit_tests/lib/multiple_arity.gen.dart | 2 +- .../flutter_null_safe_unit_tests/lib/non_null_fields.gen.dart | 2 +- .../flutter_null_safe_unit_tests/lib/null_fields.gen.dart | 2 +- .../flutter_null_safe_unit_tests/lib/null_safe_pigeon.dart | 2 +- .../flutter_null_safe_unit_tests/lib/nullable_returns.gen.dart | 2 +- .../flutter_null_safe_unit_tests/lib/primitive.dart | 2 +- .../lib/src/generated/core_tests.gen.dart | 2 +- .../src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt | 2 +- .../platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift | 2 +- .../test_plugin/macos/Classes/CoreTests.gen.swift | 2 +- .../test_plugin/windows/pigeon/core_tests.gen.cpp | 2 +- .../platform_tests/test_plugin/windows/pigeon/core_tests.gen.h | 2 +- packages/pigeon/pubspec.yaml | 2 +- 21 files changed, 21 insertions(+), 21 deletions(-) diff --git a/packages/pigeon/CHANGELOG.md b/packages/pigeon/CHANGELOG.md index fc6c5e886b9..09a0c16b2bc 100644 --- a/packages/pigeon/CHANGELOG.md +++ b/packages/pigeon/CHANGELOG.md @@ -1,4 +1,4 @@ -## 6.0.4 +## 6.1.0 * Adds `@SwiftFunction` annotation for specifying custom swift function signature. diff --git a/packages/pigeon/lib/generator_tools.dart b/packages/pigeon/lib/generator_tools.dart index 4a1dcf36de3..99d63d1b740 100644 --- a/packages/pigeon/lib/generator_tools.dart +++ b/packages/pigeon/lib/generator_tools.dart @@ -9,7 +9,7 @@ import 'dart:mirrors'; import 'ast.dart'; /// The current version of pigeon. This must match the version in pubspec.yaml. -const String pigeonVersion = '6.0.4'; +const String pigeonVersion = '6.1.0'; /// Read all the content from [stdin] to a String. String readStdin() { diff --git a/packages/pigeon/mock_handler_tester/test/message.dart b/packages/pigeon/mock_handler_tester/test/message.dart index cad4e02e903..ee35a2e1b2c 100644 --- a/packages/pigeon/mock_handler_tester/test/message.dart +++ b/packages/pigeon/mock_handler_tester/test/message.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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v6.1.0), 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 diff --git a/packages/pigeon/mock_handler_tester/test/test.dart b/packages/pigeon/mock_handler_tester/test/test.dart index dd1df05774f..c9f0ce567cf 100644 --- a/packages/pigeon/mock_handler_tester/test/test.dart +++ b/packages/pigeon/mock_handler_tester/test/test.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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v6.1.0), 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, unnecessary_import // ignore_for_file: avoid_relative_lib_imports diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java index a0b058a13d9..fa08105927d 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java @@ -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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v6.1.0), do not edit directly. // See also: https://pub.dev/packages/pigeon package com.example.alternate_language_test_plugin; diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h index 1f7196621ec..3f3c180e558 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h @@ -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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v6.1.0), do not edit directly. // See also: https://pub.dev/packages/pigeon #import diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m index b92f59f74e2..0042691ffe2 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m @@ -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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v6.1.0), do not edit directly. // See also: https://pub.dev/packages/pigeon #import "CoreTests.gen.h" 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 index 213aa4855e9..dbe1e895f20 100644 --- 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 @@ -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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v6.1.0), 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 diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/multiple_arity.gen.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/multiple_arity.gen.dart index 32325c58162..df538c8f040 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/multiple_arity.gen.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v6.1.0), 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 diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/non_null_fields.gen.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/non_null_fields.gen.dart index cf6d1c1f80b..d4cf9299895 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/non_null_fields.gen.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v6.1.0), 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 diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_fields.gen.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_fields.gen.dart index c3720c48a6e..4c9301a6dbe 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_fields.gen.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v6.1.0), 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 diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_safe_pigeon.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_safe_pigeon.dart index 09af9d96844..98b303fa684 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_safe_pigeon.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_safe_pigeon.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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v6.1.0), 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 diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/nullable_returns.gen.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/nullable_returns.gen.dart index f02f793ef8b..13d280d6b7c 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/nullable_returns.gen.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v6.1.0), 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 diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.dart index e7e9dc0527c..6aa81a36074 100644 --- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.dart +++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v6.1.0), 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 diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart index 213aa4855e9..dbe1e895f20 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart @@ -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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v6.1.0), 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 diff --git a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt index 858949da036..82b09b77dd2 100644 --- a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt +++ b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt @@ -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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v6.1.0), do not edit directly. // See also: https://pub.dev/packages/pigeon package com.example.test_plugin diff --git a/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift b/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift index 32a59695d30..f8113a9af46 100644 --- a/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift +++ b/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift @@ -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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v6.1.0), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation diff --git a/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift b/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift index 32a59695d30..f8113a9af46 100644 --- a/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift +++ b/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift @@ -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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v6.1.0), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation diff --git a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp index 98d83ea4bbf..67ac536b80c 100644 --- a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp +++ b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp @@ -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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v6.1.0), do not edit directly. // See also: https://pub.dev/packages/pigeon #undef _HAS_EXCEPTIONS diff --git a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h index 9bc1617e493..bce0c84720b 100644 --- a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h +++ b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h @@ -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 (v6.0.4), do not edit directly. +// Autogenerated from Pigeon (v6.1.0), do not edit directly. // See also: https://pub.dev/packages/pigeon #ifndef PIGEON_CORE_TESTS_GEN_H_ diff --git a/packages/pigeon/pubspec.yaml b/packages/pigeon/pubspec.yaml index 2b3dce54089..95da9ae3c98 100644 --- a/packages/pigeon/pubspec.yaml +++ b/packages/pigeon/pubspec.yaml @@ -2,7 +2,7 @@ name: pigeon description: Code generator tool to make communication between Flutter and the host platform type-safe and easier. repository: https://github.com/flutter/packages/tree/main/packages/pigeon issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3Apigeon -version: 6.0.4 # This must match the version in lib/generator_tools.dart +version: 6.1.0 # This must match the version in lib/generator_tools.dart environment: sdk: ">=2.12.0 <3.0.0" From 5aa21979d30ec1e02ca85d8d1d38745509e4f327 Mon Sep 17 00:00:00 2001 From: Ailton Vieira Pinto Filho Date: Wed, 18 Jan 2023 20:37:08 -0300 Subject: [PATCH 21/26] Improve echo functions for Swift --- packages/pigeon/lib/swift_generator.dart | 7 +- packages/pigeon/pigeons/core_tests.dart | 65 ++++++------ .../CoreTests.java | 2 +- .../ios/Classes/CoreTests.gen.h | 2 +- .../ios/Classes/CoreTests.gen.m | 2 +- .../lib/integration_tests.dart | 2 +- .../lib/src/generated/core_tests.gen.dart | 6 +- .../com/example/test_plugin/CoreTests.gen.kt | 4 +- .../ios/RunnerTests/AllDatatypesTests.swift | 4 +- .../xcschemes/RunnerTests.xcscheme | 53 ++++++++++ .../ios/Classes/CoreTests.gen.swift | 98 +++++++++---------- .../test_plugin/ios/Classes/TestPlugin.swift | 34 +++---- .../macos/Classes/CoreTests.gen.swift | 98 +++++++++---------- .../macos/Classes/TestPlugin.swift | 34 +++---- .../windows/pigeon/core_tests.gen.cpp | 11 ++- .../windows/pigeon/core_tests.gen.h | 4 +- 16 files changed, 242 insertions(+), 184 deletions(-) create mode 100644 packages/pigeon/platform_tests/test_plugin/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/RunnerTests.xcscheme diff --git a/packages/pigeon/lib/swift_generator.dart b/packages/pigeon/lib/swift_generator.dart index ce604bb6dfe..70c26f70cf6 100644 --- a/packages/pigeon/lib/swift_generator.dart +++ b/packages/pigeon/lib/swift_generator.dart @@ -457,7 +457,12 @@ import FlutterMacOS final String argIndex = 'args[$index]'; indent.writeln( 'let $argName = ${_castForceUnwrap(argIndex, arg.type, root)}'); - methodArgument.add('${arg.label ?? arg.name}: $argName'); + + if (arg.label == '_') { + methodArgument.add(argName); + } else { + methodArgument.add('${arg.label ?? arg.name}: $argName'); + } }); } final String call = diff --git a/packages/pigeon/pigeons/core_tests.dart b/packages/pigeon/pigeons/core_tests.dart index a5567df446d..6e80422aa34 100644 --- a/packages/pigeon/pigeons/core_tests.dart +++ b/packages/pigeon/pigeons/core_tests.dart @@ -96,12 +96,12 @@ abstract class HostIntegrationCoreApi { /// Returns the passed object, to test serialization and deserialization. @ObjCSelector('echoAllTypes:') - @SwiftFunction('echo(allTypes:)') + @SwiftFunction('echo(_:)') AllTypes echoAllTypes(AllTypes everything); /// Returns the passed object, to test serialization and deserialization. @ObjCSelector('echoAllNullableTypes:') - @SwiftFunction('echo(allNullableTypes:)') + @SwiftFunction('echo(_:)') AllNullableTypes? echoAllNullableTypes(AllNullableTypes? everything); /// Returns an error, to test error handling. @@ -109,32 +109,32 @@ abstract class HostIntegrationCoreApi { /// Returns passed in int. @ObjCSelector('echoInt:') - @SwiftFunction('echo(int:)') + @SwiftFunction('echo(_:)') int echoInt(int anInt); /// Returns passed in double. @ObjCSelector('echoDouble:') - @SwiftFunction('echo(double:)') + @SwiftFunction('echo(_:)') double echoDouble(double aDouble); /// Returns the passed in boolean. @ObjCSelector('echoBool:') - @SwiftFunction('echo(bool:)') + @SwiftFunction('echo(_:)') bool echoBool(bool aBool); /// Returns the passed in string. @ObjCSelector('echoString:') - @SwiftFunction('echo(string:)') + @SwiftFunction('echo(_:)') String echoString(String aString); /// Returns the passed in Uint8List. @ObjCSelector('echoUint8List:') - @SwiftFunction('echo(uint8List:)') + @SwiftFunction('echo(_:)') Uint8List echoUint8List(Uint8List aUint8List); /// Returns the passed in generic Object. @ObjCSelector('echoObject:') - @SwiftFunction('echo(object:)') + @SwiftFunction('echo(_:)') Object echoObject(Object anObject); // ========== Syncronous nullable method tests ========== @@ -159,32 +159,32 @@ abstract class HostIntegrationCoreApi { /// Returns passed in int. @ObjCSelector('echoNullableInt:') - @SwiftFunction('echo(nullableInt:)') + @SwiftFunction('echo(_:)') int? echoNullableInt(int? aNullableInt); /// Returns passed in double. @ObjCSelector('echoNullableDouble:') - @SwiftFunction('echo(nullableDouble:)') + @SwiftFunction('echo(_:)') double? echoNullableDouble(double? aNullableDouble); /// Returns the passed in boolean. @ObjCSelector('echoNullableBool:') - @SwiftFunction('echo(nullableBool:)') + @SwiftFunction('echo(_:)') bool? echoNullableBool(bool? aNullableBool); /// Returns the passed in string. @ObjCSelector('echoNullableString:') - @SwiftFunction('echo(nullableString:)') + @SwiftFunction('echo(_:)') String? echoNullableString(String? aNullableString); /// Returns the passed in Uint8List. @ObjCSelector('echoNullableUint8List:') - @SwiftFunction('echo(nullableUint8List:)') + @SwiftFunction('echo(_:)') Uint8List? echoNullableUint8List(Uint8List? aNullableUint8List); /// Returns the passed in generic Object. @ObjCSelector('echoNullableObject:') - @SwiftFunction('echo(nullableObject:)') + @SwiftFunction('echo(_:)') Object? echoNullableObject(Object? aNullableObject); // ========== Asyncronous method tests ========== @@ -197,7 +197,7 @@ abstract class HostIntegrationCoreApi { /// Returns the passed string asynchronously. @async @ObjCSelector('echoAsyncString:') - @SwiftFunction('echoAsync(string:)') + @SwiftFunction('echoAsync(_:)') String echoAsyncString(String aString); // ========== Flutter API test wrappers ========== @@ -207,7 +207,7 @@ abstract class HostIntegrationCoreApi { @async @ObjCSelector('callFlutterEchoString:') - @SwiftFunction('callFlutterEcho(string:)') + @SwiftFunction('callFlutterEcho(_:)') String callFlutterEchoString(String aString); // TODO(stuartmorgan): Add callFlutterEchoAllTypes and the associated test @@ -228,12 +228,12 @@ abstract class FlutterIntegrationCoreApi { /// Returns the passed object, to test serialization and deserialization. @ObjCSelector('echoAllTypes:') - @SwiftFunction('echo(allTypes:)') + @SwiftFunction('echo(_:)') AllTypes echoAllTypes(AllTypes everything); /// Returns the passed object, to test serialization and deserialization. @ObjCSelector('echoAllNullableTypes:') - @SwiftFunction('echo(allNullableTypes:)') + @SwiftFunction('echo(_:)') AllNullableTypes echoAllNullableTypes(AllNullableTypes everything); /// Returns passed in arguments of multiple types. @@ -248,74 +248,75 @@ abstract class FlutterIntegrationCoreApi { /// Returns the passed boolean, to test serialization and deserialization. @ObjCSelector('echoBool:') - @SwiftFunction('echo(bool:)') + @SwiftFunction('echo(_:)') bool echoBool(bool aBool); /// Returns the passed int, to test serialization and deserialization. @ObjCSelector('echoInt:') - @SwiftFunction('echo(int:)') + @SwiftFunction('echo(_:)') int echoInt(int anInt); /// Returns the passed double, to test serialization and deserialization. @ObjCSelector('echoDouble:') - @SwiftFunction('echo(double:)') + @SwiftFunction('echo(_:)') double echoDouble(double aDouble); /// Returns the passed string, to test serialization and deserialization. @ObjCSelector('echoString:') - @SwiftFunction('echo(string:)') + @SwiftFunction('echo(_:)') String echoString(String aString); /// Returns the passed byte list, to test serialization and deserialization. @ObjCSelector('echoUint8List:') - @SwiftFunction('echo(uint8List:)') + @SwiftFunction('echo(_:)') Uint8List echoUint8List(Uint8List aList); /// Returns the passed list, to test serialization and deserialization. @ObjCSelector('echoList:') - @SwiftFunction('echo(list:)') + @SwiftFunction('echo(_:)') List echoList(List aList); /// Returns the passed map, to test serialization and deserialization. @ObjCSelector('echoMap:') + @SwiftFunction('echo(_:)') Map echoMap(Map aMap); // ========== Nullable argument/return type tests ========== /// Returns the passed boolean, to test serialization and deserialization. @ObjCSelector('echoNullableBool:') - @SwiftFunction('echo(nullableBool:)') + @SwiftFunction('echo(_:)') bool? echoNullableBool(bool? aBool); /// Returns the passed int, to test serialization and deserialization. @ObjCSelector('echoNullableInt:') - @SwiftFunction('echo(nullableInt:)') + @SwiftFunction('echo(_:)') int? echoNullableInt(int? anInt); /// Returns the passed double, to test serialization and deserialization. @ObjCSelector('echoNullableDouble:') - @SwiftFunction('echo(nullableDouble:)') + @SwiftFunction('echo(_:)') double? echoNullableDouble(double? aDouble); /// Returns the passed string, to test serialization and deserialization. @ObjCSelector('echoNullableString:') - @SwiftFunction('echo(nullableString:)') + @SwiftFunction('echo(_:)') String? echoNullableString(String? aString); /// Returns the passed byte list, to test serialization and deserialization. @ObjCSelector('echoNullableUint8List:') - @SwiftFunction('echo(nullableUint8List:)') + @SwiftFunction('echo(_:)') Uint8List? echoNullableUint8List(Uint8List? aList); /// Returns the passed list, to test serialization and deserialization. @ObjCSelector('echoNullableList:') - @SwiftFunction('echo(nullableList:)') + @SwiftFunction('echo(_:)') List? echoNullableList(List? aList); /// Returns the passed map, to test serialization and deserialization. @ObjCSelector('echoNullableMap:') - @SwiftFunction('echo(nullableMap:)') - Map echoNullableMap(Map aMap); + @SwiftFunction('echo(_:)') + Map? echoNullableMap(Map? aMap); } /// An API that can be implemented for minimal, compile-only tests. diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java index fa08105927d..43573e24472 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java @@ -1823,7 +1823,7 @@ public void echoNullableList(@Nullable List aListArg, Reply } /** Returns the passed map, to test serialization and deserialization. */ public void echoNullableMap( - @NonNull Map aMapArg, Reply> callback) { + @Nullable Map aMapArg, Reply> callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h index 3f3c180e558..1287eda9918 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h @@ -254,7 +254,7 @@ NSObject *FlutterIntegrationCoreApiGetCodec(void); - (void)echoNullableList:(nullable NSArray *)aList completion:(void (^)(NSArray *_Nullable, NSError *_Nullable))completion; /// Returns the passed map, to test serialization and deserialization. -- (void)echoNullableMap:(NSDictionary *)aMap +- (void)echoNullableMap:(nullable NSDictionary *)aMap completion: (void (^)(NSDictionary *_Nullable, NSError *_Nullable))completion; @end diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m index 0042691ffe2..243d02b37fe 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m @@ -1067,7 +1067,7 @@ - (void)echoNullableList:(nullable NSArray *)arg_aList completion(output, nil); }]; } -- (void)echoNullableMap:(NSDictionary *)arg_aMap +- (void)echoNullableMap:(nullable NSDictionary *)arg_aMap completion: (void (^)(NSDictionary *_Nullable, NSError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/integration_tests.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/integration_tests.dart index a47622b3c5d..60ed31c2e55 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/integration_tests.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/integration_tests.dart @@ -587,7 +587,7 @@ class _FlutterApiTestImplementation implements FlutterIntegrationCoreApi { List? echoNullableList(List? aList) => aList; @override - Map echoNullableMap(Map aMap) => aMap; + Map? echoNullableMap(Map? aMap) => aMap; @override String? echoNullableString(String? aString) => aString; diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart index dbe1e895f20..9770840fc3a 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/core_tests.gen.dart @@ -938,7 +938,7 @@ abstract class FlutterIntegrationCoreApi { List? echoNullableList(List? aList); /// Returns the passed map, to test serialization and deserialization. - Map echoNullableMap(Map aMap); + Map? echoNullableMap(Map? aMap); static void setup(FlutterIntegrationCoreApi? api, {BinaryMessenger? binaryMessenger}) { @@ -1274,9 +1274,7 @@ abstract class FlutterIntegrationCoreApi { final List args = (message as List?)!; final Map? arg_aMap = (args[0] as Map?)?.cast(); - assert(arg_aMap != null, - 'Argument for dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap was null, expected non-null Map.'); - final Map output = api.echoNullableMap(arg_aMap!); + final Map? output = api.echoNullableMap(arg_aMap); return output; }); } diff --git a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt index 82b09b77dd2..e621e7d5bec 100644 --- a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt +++ b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt @@ -899,10 +899,10 @@ class FlutterIntegrationCoreApi(private val binaryMessenger: BinaryMessenger) { } } /** Returns the passed map, to test serialization and deserialization. */ - fun echoNullableMap(aMapArg: Map, callback: (Map) -> Unit) { + fun echoNullableMap(aMapArg: Map?, callback: (Map?) -> Unit) { val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap", codec) channel.send(listOf(aMapArg)) { - val result = it as Map + val result = it as? Map? callback(result) } } diff --git a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/AllDatatypesTests.swift b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/AllDatatypesTests.swift index 9bdd81a9bf5..b2b81233c06 100644 --- a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/AllDatatypesTests.swift +++ b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/AllDatatypesTests.swift @@ -15,7 +15,7 @@ class AllDatatypesTests: XCTestCase { let expectation = XCTestExpectation(description: "callback") - api.echo(allNullableTypes: everything) { result in + api.echo(everything) { result in XCTAssertNil(result.aNullableBool) XCTAssertNil(result.aNullableInt) XCTAssertNil(result.aNullableDouble) @@ -57,7 +57,7 @@ class AllDatatypesTests: XCTestCase { let expectation = XCTestExpectation(description: "callback") - api.echo(allNullableTypes: everything) { result in + api.echo(everything) { result in XCTAssertEqual(result.aNullableBool, everything.aNullableBool) XCTAssertEqual(result.aNullableInt, everything.aNullableInt) XCTAssertEqual(result.aNullableDouble, everything.aNullableDouble) diff --git a/packages/pigeon/platform_tests/test_plugin/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/RunnerTests.xcscheme b/packages/pigeon/platform_tests/test_plugin/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/RunnerTests.xcscheme new file mode 100644 index 00000000000..720178f5015 --- /dev/null +++ b/packages/pigeon/platform_tests/test_plugin/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/RunnerTests.xcscheme @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift b/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift index f8113a9af46..0fd5f189e2e 100644 --- a/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift +++ b/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift @@ -238,23 +238,23 @@ protocol HostIntegrationCoreApi { /// test basic calling. func noop() /// Returns the passed object, to test serialization and deserialization. - func echo(allTypes everything: AllTypes) -> AllTypes + func echo(_ everything: AllTypes) -> AllTypes /// Returns the passed object, to test serialization and deserialization. - func echo(allNullableTypes everything: AllNullableTypes?) -> AllNullableTypes? + func echo(_ everything: AllNullableTypes?) -> AllNullableTypes? /// Returns an error, to test error handling. func throwError() /// Returns passed in int. - func echo(int anInt: Int32) -> Int32 + func echo(_ anInt: Int32) -> Int32 /// Returns passed in double. - func echo(double aDouble: Double) -> Double + func echo(_ aDouble: Double) -> Double /// Returns the passed in boolean. - func echo(bool aBool: Bool) -> Bool + func echo(_ aBool: Bool) -> Bool /// Returns the passed in string. - func echo(string aString: String) -> String + func echo(_ aString: String) -> String /// Returns the passed in Uint8List. - func echo(uint8List aUint8List: FlutterStandardTypedData) -> FlutterStandardTypedData + func echo(_ aUint8List: FlutterStandardTypedData) -> FlutterStandardTypedData /// Returns the passed in generic Object. - func echo(object anObject: Any) -> Any + func echo(_ anObject: Any) -> Any /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. func extractNestedNullableString(from wrapper: AllNullableTypesWrapper) -> String? @@ -264,24 +264,24 @@ protocol HostIntegrationCoreApi { /// Returns passed in arguments of multiple types. func sendMultipleNullableTypes(aBool aNullableBool: Bool?, anInt aNullableInt: Int32?, aString aNullableString: String?) -> AllNullableTypes /// Returns passed in int. - func echo(nullableInt aNullableInt: Int32?) -> Int32? + func echo(_ aNullableInt: Int32?) -> Int32? /// Returns passed in double. - func echo(nullableDouble aNullableDouble: Double?) -> Double? + func echo(_ aNullableDouble: Double?) -> Double? /// Returns the passed in boolean. - func echo(nullableBool aNullableBool: Bool?) -> Bool? + func echo(_ aNullableBool: Bool?) -> Bool? /// Returns the passed in string. - func echo(nullableString aNullableString: String?) -> String? + func echo(_ aNullableString: String?) -> String? /// Returns the passed in Uint8List. - func echo(nullableUint8List aNullableUint8List: FlutterStandardTypedData?) -> FlutterStandardTypedData? + func echo(_ aNullableUint8List: FlutterStandardTypedData?) -> FlutterStandardTypedData? /// Returns the passed in generic Object. - func echo(nullableObject aNullableObject: Any?) -> Any? + func echo(_ aNullableObject: Any?) -> Any? /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. func noopAsync(completion: @escaping () -> Void) /// Returns the passed string asynchronously. - func echoAsync(string aString: String, completion: @escaping (String) -> Void) + func echoAsync(_ aString: String, completion: @escaping (String) -> Void) func callFlutterNoop(completion: @escaping () -> Void) - func callFlutterEcho(string aString: String, completion: @escaping (String) -> Void) + func callFlutterEcho(_ aString: String, completion: @escaping (String) -> Void) } /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. @@ -307,7 +307,7 @@ class HostIntegrationCoreApiSetup { echoAllTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let everythingArg = args[0] as! AllTypes - let result = api.echo(allTypes: everythingArg) + let result = api.echo(everythingArg) reply(wrapResult(result)) } } else { @@ -319,7 +319,7 @@ class HostIntegrationCoreApiSetup { echoAllNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let everythingArg = args[0] as? AllNullableTypes - let result = api.echo(allNullableTypes: everythingArg) + let result = api.echo(everythingArg) reply(wrapResult(result)) } } else { @@ -341,7 +341,7 @@ class HostIntegrationCoreApiSetup { echoIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anIntArg = args[0] as! Int32 - let result = api.echo(int: anIntArg) + let result = api.echo(anIntArg) reply(wrapResult(result)) } } else { @@ -353,7 +353,7 @@ class HostIntegrationCoreApiSetup { echoDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aDoubleArg = args[0] as! Double - let result = api.echo(double: aDoubleArg) + let result = api.echo(aDoubleArg) reply(wrapResult(result)) } } else { @@ -365,7 +365,7 @@ class HostIntegrationCoreApiSetup { echoBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aBoolArg = args[0] as! Bool - let result = api.echo(bool: aBoolArg) + let result = api.echo(aBoolArg) reply(wrapResult(result)) } } else { @@ -377,7 +377,7 @@ class HostIntegrationCoreApiSetup { echoStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg = args[0] as! String - let result = api.echo(string: aStringArg) + let result = api.echo(aStringArg) reply(wrapResult(result)) } } else { @@ -389,7 +389,7 @@ class HostIntegrationCoreApiSetup { echoUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aUint8ListArg = args[0] as! FlutterStandardTypedData - let result = api.echo(uint8List: aUint8ListArg) + let result = api.echo(aUint8ListArg) reply(wrapResult(result)) } } else { @@ -401,7 +401,7 @@ class HostIntegrationCoreApiSetup { echoObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anObjectArg = args[0]! - let result = api.echo(object: anObjectArg) + let result = api.echo(anObjectArg) reply(wrapResult(result)) } } else { @@ -453,7 +453,7 @@ class HostIntegrationCoreApiSetup { echoNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableIntArg = args[0] as? Int32 - let result = api.echo(nullableInt: aNullableIntArg) + let result = api.echo(aNullableIntArg) reply(wrapResult(result)) } } else { @@ -465,7 +465,7 @@ class HostIntegrationCoreApiSetup { echoNullableDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableDoubleArg = args[0] as? Double - let result = api.echo(nullableDouble: aNullableDoubleArg) + let result = api.echo(aNullableDoubleArg) reply(wrapResult(result)) } } else { @@ -477,7 +477,7 @@ class HostIntegrationCoreApiSetup { echoNullableBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableBoolArg = args[0] as? Bool - let result = api.echo(nullableBool: aNullableBoolArg) + let result = api.echo(aNullableBoolArg) reply(wrapResult(result)) } } else { @@ -489,7 +489,7 @@ class HostIntegrationCoreApiSetup { echoNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableStringArg = args[0] as? String - let result = api.echo(nullableString: aNullableStringArg) + let result = api.echo(aNullableStringArg) reply(wrapResult(result)) } } else { @@ -501,7 +501,7 @@ class HostIntegrationCoreApiSetup { echoNullableUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableUint8ListArg = args[0] as? FlutterStandardTypedData - let result = api.echo(nullableUint8List: aNullableUint8ListArg) + let result = api.echo(aNullableUint8ListArg) reply(wrapResult(result)) } } else { @@ -513,7 +513,7 @@ class HostIntegrationCoreApiSetup { echoNullableObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableObjectArg = args[0] - let result = api.echo(nullableObject: aNullableObjectArg) + let result = api.echo(aNullableObjectArg) reply(wrapResult(result)) } } else { @@ -537,7 +537,7 @@ class HostIntegrationCoreApiSetup { echoAsyncStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg = args[0] as! String - api.echoAsync(string: aStringArg) { result in + api.echoAsync(aStringArg) { result in reply(wrapResult(result)) } } @@ -559,7 +559,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg = args[0] as! String - api.callFlutterEcho(string: aStringArg) { result in + api.callFlutterEcho(aStringArg) { result in reply(wrapResult(result)) } } @@ -635,7 +635,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed object, to test serialization and deserialization. - func echo(allTypes everythingArg: AllTypes, completion: @escaping (AllTypes) -> Void) { + func echo(_ everythingArg: AllTypes, completion: @escaping (AllTypes) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllTypes", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([everythingArg] as [Any?]) { response in let result = response as! AllTypes @@ -643,7 +643,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed object, to test serialization and deserialization. - func echo(allNullableTypes everythingArg: AllNullableTypes, completion: @escaping (AllNullableTypes) -> Void) { + func echo(_ everythingArg: AllNullableTypes, completion: @escaping (AllNullableTypes) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([everythingArg] as [Any?]) { response in let result = response as! AllNullableTypes @@ -661,7 +661,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed boolean, to test serialization and deserialization. - func echo(bool aBoolArg: Bool, completion: @escaping (Bool) -> Void) { + func echo(_ aBoolArg: Bool, completion: @escaping (Bool) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoBool", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aBoolArg] as [Any?]) { response in let result = response as! Bool @@ -669,7 +669,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed int, to test serialization and deserialization. - func echo(int anIntArg: Int32, completion: @escaping (Int32) -> Void) { + func echo(_ anIntArg: Int32, completion: @escaping (Int32) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoInt", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anIntArg] as [Any?]) { response in let result = response as! Int32 @@ -677,7 +677,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed double, to test serialization and deserialization. - func echo(double aDoubleArg: Double, completion: @escaping (Double) -> Void) { + func echo(_ aDoubleArg: Double, completion: @escaping (Double) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoDouble", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aDoubleArg] as [Any?]) { response in let result = response as! Double @@ -685,7 +685,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed string, to test serialization and deserialization. - func echo(string aStringArg: String, completion: @escaping (String) -> Void) { + func echo(_ aStringArg: String, completion: @escaping (String) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoString", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in let result = response as! String @@ -693,7 +693,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed byte list, to test serialization and deserialization. - func echo(uint8List aListArg: FlutterStandardTypedData, completion: @escaping (FlutterStandardTypedData) -> Void) { + func echo(_ aListArg: FlutterStandardTypedData, completion: @escaping (FlutterStandardTypedData) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoUint8List", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in let result = response as! FlutterStandardTypedData @@ -701,7 +701,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed list, to test serialization and deserialization. - func echo(list aListArg: [Any?], completion: @escaping ([Any?]) -> Void) { + func echo(_ aListArg: [Any?], completion: @escaping ([Any?]) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoList", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in let result = response as! [Any?] @@ -709,7 +709,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed map, to test serialization and deserialization. - func echoMap(aMap aMapArg: [String?: Any?], completion: @escaping ([String?: Any?]) -> Void) { + func echo(_ aMapArg: [String?: Any?], completion: @escaping ([String?: Any?]) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoMap", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aMapArg] as [Any?]) { response in let result = response as! [String?: Any?] @@ -717,7 +717,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed boolean, to test serialization and deserialization. - func echo(nullableBool aBoolArg: Bool?, completion: @escaping (Bool?) -> Void) { + func echo(_ aBoolArg: Bool?, completion: @escaping (Bool?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableBool", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aBoolArg] as [Any?]) { response in let result = response as? Bool @@ -725,7 +725,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed int, to test serialization and deserialization. - func echo(nullableInt anIntArg: Int32?, completion: @escaping (Int32?) -> Void) { + func echo(_ anIntArg: Int32?, completion: @escaping (Int32?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableInt", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anIntArg] as [Any?]) { response in let result = response as? Int32 @@ -733,7 +733,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed double, to test serialization and deserialization. - func echo(nullableDouble aDoubleArg: Double?, completion: @escaping (Double?) -> Void) { + func echo(_ aDoubleArg: Double?, completion: @escaping (Double?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableDouble", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aDoubleArg] as [Any?]) { response in let result = response as? Double @@ -741,7 +741,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed string, to test serialization and deserialization. - func echo(nullableString aStringArg: String?, completion: @escaping (String?) -> Void) { + func echo(_ aStringArg: String?, completion: @escaping (String?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableString", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in let result = response as? String @@ -749,7 +749,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed byte list, to test serialization and deserialization. - func echo(nullableUint8List aListArg: FlutterStandardTypedData?, completion: @escaping (FlutterStandardTypedData?) -> Void) { + func echo(_ aListArg: FlutterStandardTypedData?, completion: @escaping (FlutterStandardTypedData?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableUint8List", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in let result = response as? FlutterStandardTypedData @@ -757,7 +757,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed list, to test serialization and deserialization. - func echo(nullableList aListArg: [Any?]?, completion: @escaping ([Any?]?) -> Void) { + func echo(_ aListArg: [Any?]?, completion: @escaping ([Any?]?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in let result = response as? [Any?] @@ -765,10 +765,10 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed map, to test serialization and deserialization. - func echo(nullableMap aMapArg: [String?: Any?], completion: @escaping ([String?: Any?]) -> Void) { + func echo(_ aMapArg: [String?: Any?]?, completion: @escaping ([String?: Any?]?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aMapArg] as [Any?]) { response in - let result = response as! [String?: Any?] + let result = response as? [String?: Any?] completion(result) } } diff --git a/packages/pigeon/platform_tests/test_plugin/ios/Classes/TestPlugin.swift b/packages/pigeon/platform_tests/test_plugin/ios/Classes/TestPlugin.swift index beb3f74ecca..9c900d76873 100644 --- a/packages/pigeon/platform_tests/test_plugin/ios/Classes/TestPlugin.swift +++ b/packages/pigeon/platform_tests/test_plugin/ios/Classes/TestPlugin.swift @@ -26,11 +26,11 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { func noop() { } - func echo(allTypes everything: AllTypes) -> AllTypes { + func echo(_ everything: AllTypes) -> AllTypes { return everything } - func echo(allNullableTypes everything: AllNullableTypes?) -> AllNullableTypes? { + func echo(_ everything: AllNullableTypes?) -> AllNullableTypes? { return everything } @@ -39,27 +39,27 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { // https://github.com/flutter/flutter/issues/112483 } - func echo(int anInt: Int32) -> Int32 { + func echo(_ anInt: Int32) -> Int32 { return anInt } - func echo(double aDouble: Double) -> Double { + func echo(_ aDouble: Double) -> Double { return aDouble } - func echo(bool aBool: Bool) -> Bool { + func echo(_ aBool: Bool) -> Bool { return aBool } - func echo(string aString: String) -> String { + func echo(_ aString: String) -> String { return aString } - func echo(uint8List aUint8List: FlutterStandardTypedData) -> FlutterStandardTypedData { + func echo(_ aUint8List: FlutterStandardTypedData) -> FlutterStandardTypedData { return aUint8List } - func echo(object anObject: Any) -> Any { + func echo(_ anObject: Any) -> Any { return anObject } @@ -76,27 +76,27 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { return someThings } - func echo(nullableInt aNullableInt: Int32?) -> Int32? { + func echo(_ aNullableInt: Int32?) -> Int32? { return aNullableInt } - func echo(nullableDouble aNullableDouble: Double?) -> Double? { + func echo(_ aNullableDouble: Double?) -> Double? { return aNullableDouble } - func echo(nullableBool aNullableBool: Bool?) -> Bool? { + func echo(_ aNullableBool: Bool?) -> Bool? { return aNullableBool } - func echo(nullableString aNullableString: String?) -> String? { + func echo(_ aNullableString: String?) -> String? { return aNullableString } - func echo(nullableUint8List aNullableUint8List: FlutterStandardTypedData?) -> FlutterStandardTypedData? { + func echo(_ aNullableUint8List: FlutterStandardTypedData?) -> FlutterStandardTypedData? { return aNullableUint8List } - func echo(nullableObject aNullableObject: Any?) -> Any? { + func echo(_ aNullableObject: Any?) -> Any? { return aNullableObject } @@ -104,7 +104,7 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { completion() } - func echoAsync(string aString: String, completion: @escaping (String) -> Void) { + func echoAsync(_ aString: String, completion: @escaping (String) -> Void) { completion(aString) } @@ -114,8 +114,8 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { } } - func callFlutterEcho(string aString: String, completion: @escaping (String) -> Void) { - flutterAPI.echo(string: aString) { flutterString in + func callFlutterEcho(_ aString: String, completion: @escaping (String) -> Void) { + flutterAPI.echo(aString) { flutterString in completion(flutterString) } } diff --git a/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift b/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift index f8113a9af46..0fd5f189e2e 100644 --- a/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift +++ b/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift @@ -238,23 +238,23 @@ protocol HostIntegrationCoreApi { /// test basic calling. func noop() /// Returns the passed object, to test serialization and deserialization. - func echo(allTypes everything: AllTypes) -> AllTypes + func echo(_ everything: AllTypes) -> AllTypes /// Returns the passed object, to test serialization and deserialization. - func echo(allNullableTypes everything: AllNullableTypes?) -> AllNullableTypes? + func echo(_ everything: AllNullableTypes?) -> AllNullableTypes? /// Returns an error, to test error handling. func throwError() /// Returns passed in int. - func echo(int anInt: Int32) -> Int32 + func echo(_ anInt: Int32) -> Int32 /// Returns passed in double. - func echo(double aDouble: Double) -> Double + func echo(_ aDouble: Double) -> Double /// Returns the passed in boolean. - func echo(bool aBool: Bool) -> Bool + func echo(_ aBool: Bool) -> Bool /// Returns the passed in string. - func echo(string aString: String) -> String + func echo(_ aString: String) -> String /// Returns the passed in Uint8List. - func echo(uint8List aUint8List: FlutterStandardTypedData) -> FlutterStandardTypedData + func echo(_ aUint8List: FlutterStandardTypedData) -> FlutterStandardTypedData /// Returns the passed in generic Object. - func echo(object anObject: Any) -> Any + func echo(_ anObject: Any) -> Any /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. func extractNestedNullableString(from wrapper: AllNullableTypesWrapper) -> String? @@ -264,24 +264,24 @@ protocol HostIntegrationCoreApi { /// Returns passed in arguments of multiple types. func sendMultipleNullableTypes(aBool aNullableBool: Bool?, anInt aNullableInt: Int32?, aString aNullableString: String?) -> AllNullableTypes /// Returns passed in int. - func echo(nullableInt aNullableInt: Int32?) -> Int32? + func echo(_ aNullableInt: Int32?) -> Int32? /// Returns passed in double. - func echo(nullableDouble aNullableDouble: Double?) -> Double? + func echo(_ aNullableDouble: Double?) -> Double? /// Returns the passed in boolean. - func echo(nullableBool aNullableBool: Bool?) -> Bool? + func echo(_ aNullableBool: Bool?) -> Bool? /// Returns the passed in string. - func echo(nullableString aNullableString: String?) -> String? + func echo(_ aNullableString: String?) -> String? /// Returns the passed in Uint8List. - func echo(nullableUint8List aNullableUint8List: FlutterStandardTypedData?) -> FlutterStandardTypedData? + func echo(_ aNullableUint8List: FlutterStandardTypedData?) -> FlutterStandardTypedData? /// Returns the passed in generic Object. - func echo(nullableObject aNullableObject: Any?) -> Any? + func echo(_ aNullableObject: Any?) -> Any? /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. func noopAsync(completion: @escaping () -> Void) /// Returns the passed string asynchronously. - func echoAsync(string aString: String, completion: @escaping (String) -> Void) + func echoAsync(_ aString: String, completion: @escaping (String) -> Void) func callFlutterNoop(completion: @escaping () -> Void) - func callFlutterEcho(string aString: String, completion: @escaping (String) -> Void) + func callFlutterEcho(_ aString: String, completion: @escaping (String) -> Void) } /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. @@ -307,7 +307,7 @@ class HostIntegrationCoreApiSetup { echoAllTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let everythingArg = args[0] as! AllTypes - let result = api.echo(allTypes: everythingArg) + let result = api.echo(everythingArg) reply(wrapResult(result)) } } else { @@ -319,7 +319,7 @@ class HostIntegrationCoreApiSetup { echoAllNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let everythingArg = args[0] as? AllNullableTypes - let result = api.echo(allNullableTypes: everythingArg) + let result = api.echo(everythingArg) reply(wrapResult(result)) } } else { @@ -341,7 +341,7 @@ class HostIntegrationCoreApiSetup { echoIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anIntArg = args[0] as! Int32 - let result = api.echo(int: anIntArg) + let result = api.echo(anIntArg) reply(wrapResult(result)) } } else { @@ -353,7 +353,7 @@ class HostIntegrationCoreApiSetup { echoDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aDoubleArg = args[0] as! Double - let result = api.echo(double: aDoubleArg) + let result = api.echo(aDoubleArg) reply(wrapResult(result)) } } else { @@ -365,7 +365,7 @@ class HostIntegrationCoreApiSetup { echoBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aBoolArg = args[0] as! Bool - let result = api.echo(bool: aBoolArg) + let result = api.echo(aBoolArg) reply(wrapResult(result)) } } else { @@ -377,7 +377,7 @@ class HostIntegrationCoreApiSetup { echoStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg = args[0] as! String - let result = api.echo(string: aStringArg) + let result = api.echo(aStringArg) reply(wrapResult(result)) } } else { @@ -389,7 +389,7 @@ class HostIntegrationCoreApiSetup { echoUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aUint8ListArg = args[0] as! FlutterStandardTypedData - let result = api.echo(uint8List: aUint8ListArg) + let result = api.echo(aUint8ListArg) reply(wrapResult(result)) } } else { @@ -401,7 +401,7 @@ class HostIntegrationCoreApiSetup { echoObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anObjectArg = args[0]! - let result = api.echo(object: anObjectArg) + let result = api.echo(anObjectArg) reply(wrapResult(result)) } } else { @@ -453,7 +453,7 @@ class HostIntegrationCoreApiSetup { echoNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableIntArg = args[0] as? Int32 - let result = api.echo(nullableInt: aNullableIntArg) + let result = api.echo(aNullableIntArg) reply(wrapResult(result)) } } else { @@ -465,7 +465,7 @@ class HostIntegrationCoreApiSetup { echoNullableDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableDoubleArg = args[0] as? Double - let result = api.echo(nullableDouble: aNullableDoubleArg) + let result = api.echo(aNullableDoubleArg) reply(wrapResult(result)) } } else { @@ -477,7 +477,7 @@ class HostIntegrationCoreApiSetup { echoNullableBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableBoolArg = args[0] as? Bool - let result = api.echo(nullableBool: aNullableBoolArg) + let result = api.echo(aNullableBoolArg) reply(wrapResult(result)) } } else { @@ -489,7 +489,7 @@ class HostIntegrationCoreApiSetup { echoNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableStringArg = args[0] as? String - let result = api.echo(nullableString: aNullableStringArg) + let result = api.echo(aNullableStringArg) reply(wrapResult(result)) } } else { @@ -501,7 +501,7 @@ class HostIntegrationCoreApiSetup { echoNullableUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableUint8ListArg = args[0] as? FlutterStandardTypedData - let result = api.echo(nullableUint8List: aNullableUint8ListArg) + let result = api.echo(aNullableUint8ListArg) reply(wrapResult(result)) } } else { @@ -513,7 +513,7 @@ class HostIntegrationCoreApiSetup { echoNullableObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableObjectArg = args[0] - let result = api.echo(nullableObject: aNullableObjectArg) + let result = api.echo(aNullableObjectArg) reply(wrapResult(result)) } } else { @@ -537,7 +537,7 @@ class HostIntegrationCoreApiSetup { echoAsyncStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg = args[0] as! String - api.echoAsync(string: aStringArg) { result in + api.echoAsync(aStringArg) { result in reply(wrapResult(result)) } } @@ -559,7 +559,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg = args[0] as! String - api.callFlutterEcho(string: aStringArg) { result in + api.callFlutterEcho(aStringArg) { result in reply(wrapResult(result)) } } @@ -635,7 +635,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed object, to test serialization and deserialization. - func echo(allTypes everythingArg: AllTypes, completion: @escaping (AllTypes) -> Void) { + func echo(_ everythingArg: AllTypes, completion: @escaping (AllTypes) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllTypes", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([everythingArg] as [Any?]) { response in let result = response as! AllTypes @@ -643,7 +643,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed object, to test serialization and deserialization. - func echo(allNullableTypes everythingArg: AllNullableTypes, completion: @escaping (AllNullableTypes) -> Void) { + func echo(_ everythingArg: AllNullableTypes, completion: @escaping (AllNullableTypes) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([everythingArg] as [Any?]) { response in let result = response as! AllNullableTypes @@ -661,7 +661,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed boolean, to test serialization and deserialization. - func echo(bool aBoolArg: Bool, completion: @escaping (Bool) -> Void) { + func echo(_ aBoolArg: Bool, completion: @escaping (Bool) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoBool", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aBoolArg] as [Any?]) { response in let result = response as! Bool @@ -669,7 +669,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed int, to test serialization and deserialization. - func echo(int anIntArg: Int32, completion: @escaping (Int32) -> Void) { + func echo(_ anIntArg: Int32, completion: @escaping (Int32) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoInt", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anIntArg] as [Any?]) { response in let result = response as! Int32 @@ -677,7 +677,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed double, to test serialization and deserialization. - func echo(double aDoubleArg: Double, completion: @escaping (Double) -> Void) { + func echo(_ aDoubleArg: Double, completion: @escaping (Double) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoDouble", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aDoubleArg] as [Any?]) { response in let result = response as! Double @@ -685,7 +685,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed string, to test serialization and deserialization. - func echo(string aStringArg: String, completion: @escaping (String) -> Void) { + func echo(_ aStringArg: String, completion: @escaping (String) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoString", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in let result = response as! String @@ -693,7 +693,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed byte list, to test serialization and deserialization. - func echo(uint8List aListArg: FlutterStandardTypedData, completion: @escaping (FlutterStandardTypedData) -> Void) { + func echo(_ aListArg: FlutterStandardTypedData, completion: @escaping (FlutterStandardTypedData) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoUint8List", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in let result = response as! FlutterStandardTypedData @@ -701,7 +701,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed list, to test serialization and deserialization. - func echo(list aListArg: [Any?], completion: @escaping ([Any?]) -> Void) { + func echo(_ aListArg: [Any?], completion: @escaping ([Any?]) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoList", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in let result = response as! [Any?] @@ -709,7 +709,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed map, to test serialization and deserialization. - func echoMap(aMap aMapArg: [String?: Any?], completion: @escaping ([String?: Any?]) -> Void) { + func echo(_ aMapArg: [String?: Any?], completion: @escaping ([String?: Any?]) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoMap", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aMapArg] as [Any?]) { response in let result = response as! [String?: Any?] @@ -717,7 +717,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed boolean, to test serialization and deserialization. - func echo(nullableBool aBoolArg: Bool?, completion: @escaping (Bool?) -> Void) { + func echo(_ aBoolArg: Bool?, completion: @escaping (Bool?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableBool", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aBoolArg] as [Any?]) { response in let result = response as? Bool @@ -725,7 +725,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed int, to test serialization and deserialization. - func echo(nullableInt anIntArg: Int32?, completion: @escaping (Int32?) -> Void) { + func echo(_ anIntArg: Int32?, completion: @escaping (Int32?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableInt", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anIntArg] as [Any?]) { response in let result = response as? Int32 @@ -733,7 +733,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed double, to test serialization and deserialization. - func echo(nullableDouble aDoubleArg: Double?, completion: @escaping (Double?) -> Void) { + func echo(_ aDoubleArg: Double?, completion: @escaping (Double?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableDouble", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aDoubleArg] as [Any?]) { response in let result = response as? Double @@ -741,7 +741,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed string, to test serialization and deserialization. - func echo(nullableString aStringArg: String?, completion: @escaping (String?) -> Void) { + func echo(_ aStringArg: String?, completion: @escaping (String?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableString", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in let result = response as? String @@ -749,7 +749,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed byte list, to test serialization and deserialization. - func echo(nullableUint8List aListArg: FlutterStandardTypedData?, completion: @escaping (FlutterStandardTypedData?) -> Void) { + func echo(_ aListArg: FlutterStandardTypedData?, completion: @escaping (FlutterStandardTypedData?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableUint8List", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in let result = response as? FlutterStandardTypedData @@ -757,7 +757,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed list, to test serialization and deserialization. - func echo(nullableList aListArg: [Any?]?, completion: @escaping ([Any?]?) -> Void) { + func echo(_ aListArg: [Any?]?, completion: @escaping ([Any?]?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in let result = response as? [Any?] @@ -765,10 +765,10 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed map, to test serialization and deserialization. - func echo(nullableMap aMapArg: [String?: Any?], completion: @escaping ([String?: Any?]) -> Void) { + func echo(_ aMapArg: [String?: Any?]?, completion: @escaping ([String?: Any?]?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aMapArg] as [Any?]) { response in - let result = response as! [String?: Any?] + let result = response as? [String?: Any?] completion(result) } } diff --git a/packages/pigeon/platform_tests/test_plugin/macos/Classes/TestPlugin.swift b/packages/pigeon/platform_tests/test_plugin/macos/Classes/TestPlugin.swift index 4687719ba2b..bc644c7cd47 100644 --- a/packages/pigeon/platform_tests/test_plugin/macos/Classes/TestPlugin.swift +++ b/packages/pigeon/platform_tests/test_plugin/macos/Classes/TestPlugin.swift @@ -26,11 +26,11 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { func noop() { } - func echo(allTypes everything: AllTypes) -> AllTypes { + func echo(_ everything: AllTypes) -> AllTypes { return everything } - func echo(allNullableTypes everything: AllNullableTypes?) -> AllNullableTypes? { + func echo(_ everything: AllNullableTypes?) -> AllNullableTypes? { return everything } @@ -39,27 +39,27 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { // https://github.com/flutter/flutter/issues/112483 } - func echo(int anInt: Int32) -> Int32 { + func echo(_ anInt: Int32) -> Int32 { return anInt } - func echo(double aDouble: Double) -> Double { + func echo(_ aDouble: Double) -> Double { return aDouble } - func echo(bool aBool: Bool) -> Bool { + func echo(_ aBool: Bool) -> Bool { return aBool } - func echo(string aString: String) -> String { + func echo(_ aString: String) -> String { return aString } - func echo(uint8List aUint8List: FlutterStandardTypedData) -> FlutterStandardTypedData { + func echo(_ aUint8List: FlutterStandardTypedData) -> FlutterStandardTypedData { return aUint8List } - func echo(object anObject: Any) -> Any { + func echo(_ anObject: Any) -> Any { return anObject } @@ -76,27 +76,27 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { return someThings } - func echo(nullableInt aNullableInt: Int32?) -> Int32? { + func echo(_ aNullableInt: Int32?) -> Int32? { return aNullableInt } - func echo(nullableDouble aNullableDouble: Double?) -> Double? { + func echo(_ aNullableDouble: Double?) -> Double? { return aNullableDouble } - func echo(nullableBool aNullableBool: Bool?) -> Bool? { + func echo(_ aNullableBool: Bool?) -> Bool? { return aNullableBool } - func echo(nullableString aNullableString: String?) -> String? { + func echo(_ aNullableString: String?) -> String? { return aNullableString } - func echo(nullableUint8List aNullableUint8List: FlutterStandardTypedData?) -> FlutterStandardTypedData? { + func echo(_ aNullableUint8List: FlutterStandardTypedData?) -> FlutterStandardTypedData? { return aNullableUint8List } - func echo(nullableObject aNullableObject: Any?) -> Any? { + func echo(_ aNullableObject: Any?) -> Any? { return aNullableObject } @@ -104,7 +104,7 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { completion() } - func echoAsync(string aString: String, completion: @escaping (String) -> Void) { + func echoAsync(_ aString: String, completion: @escaping (String) -> Void) { completion(aString) } @@ -114,8 +114,8 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { } } - func callFlutterEcho(string aString: String, completion: @escaping (String) -> Void) { - flutterAPI.echo(string: aString) { flutterString in + func callFlutterEcho(_ aString: String, completion: @escaping (String) -> Void) { + flutterAPI.echo(aString) { flutterString in completion(flutterString) } } diff --git a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp index 67ac536b80c..b5915c5bb21 100644 --- a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp +++ b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp @@ -1826,8 +1826,8 @@ void FlutterIntegrationCoreApi::EchoNullableList( }); } void FlutterIntegrationCoreApi::EchoNullableMap( - const flutter::EncodableMap& a_map_arg, - std::function&& on_success, + const flutter::EncodableMap* a_map_arg, + std::function&& on_success, std::function&& on_error) { auto channel = std::make_unique>( binary_messenger_, @@ -1835,7 +1835,8 @@ void FlutterIntegrationCoreApi::EchoNullableMap( &GetCodec()); flutter::EncodableValue encoded_api_arguments = flutter::EncodableValue(flutter::EncodableList{ - flutter::EncodableValue(a_map_arg), + a_map_arg ? flutter::EncodableValue(*a_map_arg) + : flutter::EncodableValue(), }); channel->Send( encoded_api_arguments, @@ -1844,8 +1845,8 @@ void FlutterIntegrationCoreApi::EchoNullableMap( std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); const auto& encodable_return_value = *response; - const auto& return_value = - std::get(encodable_return_value); + const auto* return_value = + std::get_if(&encodable_return_value); on_success(return_value); }); } diff --git a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h index bce0c84720b..6a8a3a185e2 100644 --- a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h +++ b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.h @@ -449,8 +449,8 @@ class FlutterIntegrationCoreApi { std::function&& on_error); // Returns the passed map, to test serialization and deserialization. void EchoNullableMap( - const flutter::EncodableMap& a_map, - std::function&& on_success, + const flutter::EncodableMap* a_map, + std::function&& on_success, std::function&& on_error); }; From 9176579957097ef92a61d3a1557b181d01639c91 Mon Sep 17 00:00:00 2001 From: Ailton Vieira Pinto Filho Date: Wed, 18 Jan 2023 20:37:52 -0300 Subject: [PATCH 22/26] Match order of parameters --- packages/pigeon/lib/swift_generator.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pigeon/lib/swift_generator.dart b/packages/pigeon/lib/swift_generator.dart index 70c26f70cf6..797c4fa64d8 100644 --- a/packages/pigeon/lib/swift_generator.dart +++ b/packages/pigeon/lib/swift_generator.dart @@ -717,9 +717,9 @@ class _SwiftFunctionArgument { }); final String name; - final String? label; final TypeDeclaration type; final NamedType namedType; + final String? label; } class _SwiftFunctionComponents { From 372d7b76211b9ec3718a230edc50f1da8b825d4c Mon Sep 17 00:00:00 2001 From: Ailton Vieira Pinto Filho Date: Wed, 18 Jan 2023 20:39:57 -0300 Subject: [PATCH 23/26] Documents _SwiftFunctionComponents.fromMethod and _SwiftFunctionArgument --- packages/pigeon/lib/swift_generator.dart | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/pigeon/lib/swift_generator.dart b/packages/pigeon/lib/swift_generator.dart index 797c4fa64d8..1dad79dc812 100644 --- a/packages/pigeon/lib/swift_generator.dart +++ b/packages/pigeon/lib/swift_generator.dart @@ -708,6 +708,11 @@ String _nullsafeSwiftTypeForDartType(TypeDeclaration type) { return '${_swiftTypeForDartType(type)}$nullSafe'; } +/// A class that represents a Swift function argument. +/// The [name] is the name of the argument. +/// The [type] is the type of the argument. +/// The [namedType] is the [NamedType] that this argument is generated from. +/// The [label] is the label of the argument. class _SwiftFunctionArgument { _SwiftFunctionArgument({ required this.name, @@ -722,6 +727,11 @@ class _SwiftFunctionArgument { final String? label; } +/// A class that represents a Swift function signature. +/// The [name] is the name of the function. +/// The [arguments] are the arguments of the function. +/// The [returnType] is the return type of the function. +/// The [method] is the method that this function signature is generated from. class _SwiftFunctionComponents { _SwiftFunctionComponents._({ required this.name, @@ -730,6 +740,7 @@ class _SwiftFunctionComponents { required this.method, }); + /// Constructor that generates a [_SwiftFunctionComponents] from a [Method]. factory _SwiftFunctionComponents.fromMethod(Method method) { if (method.swiftFunction.isEmpty) { return _SwiftFunctionComponents._( From 00391658cd162e0a73f337b7b5b2396de8e31c8a Mon Sep 17 00:00:00 2001 From: Ailton Vieira Pinto Filho Date: Tue, 24 Jan 2023 20:09:59 -0300 Subject: [PATCH 24/26] Improve doc comments --- packages/pigeon/lib/pigeon_lib.dart | 1 + packages/pigeon/lib/swift_generator.dart | 2 ++ 2 files changed, 3 insertions(+) diff --git a/packages/pigeon/lib/pigeon_lib.dart b/packages/pigeon/lib/pigeon_lib.dart index fc8304a5f9a..cb09a70fc8e 100644 --- a/packages/pigeon/lib/pigeon_lib.dart +++ b/packages/pigeon/lib/pigeon_lib.dart @@ -101,6 +101,7 @@ class ObjCSelector { } /// Metadata to annotate methods to control the signature used for Swift output. +/// /// The number of components in the provided signature must match the number of /// arguments in the annotated method. /// For example: diff --git a/packages/pigeon/lib/swift_generator.dart b/packages/pigeon/lib/swift_generator.dart index 6ff34b06e1e..9f10eb1821b 100644 --- a/packages/pigeon/lib/swift_generator.dart +++ b/packages/pigeon/lib/swift_generator.dart @@ -710,6 +710,7 @@ String _nullsafeSwiftTypeForDartType(TypeDeclaration type) { } /// A class that represents a Swift function argument. +/// /// The [name] is the name of the argument. /// The [type] is the type of the argument. /// The [namedType] is the [NamedType] that this argument is generated from. @@ -729,6 +730,7 @@ class _SwiftFunctionArgument { } /// A class that represents a Swift function signature. +/// /// The [name] is the name of the function. /// The [arguments] are the arguments of the function. /// The [returnType] is the return type of the function. From 651f9fa419721aac0de23f408123cca4121ddd3f Mon Sep 17 00:00:00 2001 From: Ailton Vieira Pinto Filho Date: Tue, 24 Jan 2023 20:45:40 -0300 Subject: [PATCH 25/26] Fix tests --- packages/pigeon/lib/pigeon_lib.dart | 2 +- packages/pigeon/lib/swift_generator.dart | 4 +- packages/pigeon/pigeons/core_tests.dart | 31 +++- .../ios/RunnerTests/AllDatatypesTests.swift | 4 +- .../ios/Classes/CoreTests.gen.swift | 170 +++++++++--------- .../test_plugin/ios/Classes/TestPlugin.swift | 72 ++++---- .../macos/Classes/CoreTests.gen.swift | 170 +++++++++--------- .../macos/Classes/TestPlugin.swift | 72 ++++---- 8 files changed, 270 insertions(+), 255 deletions(-) diff --git a/packages/pigeon/lib/pigeon_lib.dart b/packages/pigeon/lib/pigeon_lib.dart index cb09a70fc8e..6a6ea89a795 100644 --- a/packages/pigeon/lib/pigeon_lib.dart +++ b/packages/pigeon/lib/pigeon_lib.dart @@ -101,7 +101,7 @@ class ObjCSelector { } /// Metadata to annotate methods to control the signature used for Swift output. -/// +/// /// The number of components in the provided signature must match the number of /// arguments in the annotated method. /// For example: diff --git a/packages/pigeon/lib/swift_generator.dart b/packages/pigeon/lib/swift_generator.dart index 9f10eb1821b..6109b8d3df8 100644 --- a/packages/pigeon/lib/swift_generator.dart +++ b/packages/pigeon/lib/swift_generator.dart @@ -710,7 +710,7 @@ String _nullsafeSwiftTypeForDartType(TypeDeclaration type) { } /// A class that represents a Swift function argument. -/// +/// /// The [name] is the name of the argument. /// The [type] is the type of the argument. /// The [namedType] is the [NamedType] that this argument is generated from. @@ -730,7 +730,7 @@ class _SwiftFunctionArgument { } /// A class that represents a Swift function signature. -/// +/// /// The [name] is the name of the function. /// The [arguments] are the arguments of the function. /// The [returnType] is the return type of the function. diff --git a/packages/pigeon/pigeons/core_tests.dart b/packages/pigeon/pigeons/core_tests.dart index 0108d19f43c..fe1cb9b1785 100644 --- a/packages/pigeon/pigeons/core_tests.dart +++ b/packages/pigeon/pigeons/core_tests.dart @@ -207,6 +207,7 @@ abstract class HostIntegrationCoreApi { @async @ObjCSelector('callFlutterEchoAllTypes:') + @SwiftFunction('callFlutterEcho(_:)') AllTypes callFlutterEchoAllTypes(AllTypes everything); // TODO(stuartmorgan): Add callFlutterEchoAllNullableTypes and the associated @@ -216,19 +217,23 @@ abstract class HostIntegrationCoreApi { @async @ObjCSelector('callFlutterSendMultipleNullableTypesABool:anInt:aString:') + @SwiftFunction('callFlutterSendMultipleNullableTypes(aBool:anInt:aString:)') AllNullableTypes callFlutterSendMultipleNullableTypes( bool? aNullableBool, int? aNullableInt, String? aNullableString); @async @ObjCSelector('callFlutterEchoBool:') + @SwiftFunction('callFlutterEcho(_:)') bool callFlutterEchoBool(bool aBool); @async @ObjCSelector('callFlutterEchoInt:') + @SwiftFunction('callFlutterEcho(_:)') int callFlutterEchoInt(int anInt); @async @ObjCSelector('callFlutterEchoDouble:') + @SwiftFunction('callFlutterEcho(_:)') double callFlutterEchoDouble(double aDouble); @async @@ -238,42 +243,52 @@ abstract class HostIntegrationCoreApi { @async @ObjCSelector('callFlutterEchoUint8List:') + @SwiftFunction('callFlutterEcho(_:)') Uint8List callFlutterEchoUint8List(Uint8List aList); @async @ObjCSelector('callFlutterEchoList:') + @SwiftFunction('callFlutterEcho(_:)') List callFlutterEchoList(List aList); @async @ObjCSelector('callFlutterEchoMap:') + @SwiftFunction('callFlutterEcho(_:)') Map callFlutterEchoMap(Map aMap); @async @ObjCSelector('callFlutterEchoNullableBool:') + @SwiftFunction('callFlutterEchoNullable(_:)') bool? callFlutterEchoNullableBool(bool? aBool); @async @ObjCSelector('callFlutterEchoNullableInt:') + @SwiftFunction('callFlutterEchoNullable(_:)') int? callFlutterEchoNullableInt(int? anInt); @async @ObjCSelector('callFlutterEchoNullableDouble:') + @SwiftFunction('callFlutterEchoNullable(_:)') double? callFlutterEchoNullableDouble(double? aDouble); @async @ObjCSelector('callFlutterEchoNullableString:') + @SwiftFunction('callFlutterEchoNullable(_:)') String? callFlutterEchoNullableString(String? aString); @async @ObjCSelector('callFlutterEchoNullableUint8List:') + @SwiftFunction('callFlutterEchoNullable(_:)') Uint8List? callFlutterEchoNullableUint8List(Uint8List? aList); @async @ObjCSelector('callFlutterEchoNullableList:') + @SwiftFunction('callFlutterEchoNullable(_:)') List? callFlutterEchoNullableList(List? aList); @async @ObjCSelector('callFlutterEchoNullableMap:') + @SwiftFunction('callFlutterEchoNullable(_:)') Map? callFlutterEchoNullableMap( Map? aMap); } @@ -293,7 +308,7 @@ abstract class FlutterIntegrationCoreApi { /// Returns the passed object, to test serialization and deserialization. @ObjCSelector('echoAllNullableTypes:') - @SwiftFunction('echo(_:)') + @SwiftFunction('echoNullable(_:)') AllNullableTypes echoAllNullableTypes(AllNullableTypes everything); /// Returns passed in arguments of multiple types. @@ -345,37 +360,37 @@ abstract class FlutterIntegrationCoreApi { /// Returns the passed boolean, to test serialization and deserialization. @ObjCSelector('echoNullableBool:') - @SwiftFunction('echo(_:)') + @SwiftFunction('echoNullable(_:)') bool? echoNullableBool(bool? aBool); /// Returns the passed int, to test serialization and deserialization. @ObjCSelector('echoNullableInt:') - @SwiftFunction('echo(_:)') + @SwiftFunction('echoNullable(_:)') int? echoNullableInt(int? anInt); /// Returns the passed double, to test serialization and deserialization. @ObjCSelector('echoNullableDouble:') - @SwiftFunction('echo(_:)') + @SwiftFunction('echoNullable(_:)') double? echoNullableDouble(double? aDouble); /// Returns the passed string, to test serialization and deserialization. @ObjCSelector('echoNullableString:') - @SwiftFunction('echo(_:)') + @SwiftFunction('echoNullable(_:)') String? echoNullableString(String? aString); /// Returns the passed byte list, to test serialization and deserialization. @ObjCSelector('echoNullableUint8List:') - @SwiftFunction('echo(_:)') + @SwiftFunction('echoNullable(_:)') Uint8List? echoNullableUint8List(Uint8List? aList); /// Returns the passed list, to test serialization and deserialization. @ObjCSelector('echoNullableList:') - @SwiftFunction('echo(_:)') + @SwiftFunction('echoNullable(_:)') List? echoNullableList(List? aList); /// Returns the passed map, to test serialization and deserialization. @ObjCSelector('echoNullableMap:') - @SwiftFunction('echo(_:)') + @SwiftFunction('echoNullable(_:)') Map? echoNullableMap(Map? aMap); } diff --git a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/AllDatatypesTests.swift b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/AllDatatypesTests.swift index b2b81233c06..08b9b3b15eb 100644 --- a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/AllDatatypesTests.swift +++ b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/AllDatatypesTests.swift @@ -15,7 +15,7 @@ class AllDatatypesTests: XCTestCase { let expectation = XCTestExpectation(description: "callback") - api.echo(everything) { result in + api.echoNullable(everything) { result in XCTAssertNil(result.aNullableBool) XCTAssertNil(result.aNullableInt) XCTAssertNil(result.aNullableDouble) @@ -57,7 +57,7 @@ class AllDatatypesTests: XCTestCase { let expectation = XCTestExpectation(description: "callback") - api.echo(everything) { result in + api.echoNullable(everything) { result in XCTAssertEqual(result.aNullableBool, everything.aNullableBool) XCTAssertEqual(result.aNullableInt, everything.aNullableInt) XCTAssertEqual(result.aNullableDouble, everything.aNullableDouble) diff --git a/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift b/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift index c614cd656c0..0f3391283b9 100644 --- a/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift +++ b/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift @@ -238,65 +238,65 @@ protocol HostIntegrationCoreApi { /// test basic calling. func noop() /// Returns the passed object, to test serialization and deserialization. - func echoAllTypes(everything: AllTypes) -> AllTypes + func echo(_ everything: AllTypes) -> AllTypes /// Returns the passed object, to test serialization and deserialization. - func echoAllNullableTypes(everything: AllNullableTypes?) -> AllNullableTypes? + func echo(_ everything: AllNullableTypes?) -> AllNullableTypes? /// Returns an error, to test error handling. func throwError() /// Returns passed in int. - func echoInt(anInt: Int32) -> Int32 + func echo(_ anInt: Int32) -> Int32 /// Returns passed in double. - func echoDouble(aDouble: Double) -> Double + func echo(_ aDouble: Double) -> Double /// Returns the passed in boolean. - func echoBool(aBool: Bool) -> Bool + func echo(_ aBool: Bool) -> Bool /// Returns the passed in string. - func echoString(aString: String) -> String + func echo(_ aString: String) -> String /// Returns the passed in Uint8List. - func echoUint8List(aUint8List: FlutterStandardTypedData) -> FlutterStandardTypedData + func echo(_ aUint8List: FlutterStandardTypedData) -> FlutterStandardTypedData /// Returns the passed in generic Object. - func echoObject(anObject: Any) -> Any + func echo(_ anObject: Any) -> Any /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. - func extractNestedNullableString(wrapper: AllNullableTypesWrapper) -> String? + func extractNestedNullableString(from wrapper: AllNullableTypesWrapper) -> String? /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. - func createNestedNullableString(nullableString: String?) -> AllNullableTypesWrapper + func createNestedObject(with nullableString: String?) -> AllNullableTypesWrapper /// Returns passed in arguments of multiple types. - func sendMultipleNullableTypes(aNullableBool: Bool?, aNullableInt: Int32?, aNullableString: String?) -> AllNullableTypes + func sendMultipleNullableTypes(aBool aNullableBool: Bool?, anInt aNullableInt: Int32?, aString aNullableString: String?) -> AllNullableTypes /// Returns passed in int. - func echoNullableInt(aNullableInt: Int32?) -> Int32? + func echo(_ aNullableInt: Int32?) -> Int32? /// Returns passed in double. - func echoNullableDouble(aNullableDouble: Double?) -> Double? + func echo(_ aNullableDouble: Double?) -> Double? /// Returns the passed in boolean. - func echoNullableBool(aNullableBool: Bool?) -> Bool? + func echo(_ aNullableBool: Bool?) -> Bool? /// Returns the passed in string. - func echoNullableString(aNullableString: String?) -> String? + func echo(_ aNullableString: String?) -> String? /// Returns the passed in Uint8List. - func echoNullableUint8List(aNullableUint8List: FlutterStandardTypedData?) -> FlutterStandardTypedData? + func echo(_ aNullableUint8List: FlutterStandardTypedData?) -> FlutterStandardTypedData? /// Returns the passed in generic Object. - func echoNullableObject(aNullableObject: Any?) -> Any? + func echo(_ aNullableObject: Any?) -> Any? /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. func noopAsync(completion: @escaping () -> Void) /// Returns the passed string asynchronously. - func echoAsyncString(aString: String, completion: @escaping (String) -> Void) + func echoAsync(_ aString: String, completion: @escaping (String) -> Void) func callFlutterNoop(completion: @escaping () -> Void) - func callFlutterEchoAllTypes(everything: AllTypes, completion: @escaping (AllTypes) -> Void) - func callFlutterSendMultipleNullableTypes(aNullableBool: Bool?, aNullableInt: Int32?, aNullableString: String?, completion: @escaping (AllNullableTypes) -> Void) - func callFlutterEchoBool(aBool: Bool, completion: @escaping (Bool) -> Void) - func callFlutterEchoInt(anInt: Int32, completion: @escaping (Int32) -> Void) - func callFlutterEchoDouble(aDouble: Double, completion: @escaping (Double) -> Void) - func callFlutterEchoString(aString: String, completion: @escaping (String) -> Void) - func callFlutterEchoUint8List(aList: FlutterStandardTypedData, completion: @escaping (FlutterStandardTypedData) -> Void) - func callFlutterEchoList(aList: [Any?], completion: @escaping ([Any?]) -> Void) - func callFlutterEchoMap(aMap: [String?: Any?], completion: @escaping ([String?: Any?]) -> Void) - func callFlutterEchoNullableBool(aBool: Bool?, completion: @escaping (Bool?) -> Void) - func callFlutterEchoNullableInt(anInt: Int32?, completion: @escaping (Int32?) -> Void) - func callFlutterEchoNullableDouble(aDouble: Double?, completion: @escaping (Double?) -> Void) - func callFlutterEchoNullableString(aString: String?, completion: @escaping (String?) -> Void) - func callFlutterEchoNullableUint8List(aList: FlutterStandardTypedData?, completion: @escaping (FlutterStandardTypedData?) -> Void) - func callFlutterEchoNullableList(aList: [Any?]?, completion: @escaping ([Any?]?) -> Void) - func callFlutterEchoNullableMap(aMap: [String?: Any?]?, completion: @escaping ([String?: Any?]?) -> Void) + func callFlutterEcho(_ everything: AllTypes, completion: @escaping (AllTypes) -> Void) + func callFlutterSendMultipleNullableTypes(aBool aNullableBool: Bool?, anInt aNullableInt: Int32?, aString aNullableString: String?, completion: @escaping (AllNullableTypes) -> Void) + func callFlutterEcho(_ aBool: Bool, completion: @escaping (Bool) -> Void) + func callFlutterEcho(_ anInt: Int32, completion: @escaping (Int32) -> Void) + func callFlutterEcho(_ aDouble: Double, completion: @escaping (Double) -> Void) + func callFlutterEcho(_ aString: String, completion: @escaping (String) -> Void) + func callFlutterEcho(_ aList: FlutterStandardTypedData, completion: @escaping (FlutterStandardTypedData) -> Void) + func callFlutterEcho(_ aList: [Any?], completion: @escaping ([Any?]) -> Void) + func callFlutterEcho(_ aMap: [String?: Any?], completion: @escaping ([String?: Any?]) -> Void) + func callFlutterEchoNullable(_ aBool: Bool?, completion: @escaping (Bool?) -> Void) + func callFlutterEchoNullable(_ anInt: Int32?, completion: @escaping (Int32?) -> Void) + func callFlutterEchoNullable(_ aDouble: Double?, completion: @escaping (Double?) -> Void) + func callFlutterEchoNullable(_ aString: String?, completion: @escaping (String?) -> Void) + func callFlutterEchoNullable(_ aList: FlutterStandardTypedData?, completion: @escaping (FlutterStandardTypedData?) -> Void) + func callFlutterEchoNullable(_ aList: [Any?]?, completion: @escaping ([Any?]?) -> Void) + func callFlutterEchoNullable(_ aMap: [String?: Any?]?, completion: @escaping ([String?: Any?]?) -> Void) } /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. @@ -322,7 +322,7 @@ class HostIntegrationCoreApiSetup { echoAllTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let everythingArg = args[0] as! AllTypes - let result = api.echoAllTypes(everything: everythingArg) + let result = api.echo(everythingArg) reply(wrapResult(result)) } } else { @@ -334,7 +334,7 @@ class HostIntegrationCoreApiSetup { echoAllNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let everythingArg = args[0] as? AllNullableTypes - let result = api.echoAllNullableTypes(everything: everythingArg) + let result = api.echo(everythingArg) reply(wrapResult(result)) } } else { @@ -356,7 +356,7 @@ class HostIntegrationCoreApiSetup { echoIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anIntArg = args[0] as! Int32 - let result = api.echoInt(anInt: anIntArg) + let result = api.echo(anIntArg) reply(wrapResult(result)) } } else { @@ -368,7 +368,7 @@ class HostIntegrationCoreApiSetup { echoDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aDoubleArg = args[0] as! Double - let result = api.echoDouble(aDouble: aDoubleArg) + let result = api.echo(aDoubleArg) reply(wrapResult(result)) } } else { @@ -380,7 +380,7 @@ class HostIntegrationCoreApiSetup { echoBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aBoolArg = args[0] as! Bool - let result = api.echoBool(aBool: aBoolArg) + let result = api.echo(aBoolArg) reply(wrapResult(result)) } } else { @@ -392,7 +392,7 @@ class HostIntegrationCoreApiSetup { echoStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg = args[0] as! String - let result = api.echoString(aString: aStringArg) + let result = api.echo(aStringArg) reply(wrapResult(result)) } } else { @@ -404,7 +404,7 @@ class HostIntegrationCoreApiSetup { echoUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aUint8ListArg = args[0] as! FlutterStandardTypedData - let result = api.echoUint8List(aUint8List: aUint8ListArg) + let result = api.echo(aUint8ListArg) reply(wrapResult(result)) } } else { @@ -416,7 +416,7 @@ class HostIntegrationCoreApiSetup { echoObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anObjectArg = args[0]! - let result = api.echoObject(anObject: anObjectArg) + let result = api.echo(anObjectArg) reply(wrapResult(result)) } } else { @@ -429,7 +429,7 @@ class HostIntegrationCoreApiSetup { extractNestedNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let wrapperArg = args[0] as! AllNullableTypesWrapper - let result = api.extractNestedNullableString(wrapper: wrapperArg) + let result = api.extractNestedNullableString(from: wrapperArg) reply(wrapResult(result)) } } else { @@ -442,7 +442,7 @@ class HostIntegrationCoreApiSetup { createNestedNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let nullableStringArg = args[0] as? String - let result = api.createNestedNullableString(nullableString: nullableStringArg) + let result = api.createNestedObject(with: nullableStringArg) reply(wrapResult(result)) } } else { @@ -456,7 +456,7 @@ class HostIntegrationCoreApiSetup { let aNullableBoolArg = args[0] as? Bool let aNullableIntArg = args[1] as? Int32 let aNullableStringArg = args[2] as? String - let result = api.sendMultipleNullableTypes(aNullableBool: aNullableBoolArg, aNullableInt: aNullableIntArg, aNullableString: aNullableStringArg) + let result = api.sendMultipleNullableTypes(aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg) reply(wrapResult(result)) } } else { @@ -468,7 +468,7 @@ class HostIntegrationCoreApiSetup { echoNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableIntArg = args[0] as? Int32 - let result = api.echoNullableInt(aNullableInt: aNullableIntArg) + let result = api.echo(aNullableIntArg) reply(wrapResult(result)) } } else { @@ -480,7 +480,7 @@ class HostIntegrationCoreApiSetup { echoNullableDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableDoubleArg = args[0] as? Double - let result = api.echoNullableDouble(aNullableDouble: aNullableDoubleArg) + let result = api.echo(aNullableDoubleArg) reply(wrapResult(result)) } } else { @@ -492,7 +492,7 @@ class HostIntegrationCoreApiSetup { echoNullableBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableBoolArg = args[0] as? Bool - let result = api.echoNullableBool(aNullableBool: aNullableBoolArg) + let result = api.echo(aNullableBoolArg) reply(wrapResult(result)) } } else { @@ -504,7 +504,7 @@ class HostIntegrationCoreApiSetup { echoNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableStringArg = args[0] as? String - let result = api.echoNullableString(aNullableString: aNullableStringArg) + let result = api.echo(aNullableStringArg) reply(wrapResult(result)) } } else { @@ -516,7 +516,7 @@ class HostIntegrationCoreApiSetup { echoNullableUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableUint8ListArg = args[0] as? FlutterStandardTypedData - let result = api.echoNullableUint8List(aNullableUint8List: aNullableUint8ListArg) + let result = api.echo(aNullableUint8ListArg) reply(wrapResult(result)) } } else { @@ -528,7 +528,7 @@ class HostIntegrationCoreApiSetup { echoNullableObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableObjectArg = args[0] - let result = api.echoNullableObject(aNullableObject: aNullableObjectArg) + let result = api.echo(aNullableObjectArg) reply(wrapResult(result)) } } else { @@ -552,7 +552,7 @@ class HostIntegrationCoreApiSetup { echoAsyncStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg = args[0] as! String - api.echoAsyncString(aString: aStringArg) { result in + api.echoAsync(aStringArg) { result in reply(wrapResult(result)) } } @@ -574,7 +574,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoAllTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let everythingArg = args[0] as! AllTypes - api.callFlutterEchoAllTypes(everything: everythingArg) { result in + api.callFlutterEcho(everythingArg) { result in reply(wrapResult(result)) } } @@ -588,7 +588,7 @@ class HostIntegrationCoreApiSetup { let aNullableBoolArg = args[0] as? Bool let aNullableIntArg = args[1] as? Int32 let aNullableStringArg = args[2] as? String - api.callFlutterSendMultipleNullableTypes(aNullableBool: aNullableBoolArg, aNullableInt: aNullableIntArg, aNullableString: aNullableStringArg) { result in + api.callFlutterSendMultipleNullableTypes(aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg) { result in reply(wrapResult(result)) } } @@ -600,7 +600,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aBoolArg = args[0] as! Bool - api.callFlutterEchoBool(aBool: aBoolArg) { result in + api.callFlutterEcho(aBoolArg) { result in reply(wrapResult(result)) } } @@ -612,7 +612,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anIntArg = args[0] as! Int32 - api.callFlutterEchoInt(anInt: anIntArg) { result in + api.callFlutterEcho(anIntArg) { result in reply(wrapResult(result)) } } @@ -624,7 +624,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aDoubleArg = args[0] as! Double - api.callFlutterEchoDouble(aDouble: aDoubleArg) { result in + api.callFlutterEcho(aDoubleArg) { result in reply(wrapResult(result)) } } @@ -636,7 +636,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg = args[0] as! String - api.callFlutterEchoString(aString: aStringArg) { result in + api.callFlutterEcho(aStringArg) { result in reply(wrapResult(result)) } } @@ -648,7 +648,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aListArg = args[0] as! FlutterStandardTypedData - api.callFlutterEchoUint8List(aList: aListArg) { result in + api.callFlutterEcho(aListArg) { result in reply(wrapResult(result)) } } @@ -660,7 +660,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aListArg = args[0] as! [Any?] - api.callFlutterEchoList(aList: aListArg) { result in + api.callFlutterEcho(aListArg) { result in reply(wrapResult(result)) } } @@ -672,7 +672,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aMapArg = args[0] as! [String?: Any?] - api.callFlutterEchoMap(aMap: aMapArg) { result in + api.callFlutterEcho(aMapArg) { result in reply(wrapResult(result)) } } @@ -684,7 +684,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoNullableBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aBoolArg = args[0] as? Bool - api.callFlutterEchoNullableBool(aBool: aBoolArg) { result in + api.callFlutterEchoNullable(aBoolArg) { result in reply(wrapResult(result)) } } @@ -696,7 +696,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anIntArg = args[0] as? Int32 - api.callFlutterEchoNullableInt(anInt: anIntArg) { result in + api.callFlutterEchoNullable(anIntArg) { result in reply(wrapResult(result)) } } @@ -708,7 +708,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoNullableDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aDoubleArg = args[0] as? Double - api.callFlutterEchoNullableDouble(aDouble: aDoubleArg) { result in + api.callFlutterEchoNullable(aDoubleArg) { result in reply(wrapResult(result)) } } @@ -720,7 +720,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg = args[0] as? String - api.callFlutterEchoNullableString(aString: aStringArg) { result in + api.callFlutterEchoNullable(aStringArg) { result in reply(wrapResult(result)) } } @@ -732,7 +732,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoNullableUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aListArg = args[0] as? FlutterStandardTypedData - api.callFlutterEchoNullableUint8List(aList: aListArg) { result in + api.callFlutterEchoNullable(aListArg) { result in reply(wrapResult(result)) } } @@ -744,7 +744,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoNullableListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aListArg = args[0] as? [Any?] - api.callFlutterEchoNullableList(aList: aListArg) { result in + api.callFlutterEchoNullable(aListArg) { result in reply(wrapResult(result)) } } @@ -756,7 +756,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoNullableMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aMapArg = args[0] as? [String?: Any?] - api.callFlutterEchoNullableMap(aMap: aMapArg) { result in + api.callFlutterEchoNullable(aMapArg) { result in reply(wrapResult(result)) } } @@ -832,7 +832,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed object, to test serialization and deserialization. - func echoAllTypes(everything everythingArg: AllTypes, completion: @escaping (AllTypes) -> Void) { + func echo(_ everythingArg: AllTypes, completion: @escaping (AllTypes) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllTypes", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([everythingArg] as [Any?]) { response in let result = response as! AllTypes @@ -840,7 +840,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed object, to test serialization and deserialization. - func echoAllNullableTypes(everything everythingArg: AllNullableTypes, completion: @escaping (AllNullableTypes) -> Void) { + func echoNullable(_ everythingArg: AllNullableTypes, completion: @escaping (AllNullableTypes) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([everythingArg] as [Any?]) { response in let result = response as! AllNullableTypes @@ -850,7 +850,7 @@ class FlutterIntegrationCoreApi { /// Returns passed in arguments of multiple types. /// /// Tests multiple-arity FlutterApi handling. - func sendMultipleNullableTypes(aNullableBool aNullableBoolArg: Bool?, aNullableInt aNullableIntArg: Int32?, aNullableString aNullableStringArg: String?, completion: @escaping (AllNullableTypes) -> Void) { + func sendMultipleNullableTypes(aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int32?, aString aNullableStringArg: String?, completion: @escaping (AllNullableTypes) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.sendMultipleNullableTypes", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aNullableBoolArg, aNullableIntArg, aNullableStringArg] as [Any?]) { response in let result = response as! AllNullableTypes @@ -858,7 +858,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed boolean, to test serialization and deserialization. - func echoBool(aBool aBoolArg: Bool, completion: @escaping (Bool) -> Void) { + func echo(_ aBoolArg: Bool, completion: @escaping (Bool) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoBool", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aBoolArg] as [Any?]) { response in let result = response as! Bool @@ -866,7 +866,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed int, to test serialization and deserialization. - func echoInt(anInt anIntArg: Int32, completion: @escaping (Int32) -> Void) { + func echo(_ anIntArg: Int32, completion: @escaping (Int32) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoInt", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anIntArg] as [Any?]) { response in let result = response as! Int32 @@ -874,7 +874,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed double, to test serialization and deserialization. - func echoDouble(aDouble aDoubleArg: Double, completion: @escaping (Double) -> Void) { + func echo(_ aDoubleArg: Double, completion: @escaping (Double) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoDouble", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aDoubleArg] as [Any?]) { response in let result = response as! Double @@ -882,7 +882,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed string, to test serialization and deserialization. - func echoString(aString aStringArg: String, completion: @escaping (String) -> Void) { + func echo(_ aStringArg: String, completion: @escaping (String) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoString", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in let result = response as! String @@ -890,7 +890,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed byte list, to test serialization and deserialization. - func echoUint8List(aList aListArg: FlutterStandardTypedData, completion: @escaping (FlutterStandardTypedData) -> Void) { + func echo(_ aListArg: FlutterStandardTypedData, completion: @escaping (FlutterStandardTypedData) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoUint8List", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in let result = response as! FlutterStandardTypedData @@ -898,7 +898,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed list, to test serialization and deserialization. - func echoList(aList aListArg: [Any?], completion: @escaping ([Any?]) -> Void) { + func echo(_ aListArg: [Any?], completion: @escaping ([Any?]) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoList", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in let result = response as! [Any?] @@ -906,7 +906,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed map, to test serialization and deserialization. - func echoMap(aMap aMapArg: [String?: Any?], completion: @escaping ([String?: Any?]) -> Void) { + func echo(_ aMapArg: [String?: Any?], completion: @escaping ([String?: Any?]) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoMap", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aMapArg] as [Any?]) { response in let result = response as! [String?: Any?] @@ -914,7 +914,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed boolean, to test serialization and deserialization. - func echoNullableBool(aBool aBoolArg: Bool?, completion: @escaping (Bool?) -> Void) { + func echoNullable(_ aBoolArg: Bool?, completion: @escaping (Bool?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableBool", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aBoolArg] as [Any?]) { response in let result = response as? Bool @@ -922,7 +922,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed int, to test serialization and deserialization. - func echoNullableInt(anInt anIntArg: Int32?, completion: @escaping (Int32?) -> Void) { + func echoNullable(_ anIntArg: Int32?, completion: @escaping (Int32?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableInt", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anIntArg] as [Any?]) { response in let result = response as? Int32 @@ -930,7 +930,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed double, to test serialization and deserialization. - func echoNullableDouble(aDouble aDoubleArg: Double?, completion: @escaping (Double?) -> Void) { + func echoNullable(_ aDoubleArg: Double?, completion: @escaping (Double?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableDouble", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aDoubleArg] as [Any?]) { response in let result = response as? Double @@ -938,7 +938,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed string, to test serialization and deserialization. - func echoNullableString(aString aStringArg: String?, completion: @escaping (String?) -> Void) { + func echoNullable(_ aStringArg: String?, completion: @escaping (String?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableString", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in let result = response as? String @@ -946,7 +946,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed byte list, to test serialization and deserialization. - func echoNullableUint8List(aList aListArg: FlutterStandardTypedData?, completion: @escaping (FlutterStandardTypedData?) -> Void) { + func echoNullable(_ aListArg: FlutterStandardTypedData?, completion: @escaping (FlutterStandardTypedData?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableUint8List", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in let result = response as? FlutterStandardTypedData @@ -954,7 +954,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed list, to test serialization and deserialization. - func echoNullableList(aList aListArg: [Any?]?, completion: @escaping ([Any?]?) -> Void) { + func echoNullable(_ aListArg: [Any?]?, completion: @escaping ([Any?]?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in let result = response as? [Any?] @@ -962,7 +962,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed map, to test serialization and deserialization. - func echoNullableMap(aMap aMapArg: [String?: Any?]?, completion: @escaping ([String?: Any?]?) -> Void) { + func echoNullable(_ aMapArg: [String?: Any?]?, completion: @escaping ([String?: Any?]?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aMapArg] as [Any?]) { response in let result = response as? [String?: Any?] diff --git a/packages/pigeon/platform_tests/test_plugin/ios/Classes/TestPlugin.swift b/packages/pigeon/platform_tests/test_plugin/ios/Classes/TestPlugin.swift index 2dc0a96b045..edec42bc862 100644 --- a/packages/pigeon/platform_tests/test_plugin/ios/Classes/TestPlugin.swift +++ b/packages/pigeon/platform_tests/test_plugin/ios/Classes/TestPlugin.swift @@ -114,78 +114,78 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { } } - func callFlutterEchoAllTypes(everything: AllTypes, completion: @escaping (AllTypes) -> Void) { - flutterAPI.echoAllTypes(everything: everything) { completion($0) } + func callFlutterEcho(_ everything: AllTypes, completion: @escaping (AllTypes) -> Void) { + flutterAPI.echo(everything) { completion($0) } } func callFlutterSendMultipleNullableTypes( - aNullableBool: Bool?, - aNullableInt: Int32?, - aNullableString: String?, + aBool aNullableBool: Bool?, + anInt aNullableInt: Int32?, + aString aNullableString: String?, completion: @escaping (AllNullableTypes) -> Void ) { flutterAPI.sendMultipleNullableTypes( - aNullableBool: aNullableBool, - aNullableInt: aNullableInt, - aNullableString: aNullableString + aBool: aNullableBool, + anInt: aNullableInt, + aString: aNullableString ) { completion($0) } } - func callFlutterEchoBool(aBool: Bool, completion: @escaping (Bool) -> Void) { - flutterAPI.echoBool(aBool: aBool) { completion($0) } + func callFlutterEcho(_ aBool: Bool, completion: @escaping (Bool) -> Void) { + flutterAPI.echo(aBool) { completion($0) } } - func callFlutterEchoInt(anInt: Int32, completion: @escaping (Int32) -> Void) { - flutterAPI.echoInt(anInt: anInt) { completion($0) } + func callFlutterEcho(_ anInt: Int32, completion: @escaping (Int32) -> Void) { + flutterAPI.echo(anInt) { completion($0) } } - func callFlutterEchoDouble(aDouble: Double, completion: @escaping (Double) -> Void) { - flutterAPI.echoDouble(aDouble: aDouble) { completion($0) } + func callFlutterEcho(_ aDouble: Double, completion: @escaping (Double) -> Void) { + flutterAPI.echo(aDouble) { completion($0) } } - func callFlutterEchoString(aString: String, completion: @escaping (String) -> Void) { - flutterAPI.echoString(aString: aString) { completion($0) } + func callFlutterEcho(_ aString: String, completion: @escaping (String) -> Void) { + flutterAPI.echo(aString) { completion($0) } } - func callFlutterEchoUint8List(aList: FlutterStandardTypedData, completion: @escaping (FlutterStandardTypedData) -> Void) { - flutterAPI.echoUint8List(aList: aList) { completion($0) } + func callFlutterEcho(_ aList: FlutterStandardTypedData, completion: @escaping (FlutterStandardTypedData) -> Void) { + flutterAPI.echo(aList) { completion($0) } } - func callFlutterEchoList(aList: [Any?], completion: @escaping ([Any?]) -> Void) { - flutterAPI.echoList(aList: aList) { completion($0) } + func callFlutterEcho(_ aList: [Any?], completion: @escaping ([Any?]) -> Void) { + flutterAPI.echo(aList) { completion($0) } } - func callFlutterEchoMap(aMap: [String? : Any?], completion: @escaping ([String? : Any?]) -> Void) { - flutterAPI.echoMap(aMap: aMap) { completion($0) } + func callFlutterEcho(_ aMap: [String? : Any?], completion: @escaping ([String? : Any?]) -> Void) { + flutterAPI.echo(aMap) { completion($0) } } - func callFlutterEchoNullableBool(aBool: Bool?, completion: @escaping (Bool?) -> Void) { - flutterAPI.echoNullableBool(aBool: aBool) { completion($0) } + func callFlutterEchoNullable(_ aBool: Bool?, completion: @escaping (Bool?) -> Void) { + flutterAPI.echoNullable(aBool) { completion($0) } } - func callFlutterEchoNullableInt(anInt: Int32?, completion: @escaping (Int32?) -> Void) { - flutterAPI.echoNullableInt(anInt: anInt) { completion($0) } + func callFlutterEchoNullable(_ anInt: Int32?, completion: @escaping (Int32?) -> Void) { + flutterAPI.echoNullable(anInt) { completion($0) } } - func callFlutterEchoNullableDouble(aDouble: Double?, completion: @escaping (Double?) -> Void) { - flutterAPI.echoNullableDouble(aDouble: aDouble) { completion($0) } + func callFlutterEchoNullable(_ aDouble: Double?, completion: @escaping (Double?) -> Void) { + flutterAPI.echoNullable(aDouble) { completion($0) } } - func callFlutterEchoNullableString(aString: String?, completion: @escaping (String?) -> Void) { - flutterAPI.echoNullableString(aString: aString) { completion($0) } + func callFlutterEchoNullable(_ aString: String?, completion: @escaping (String?) -> Void) { + flutterAPI.echoNullable(aString) { completion($0) } } - func callFlutterEchoNullableUint8List(aList: FlutterStandardTypedData?, completion: @escaping (FlutterStandardTypedData?) -> Void) { - flutterAPI.echoNullableUint8List(aList: aList) { completion($0) } + func callFlutterEchoNullable(_ aList: FlutterStandardTypedData?, completion: @escaping (FlutterStandardTypedData?) -> Void) { + flutterAPI.echoNullable(aList) { completion($0) } } - func callFlutterEchoNullableList(aList: [Any?]?, completion: @escaping ([Any?]?) -> Void) { - flutterAPI.echoNullableList(aList: aList) { completion($0) } + func callFlutterEchoNullable(_ aList: [Any?]?, completion: @escaping ([Any?]?) -> Void) { + flutterAPI.echoNullable(aList) { completion($0) } } - func callFlutterEchoNullableMap(aMap: [String? : Any?]?, completion: @escaping ([String? : Any?]?) -> Void) { - flutterAPI.echoNullableMap(aMap: aMap) { completion($0) } + func callFlutterEchoNullable(_ aMap: [String? : Any?]?, completion: @escaping ([String? : Any?]?) -> Void) { + flutterAPI.echoNullable(aMap) { completion($0) } } } diff --git a/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift b/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift index c614cd656c0..0f3391283b9 100644 --- a/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift +++ b/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift @@ -238,65 +238,65 @@ protocol HostIntegrationCoreApi { /// test basic calling. func noop() /// Returns the passed object, to test serialization and deserialization. - func echoAllTypes(everything: AllTypes) -> AllTypes + func echo(_ everything: AllTypes) -> AllTypes /// Returns the passed object, to test serialization and deserialization. - func echoAllNullableTypes(everything: AllNullableTypes?) -> AllNullableTypes? + func echo(_ everything: AllNullableTypes?) -> AllNullableTypes? /// Returns an error, to test error handling. func throwError() /// Returns passed in int. - func echoInt(anInt: Int32) -> Int32 + func echo(_ anInt: Int32) -> Int32 /// Returns passed in double. - func echoDouble(aDouble: Double) -> Double + func echo(_ aDouble: Double) -> Double /// Returns the passed in boolean. - func echoBool(aBool: Bool) -> Bool + func echo(_ aBool: Bool) -> Bool /// Returns the passed in string. - func echoString(aString: String) -> String + func echo(_ aString: String) -> String /// Returns the passed in Uint8List. - func echoUint8List(aUint8List: FlutterStandardTypedData) -> FlutterStandardTypedData + func echo(_ aUint8List: FlutterStandardTypedData) -> FlutterStandardTypedData /// Returns the passed in generic Object. - func echoObject(anObject: Any) -> Any + func echo(_ anObject: Any) -> Any /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. - func extractNestedNullableString(wrapper: AllNullableTypesWrapper) -> String? + func extractNestedNullableString(from wrapper: AllNullableTypesWrapper) -> String? /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. - func createNestedNullableString(nullableString: String?) -> AllNullableTypesWrapper + func createNestedObject(with nullableString: String?) -> AllNullableTypesWrapper /// Returns passed in arguments of multiple types. - func sendMultipleNullableTypes(aNullableBool: Bool?, aNullableInt: Int32?, aNullableString: String?) -> AllNullableTypes + func sendMultipleNullableTypes(aBool aNullableBool: Bool?, anInt aNullableInt: Int32?, aString aNullableString: String?) -> AllNullableTypes /// Returns passed in int. - func echoNullableInt(aNullableInt: Int32?) -> Int32? + func echo(_ aNullableInt: Int32?) -> Int32? /// Returns passed in double. - func echoNullableDouble(aNullableDouble: Double?) -> Double? + func echo(_ aNullableDouble: Double?) -> Double? /// Returns the passed in boolean. - func echoNullableBool(aNullableBool: Bool?) -> Bool? + func echo(_ aNullableBool: Bool?) -> Bool? /// Returns the passed in string. - func echoNullableString(aNullableString: String?) -> String? + func echo(_ aNullableString: String?) -> String? /// Returns the passed in Uint8List. - func echoNullableUint8List(aNullableUint8List: FlutterStandardTypedData?) -> FlutterStandardTypedData? + func echo(_ aNullableUint8List: FlutterStandardTypedData?) -> FlutterStandardTypedData? /// Returns the passed in generic Object. - func echoNullableObject(aNullableObject: Any?) -> Any? + func echo(_ aNullableObject: Any?) -> Any? /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. func noopAsync(completion: @escaping () -> Void) /// Returns the passed string asynchronously. - func echoAsyncString(aString: String, completion: @escaping (String) -> Void) + func echoAsync(_ aString: String, completion: @escaping (String) -> Void) func callFlutterNoop(completion: @escaping () -> Void) - func callFlutterEchoAllTypes(everything: AllTypes, completion: @escaping (AllTypes) -> Void) - func callFlutterSendMultipleNullableTypes(aNullableBool: Bool?, aNullableInt: Int32?, aNullableString: String?, completion: @escaping (AllNullableTypes) -> Void) - func callFlutterEchoBool(aBool: Bool, completion: @escaping (Bool) -> Void) - func callFlutterEchoInt(anInt: Int32, completion: @escaping (Int32) -> Void) - func callFlutterEchoDouble(aDouble: Double, completion: @escaping (Double) -> Void) - func callFlutterEchoString(aString: String, completion: @escaping (String) -> Void) - func callFlutterEchoUint8List(aList: FlutterStandardTypedData, completion: @escaping (FlutterStandardTypedData) -> Void) - func callFlutterEchoList(aList: [Any?], completion: @escaping ([Any?]) -> Void) - func callFlutterEchoMap(aMap: [String?: Any?], completion: @escaping ([String?: Any?]) -> Void) - func callFlutterEchoNullableBool(aBool: Bool?, completion: @escaping (Bool?) -> Void) - func callFlutterEchoNullableInt(anInt: Int32?, completion: @escaping (Int32?) -> Void) - func callFlutterEchoNullableDouble(aDouble: Double?, completion: @escaping (Double?) -> Void) - func callFlutterEchoNullableString(aString: String?, completion: @escaping (String?) -> Void) - func callFlutterEchoNullableUint8List(aList: FlutterStandardTypedData?, completion: @escaping (FlutterStandardTypedData?) -> Void) - func callFlutterEchoNullableList(aList: [Any?]?, completion: @escaping ([Any?]?) -> Void) - func callFlutterEchoNullableMap(aMap: [String?: Any?]?, completion: @escaping ([String?: Any?]?) -> Void) + func callFlutterEcho(_ everything: AllTypes, completion: @escaping (AllTypes) -> Void) + func callFlutterSendMultipleNullableTypes(aBool aNullableBool: Bool?, anInt aNullableInt: Int32?, aString aNullableString: String?, completion: @escaping (AllNullableTypes) -> Void) + func callFlutterEcho(_ aBool: Bool, completion: @escaping (Bool) -> Void) + func callFlutterEcho(_ anInt: Int32, completion: @escaping (Int32) -> Void) + func callFlutterEcho(_ aDouble: Double, completion: @escaping (Double) -> Void) + func callFlutterEcho(_ aString: String, completion: @escaping (String) -> Void) + func callFlutterEcho(_ aList: FlutterStandardTypedData, completion: @escaping (FlutterStandardTypedData) -> Void) + func callFlutterEcho(_ aList: [Any?], completion: @escaping ([Any?]) -> Void) + func callFlutterEcho(_ aMap: [String?: Any?], completion: @escaping ([String?: Any?]) -> Void) + func callFlutterEchoNullable(_ aBool: Bool?, completion: @escaping (Bool?) -> Void) + func callFlutterEchoNullable(_ anInt: Int32?, completion: @escaping (Int32?) -> Void) + func callFlutterEchoNullable(_ aDouble: Double?, completion: @escaping (Double?) -> Void) + func callFlutterEchoNullable(_ aString: String?, completion: @escaping (String?) -> Void) + func callFlutterEchoNullable(_ aList: FlutterStandardTypedData?, completion: @escaping (FlutterStandardTypedData?) -> Void) + func callFlutterEchoNullable(_ aList: [Any?]?, completion: @escaping ([Any?]?) -> Void) + func callFlutterEchoNullable(_ aMap: [String?: Any?]?, completion: @escaping ([String?: Any?]?) -> Void) } /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. @@ -322,7 +322,7 @@ class HostIntegrationCoreApiSetup { echoAllTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let everythingArg = args[0] as! AllTypes - let result = api.echoAllTypes(everything: everythingArg) + let result = api.echo(everythingArg) reply(wrapResult(result)) } } else { @@ -334,7 +334,7 @@ class HostIntegrationCoreApiSetup { echoAllNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let everythingArg = args[0] as? AllNullableTypes - let result = api.echoAllNullableTypes(everything: everythingArg) + let result = api.echo(everythingArg) reply(wrapResult(result)) } } else { @@ -356,7 +356,7 @@ class HostIntegrationCoreApiSetup { echoIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anIntArg = args[0] as! Int32 - let result = api.echoInt(anInt: anIntArg) + let result = api.echo(anIntArg) reply(wrapResult(result)) } } else { @@ -368,7 +368,7 @@ class HostIntegrationCoreApiSetup { echoDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aDoubleArg = args[0] as! Double - let result = api.echoDouble(aDouble: aDoubleArg) + let result = api.echo(aDoubleArg) reply(wrapResult(result)) } } else { @@ -380,7 +380,7 @@ class HostIntegrationCoreApiSetup { echoBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aBoolArg = args[0] as! Bool - let result = api.echoBool(aBool: aBoolArg) + let result = api.echo(aBoolArg) reply(wrapResult(result)) } } else { @@ -392,7 +392,7 @@ class HostIntegrationCoreApiSetup { echoStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg = args[0] as! String - let result = api.echoString(aString: aStringArg) + let result = api.echo(aStringArg) reply(wrapResult(result)) } } else { @@ -404,7 +404,7 @@ class HostIntegrationCoreApiSetup { echoUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aUint8ListArg = args[0] as! FlutterStandardTypedData - let result = api.echoUint8List(aUint8List: aUint8ListArg) + let result = api.echo(aUint8ListArg) reply(wrapResult(result)) } } else { @@ -416,7 +416,7 @@ class HostIntegrationCoreApiSetup { echoObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anObjectArg = args[0]! - let result = api.echoObject(anObject: anObjectArg) + let result = api.echo(anObjectArg) reply(wrapResult(result)) } } else { @@ -429,7 +429,7 @@ class HostIntegrationCoreApiSetup { extractNestedNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let wrapperArg = args[0] as! AllNullableTypesWrapper - let result = api.extractNestedNullableString(wrapper: wrapperArg) + let result = api.extractNestedNullableString(from: wrapperArg) reply(wrapResult(result)) } } else { @@ -442,7 +442,7 @@ class HostIntegrationCoreApiSetup { createNestedNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let nullableStringArg = args[0] as? String - let result = api.createNestedNullableString(nullableString: nullableStringArg) + let result = api.createNestedObject(with: nullableStringArg) reply(wrapResult(result)) } } else { @@ -456,7 +456,7 @@ class HostIntegrationCoreApiSetup { let aNullableBoolArg = args[0] as? Bool let aNullableIntArg = args[1] as? Int32 let aNullableStringArg = args[2] as? String - let result = api.sendMultipleNullableTypes(aNullableBool: aNullableBoolArg, aNullableInt: aNullableIntArg, aNullableString: aNullableStringArg) + let result = api.sendMultipleNullableTypes(aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg) reply(wrapResult(result)) } } else { @@ -468,7 +468,7 @@ class HostIntegrationCoreApiSetup { echoNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableIntArg = args[0] as? Int32 - let result = api.echoNullableInt(aNullableInt: aNullableIntArg) + let result = api.echo(aNullableIntArg) reply(wrapResult(result)) } } else { @@ -480,7 +480,7 @@ class HostIntegrationCoreApiSetup { echoNullableDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableDoubleArg = args[0] as? Double - let result = api.echoNullableDouble(aNullableDouble: aNullableDoubleArg) + let result = api.echo(aNullableDoubleArg) reply(wrapResult(result)) } } else { @@ -492,7 +492,7 @@ class HostIntegrationCoreApiSetup { echoNullableBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableBoolArg = args[0] as? Bool - let result = api.echoNullableBool(aNullableBool: aNullableBoolArg) + let result = api.echo(aNullableBoolArg) reply(wrapResult(result)) } } else { @@ -504,7 +504,7 @@ class HostIntegrationCoreApiSetup { echoNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableStringArg = args[0] as? String - let result = api.echoNullableString(aNullableString: aNullableStringArg) + let result = api.echo(aNullableStringArg) reply(wrapResult(result)) } } else { @@ -516,7 +516,7 @@ class HostIntegrationCoreApiSetup { echoNullableUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableUint8ListArg = args[0] as? FlutterStandardTypedData - let result = api.echoNullableUint8List(aNullableUint8List: aNullableUint8ListArg) + let result = api.echo(aNullableUint8ListArg) reply(wrapResult(result)) } } else { @@ -528,7 +528,7 @@ class HostIntegrationCoreApiSetup { echoNullableObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableObjectArg = args[0] - let result = api.echoNullableObject(aNullableObject: aNullableObjectArg) + let result = api.echo(aNullableObjectArg) reply(wrapResult(result)) } } else { @@ -552,7 +552,7 @@ class HostIntegrationCoreApiSetup { echoAsyncStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg = args[0] as! String - api.echoAsyncString(aString: aStringArg) { result in + api.echoAsync(aStringArg) { result in reply(wrapResult(result)) } } @@ -574,7 +574,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoAllTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let everythingArg = args[0] as! AllTypes - api.callFlutterEchoAllTypes(everything: everythingArg) { result in + api.callFlutterEcho(everythingArg) { result in reply(wrapResult(result)) } } @@ -588,7 +588,7 @@ class HostIntegrationCoreApiSetup { let aNullableBoolArg = args[0] as? Bool let aNullableIntArg = args[1] as? Int32 let aNullableStringArg = args[2] as? String - api.callFlutterSendMultipleNullableTypes(aNullableBool: aNullableBoolArg, aNullableInt: aNullableIntArg, aNullableString: aNullableStringArg) { result in + api.callFlutterSendMultipleNullableTypes(aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg) { result in reply(wrapResult(result)) } } @@ -600,7 +600,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aBoolArg = args[0] as! Bool - api.callFlutterEchoBool(aBool: aBoolArg) { result in + api.callFlutterEcho(aBoolArg) { result in reply(wrapResult(result)) } } @@ -612,7 +612,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anIntArg = args[0] as! Int32 - api.callFlutterEchoInt(anInt: anIntArg) { result in + api.callFlutterEcho(anIntArg) { result in reply(wrapResult(result)) } } @@ -624,7 +624,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aDoubleArg = args[0] as! Double - api.callFlutterEchoDouble(aDouble: aDoubleArg) { result in + api.callFlutterEcho(aDoubleArg) { result in reply(wrapResult(result)) } } @@ -636,7 +636,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg = args[0] as! String - api.callFlutterEchoString(aString: aStringArg) { result in + api.callFlutterEcho(aStringArg) { result in reply(wrapResult(result)) } } @@ -648,7 +648,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aListArg = args[0] as! FlutterStandardTypedData - api.callFlutterEchoUint8List(aList: aListArg) { result in + api.callFlutterEcho(aListArg) { result in reply(wrapResult(result)) } } @@ -660,7 +660,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aListArg = args[0] as! [Any?] - api.callFlutterEchoList(aList: aListArg) { result in + api.callFlutterEcho(aListArg) { result in reply(wrapResult(result)) } } @@ -672,7 +672,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aMapArg = args[0] as! [String?: Any?] - api.callFlutterEchoMap(aMap: aMapArg) { result in + api.callFlutterEcho(aMapArg) { result in reply(wrapResult(result)) } } @@ -684,7 +684,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoNullableBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aBoolArg = args[0] as? Bool - api.callFlutterEchoNullableBool(aBool: aBoolArg) { result in + api.callFlutterEchoNullable(aBoolArg) { result in reply(wrapResult(result)) } } @@ -696,7 +696,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anIntArg = args[0] as? Int32 - api.callFlutterEchoNullableInt(anInt: anIntArg) { result in + api.callFlutterEchoNullable(anIntArg) { result in reply(wrapResult(result)) } } @@ -708,7 +708,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoNullableDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aDoubleArg = args[0] as? Double - api.callFlutterEchoNullableDouble(aDouble: aDoubleArg) { result in + api.callFlutterEchoNullable(aDoubleArg) { result in reply(wrapResult(result)) } } @@ -720,7 +720,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg = args[0] as? String - api.callFlutterEchoNullableString(aString: aStringArg) { result in + api.callFlutterEchoNullable(aStringArg) { result in reply(wrapResult(result)) } } @@ -732,7 +732,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoNullableUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aListArg = args[0] as? FlutterStandardTypedData - api.callFlutterEchoNullableUint8List(aList: aListArg) { result in + api.callFlutterEchoNullable(aListArg) { result in reply(wrapResult(result)) } } @@ -744,7 +744,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoNullableListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aListArg = args[0] as? [Any?] - api.callFlutterEchoNullableList(aList: aListArg) { result in + api.callFlutterEchoNullable(aListArg) { result in reply(wrapResult(result)) } } @@ -756,7 +756,7 @@ class HostIntegrationCoreApiSetup { callFlutterEchoNullableMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aMapArg = args[0] as? [String?: Any?] - api.callFlutterEchoNullableMap(aMap: aMapArg) { result in + api.callFlutterEchoNullable(aMapArg) { result in reply(wrapResult(result)) } } @@ -832,7 +832,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed object, to test serialization and deserialization. - func echoAllTypes(everything everythingArg: AllTypes, completion: @escaping (AllTypes) -> Void) { + func echo(_ everythingArg: AllTypes, completion: @escaping (AllTypes) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllTypes", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([everythingArg] as [Any?]) { response in let result = response as! AllTypes @@ -840,7 +840,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed object, to test serialization and deserialization. - func echoAllNullableTypes(everything everythingArg: AllNullableTypes, completion: @escaping (AllNullableTypes) -> Void) { + func echoNullable(_ everythingArg: AllNullableTypes, completion: @escaping (AllNullableTypes) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([everythingArg] as [Any?]) { response in let result = response as! AllNullableTypes @@ -850,7 +850,7 @@ class FlutterIntegrationCoreApi { /// Returns passed in arguments of multiple types. /// /// Tests multiple-arity FlutterApi handling. - func sendMultipleNullableTypes(aNullableBool aNullableBoolArg: Bool?, aNullableInt aNullableIntArg: Int32?, aNullableString aNullableStringArg: String?, completion: @escaping (AllNullableTypes) -> Void) { + func sendMultipleNullableTypes(aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int32?, aString aNullableStringArg: String?, completion: @escaping (AllNullableTypes) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.sendMultipleNullableTypes", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aNullableBoolArg, aNullableIntArg, aNullableStringArg] as [Any?]) { response in let result = response as! AllNullableTypes @@ -858,7 +858,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed boolean, to test serialization and deserialization. - func echoBool(aBool aBoolArg: Bool, completion: @escaping (Bool) -> Void) { + func echo(_ aBoolArg: Bool, completion: @escaping (Bool) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoBool", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aBoolArg] as [Any?]) { response in let result = response as! Bool @@ -866,7 +866,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed int, to test serialization and deserialization. - func echoInt(anInt anIntArg: Int32, completion: @escaping (Int32) -> Void) { + func echo(_ anIntArg: Int32, completion: @escaping (Int32) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoInt", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anIntArg] as [Any?]) { response in let result = response as! Int32 @@ -874,7 +874,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed double, to test serialization and deserialization. - func echoDouble(aDouble aDoubleArg: Double, completion: @escaping (Double) -> Void) { + func echo(_ aDoubleArg: Double, completion: @escaping (Double) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoDouble", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aDoubleArg] as [Any?]) { response in let result = response as! Double @@ -882,7 +882,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed string, to test serialization and deserialization. - func echoString(aString aStringArg: String, completion: @escaping (String) -> Void) { + func echo(_ aStringArg: String, completion: @escaping (String) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoString", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in let result = response as! String @@ -890,7 +890,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed byte list, to test serialization and deserialization. - func echoUint8List(aList aListArg: FlutterStandardTypedData, completion: @escaping (FlutterStandardTypedData) -> Void) { + func echo(_ aListArg: FlutterStandardTypedData, completion: @escaping (FlutterStandardTypedData) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoUint8List", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in let result = response as! FlutterStandardTypedData @@ -898,7 +898,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed list, to test serialization and deserialization. - func echoList(aList aListArg: [Any?], completion: @escaping ([Any?]) -> Void) { + func echo(_ aListArg: [Any?], completion: @escaping ([Any?]) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoList", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in let result = response as! [Any?] @@ -906,7 +906,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed map, to test serialization and deserialization. - func echoMap(aMap aMapArg: [String?: Any?], completion: @escaping ([String?: Any?]) -> Void) { + func echo(_ aMapArg: [String?: Any?], completion: @escaping ([String?: Any?]) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoMap", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aMapArg] as [Any?]) { response in let result = response as! [String?: Any?] @@ -914,7 +914,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed boolean, to test serialization and deserialization. - func echoNullableBool(aBool aBoolArg: Bool?, completion: @escaping (Bool?) -> Void) { + func echoNullable(_ aBoolArg: Bool?, completion: @escaping (Bool?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableBool", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aBoolArg] as [Any?]) { response in let result = response as? Bool @@ -922,7 +922,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed int, to test serialization and deserialization. - func echoNullableInt(anInt anIntArg: Int32?, completion: @escaping (Int32?) -> Void) { + func echoNullable(_ anIntArg: Int32?, completion: @escaping (Int32?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableInt", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anIntArg] as [Any?]) { response in let result = response as? Int32 @@ -930,7 +930,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed double, to test serialization and deserialization. - func echoNullableDouble(aDouble aDoubleArg: Double?, completion: @escaping (Double?) -> Void) { + func echoNullable(_ aDoubleArg: Double?, completion: @escaping (Double?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableDouble", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aDoubleArg] as [Any?]) { response in let result = response as? Double @@ -938,7 +938,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed string, to test serialization and deserialization. - func echoNullableString(aString aStringArg: String?, completion: @escaping (String?) -> Void) { + func echoNullable(_ aStringArg: String?, completion: @escaping (String?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableString", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in let result = response as? String @@ -946,7 +946,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed byte list, to test serialization and deserialization. - func echoNullableUint8List(aList aListArg: FlutterStandardTypedData?, completion: @escaping (FlutterStandardTypedData?) -> Void) { + func echoNullable(_ aListArg: FlutterStandardTypedData?, completion: @escaping (FlutterStandardTypedData?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableUint8List", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in let result = response as? FlutterStandardTypedData @@ -954,7 +954,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed list, to test serialization and deserialization. - func echoNullableList(aList aListArg: [Any?]?, completion: @escaping ([Any?]?) -> Void) { + func echoNullable(_ aListArg: [Any?]?, completion: @escaping ([Any?]?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in let result = response as? [Any?] @@ -962,7 +962,7 @@ class FlutterIntegrationCoreApi { } } /// Returns the passed map, to test serialization and deserialization. - func echoNullableMap(aMap aMapArg: [String?: Any?]?, completion: @escaping ([String?: Any?]?) -> Void) { + func echoNullable(_ aMapArg: [String?: Any?]?, completion: @escaping ([String?: Any?]?) -> Void) { let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap", binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aMapArg] as [Any?]) { response in let result = response as? [String?: Any?] diff --git a/packages/pigeon/platform_tests/test_plugin/macos/Classes/TestPlugin.swift b/packages/pigeon/platform_tests/test_plugin/macos/Classes/TestPlugin.swift index 49aaf4d51e3..4075a3d1bf7 100644 --- a/packages/pigeon/platform_tests/test_plugin/macos/Classes/TestPlugin.swift +++ b/packages/pigeon/platform_tests/test_plugin/macos/Classes/TestPlugin.swift @@ -114,78 +114,78 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { } } - func callFlutterEchoAllTypes(everything: AllTypes, completion: @escaping (AllTypes) -> Void) { - flutterAPI.echoAllTypes(everything: everything) { completion($0) } + func callFlutterEcho(_ everything: AllTypes, completion: @escaping (AllTypes) -> Void) { + flutterAPI.echo(everything) { completion($0) } } func callFlutterSendMultipleNullableTypes( - aNullableBool: Bool?, - aNullableInt: Int32?, - aNullableString: String?, + aBool aNullableBool: Bool?, + anInt aNullableInt: Int32?, + aString aNullableString: String?, completion: @escaping (AllNullableTypes) -> Void ) { flutterAPI.sendMultipleNullableTypes( - aNullableBool: aNullableBool, - aNullableInt: aNullableInt, - aNullableString: aNullableString + aBool: aNullableBool, + anInt: aNullableInt, + aString: aNullableString ) { completion($0) } } - func callFlutterEchoBool(aBool: Bool, completion: @escaping (Bool) -> Void) { - flutterAPI.echoBool(aBool: aBool) { completion($0) } + func callFlutterEcho(_ aBool: Bool, completion: @escaping (Bool) -> Void) { + flutterAPI.echo(aBool) { completion($0) } } - func callFlutterEchoInt(anInt: Int32, completion: @escaping (Int32) -> Void) { - flutterAPI.echoInt(anInt: anInt) { completion($0) } + func callFlutterEcho(_ anInt: Int32, completion: @escaping (Int32) -> Void) { + flutterAPI.echo(anInt) { completion($0) } } - func callFlutterEchoDouble(aDouble: Double, completion: @escaping (Double) -> Void) { - flutterAPI.echoDouble(aDouble: aDouble) { completion($0) } + func callFlutterEcho(_ aDouble: Double, completion: @escaping (Double) -> Void) { + flutterAPI.echo(aDouble) { completion($0) } } - func callFlutterEchoString(aString: String, completion: @escaping (String) -> Void) { - flutterAPI.echoString(aString: aString) { completion($0) } + func callFlutterEcho(_ aString: String, completion: @escaping (String) -> Void) { + flutterAPI.echo(aString) { completion($0) } } - func callFlutterEchoUint8List(aList: FlutterStandardTypedData, completion: @escaping (FlutterStandardTypedData) -> Void) { - flutterAPI.echoUint8List(aList: aList) { completion($0) } + func callFlutterEcho(_ aList: FlutterStandardTypedData, completion: @escaping (FlutterStandardTypedData) -> Void) { + flutterAPI.echo(aList) { completion($0) } } - func callFlutterEchoList(aList: [Any?], completion: @escaping ([Any?]) -> Void) { - flutterAPI.echoList(aList: aList) { completion($0) } + func callFlutterEcho(_ aList: [Any?], completion: @escaping ([Any?]) -> Void) { + flutterAPI.echo(aList) { completion($0) } } - func callFlutterEchoMap(aMap: [String? : Any?], completion: @escaping ([String? : Any?]) -> Void) { - flutterAPI.echoMap(aMap: aMap) { completion($0) } + func callFlutterEcho(_ aMap: [String? : Any?], completion: @escaping ([String? : Any?]) -> Void) { + flutterAPI.echo(aMap) { completion($0) } } - func callFlutterEchoNullableBool(aBool: Bool?, completion: @escaping (Bool?) -> Void) { - flutterAPI.echoNullableBool(aBool: aBool) { completion($0) } + func callFlutterEchoNullable(_ aBool: Bool?, completion: @escaping (Bool?) -> Void) { + flutterAPI.echoNullable(aBool) { completion($0) } } - func callFlutterEchoNullableInt(anInt: Int32?, completion: @escaping (Int32?) -> Void) { - flutterAPI.echoNullableInt(anInt: anInt) { completion($0) } + func callFlutterEchoNullable(_ anInt: Int32?, completion: @escaping (Int32?) -> Void) { + flutterAPI.echoNullable(anInt) { completion($0) } } - func callFlutterEchoNullableDouble(aDouble: Double?, completion: @escaping (Double?) -> Void) { - flutterAPI.echoNullableDouble(aDouble: aDouble) { completion($0) } + func callFlutterEchoNullable(_ aDouble: Double?, completion: @escaping (Double?) -> Void) { + flutterAPI.echoNullable(aDouble) { completion($0) } } - func callFlutterEchoNullableString(aString: String?, completion: @escaping (String?) -> Void) { - flutterAPI.echoNullableString(aString: aString) { completion($0) } + func callFlutterEchoNullable(_ aString: String?, completion: @escaping (String?) -> Void) { + flutterAPI.echoNullable(aString) { completion($0) } } - func callFlutterEchoNullableUint8List(aList: FlutterStandardTypedData?, completion: @escaping (FlutterStandardTypedData?) -> Void) { - flutterAPI.echoNullableUint8List(aList: aList) { completion($0) } + func callFlutterEchoNullable(_ aList: FlutterStandardTypedData?, completion: @escaping (FlutterStandardTypedData?) -> Void) { + flutterAPI.echoNullable(aList) { completion($0) } } - func callFlutterEchoNullableList(aList: [Any?]?, completion: @escaping ([Any?]?) -> Void) { - flutterAPI.echoNullableList(aList: aList) { completion($0) } + func callFlutterEchoNullable(_ aList: [Any?]?, completion: @escaping ([Any?]?) -> Void) { + flutterAPI.echoNullable(aList) { completion($0) } } - func callFlutterEchoNullableMap(aMap: [String? : Any?]?, completion: @escaping ([String? : Any?]?) -> Void) { - flutterAPI.echoNullableMap(aMap: aMap) { completion($0) } + func callFlutterEchoNullable(_ aMap: [String? : Any?]?, completion: @escaping ([String? : Any?]?) -> Void) { + flutterAPI.echoNullable(aMap) { completion($0) } } } From 245a3278539d7e4dd7506b92359c2740aff348a2 Mon Sep 17 00:00:00 2001 From: Ailton Vieira Pinto Filho Date: Thu, 26 Jan 2023 08:29:50 -0300 Subject: [PATCH 26/26] Fix SwiftFunction documentation --- packages/pigeon/lib/pigeon_lib.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pigeon/lib/pigeon_lib.dart b/packages/pigeon/lib/pigeon_lib.dart index 17490b7b487..58fb6bb7378 100644 --- a/packages/pigeon/lib/pigeon_lib.dart +++ b/packages/pigeon/lib/pigeon_lib.dart @@ -105,7 +105,7 @@ class ObjCSelector { /// The number of components in the provided signature must match the number of /// arguments in the annotated method. /// For example: -/// @SwiftFunction('setValue(_:for:)') double divide(int value, String key); +/// @SwiftFunction('divide(_:by:)') double divide(int x, String y); class SwiftFunction { /// Constructor. const SwiftFunction(this.value);