[pigeon] Adds SwiftFunction annotation (#2304)

* Add SwiftFunction annotation

* Bump version to 3.2.4

* Remove unused imports

* Improve methods map

* Remove unnecessary print

* Force cast match of SwiftFunction

* Update packages/pigeon/lib/pigeon_lib.dart

Co-authored-by: gaaclarke <30870216+gaaclarke@users.noreply.github.com>

* Improve documentation of function to parse method with SwiftFunction

* Fix some dartdocs

* gen

* analyze

* Improve SwiftFunction application

* Add type annotation

* format

* Run format

* Update macos Swift tests

* Bump version to 7.0.0

* revert version change

* Improve some code of SwiftGenerator

* Bump version to 6.1.0

* Improve echo functions for Swift

* Match order of parameters

* Documents _SwiftFunctionComponents.fromMethod and _SwiftFunctionArgument

* Improve doc comments

* Fix tests

* Fix SwiftFunction documentation

Co-authored-by: gaaclarke <30870216+gaaclarke@users.noreply.github.com>
Co-authored-by: tarrinneal <tarrinneal@gmail.com>
This commit is contained in:
Ailton Vieira Pinto Filho
2023-01-26 12:59:24 -03:00
committed by GitHub
parent add4d18c62
commit 2d05534406
22 changed files with 698 additions and 316 deletions

View File

@ -1,3 +1,7 @@
## 7.1.0
* Adds `@SwiftFunction` annotation for specifying custom swift function signature.
## 7.0.5 ## 7.0.5
* Requires analyzer 5.0.0 and replaces use of deprecated APIs. * Requires analyzer 5.0.0 and replaces use of deprecated APIs.

View File

@ -32,6 +32,7 @@ class Method extends Node {
this.isAsynchronous = false, this.isAsynchronous = false,
this.offset, this.offset,
this.objcSelector = '', this.objcSelector = '',
this.swiftFunction = '',
this.taskQueueType = TaskQueueType.serial, this.taskQueueType = TaskQueueType.serial,
this.documentationComments = const <String>[], this.documentationComments = const <String>[],
}); });
@ -54,6 +55,9 @@ class Method extends Node {
/// An override for the generated objc selector (ex. "divideNumber:by:"). /// An override for the generated objc selector (ex. "divideNumber:by:").
String objcSelector; String objcSelector;
/// An override for the generated swift function signature (ex. "divideNumber(_:by:)").
String swiftFunction;
/// Specifies how handlers are dispatched with respect to threading. /// Specifies how handlers are dispatched with respect to threading.
TaskQueueType taskQueueType; TaskQueueType taskQueueType;
@ -68,7 +72,9 @@ class Method extends Node {
String toString() { String toString() {
final String objcSelectorStr = final String objcSelectorStr =
objcSelector.isEmpty ? '' : ' objcSelector:$objcSelector'; objcSelector.isEmpty ? '' : ' objcSelector:$objcSelector';
return '(Method name:$name returnType:$returnType arguments:$arguments isAsynchronous:$isAsynchronous$objcSelectorStr documentationComments:$documentationComments)'; final String swiftFunctionStr =
swiftFunction.isEmpty ? '' : ' swiftFunction:$swiftFunction';
return '(Method name:$name returnType:$returnType arguments:$arguments isAsynchronous:$isAsynchronous$objcSelectorStr$swiftFunctionStr documentationComments:$documentationComments)';
} }
} }

View File

@ -11,7 +11,7 @@ import 'ast.dart';
/// The current version of pigeon. /// The current version of pigeon.
/// ///
/// This must match the version in pubspec.yaml. /// This must match the version in pubspec.yaml.
const String pigeonVersion = '7.0.5'; const String pigeonVersion = '7.1.0';
/// Read all the content from [stdin] to a String. /// Read all the content from [stdin] to a String.
String readStdin() { String readStdin() {

View File

@ -100,6 +100,20 @@ class ObjCSelector {
final String value; final String value;
} }
/// 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:
/// @SwiftFunction('divide(_:by:)') double divide(int x, String y);
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 /// Type of TaskQueue which determines how handlers are dispatched for
/// HostApi's. /// HostApi's.
enum TaskQueueType { enum TaskQueueType {
@ -724,6 +738,17 @@ List<Error> _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 && if (method.taskQueueType != TaskQueueType.serial &&
api.location != ApiLocation.host) { api.location != ApiLocation.host) {
result.add(Error( result.add(Error(
@ -1026,6 +1051,13 @@ class _RootBuilder extends dart_ast_visitor.RecursiveAstVisitor<Object?> {
.asNullable<dart_ast.SimpleStringLiteral>() .asNullable<dart_ast.SimpleStringLiteral>()
?.value ?? ?.value ??
''; '';
final String swiftFunction = _findMetadata(node.metadata, 'SwiftFunction')
?.arguments
?.arguments
.first
.asNullable<dart_ast.SimpleStringLiteral>()
?.value ??
'';
final dart_ast.ArgumentList? taskQueueArguments = final dart_ast.ArgumentList? taskQueueArguments =
_findMetadata(node.metadata, 'TaskQueue')?.arguments; _findMetadata(node.metadata, 'TaskQueue')?.arguments;
final String? taskQueueTypeName = taskQueueArguments == null final String? taskQueueTypeName = taskQueueArguments == null
@ -1054,6 +1086,7 @@ class _RootBuilder extends dart_ast_visitor.RecursiveAstVisitor<Object?> {
arguments: arguments, arguments: arguments,
isAsynchronous: isAsynchronous, isAsynchronous: isAsynchronous,
objcSelector: objcSelector, objcSelector: objcSelector,
swiftFunction: swiftFunction,
offset: node.offset, offset: node.offset,
taskQueueType: taskQueueType, taskQueueType: taskQueueType,
documentationComments: documentationComments:

View File

@ -294,6 +294,9 @@ import FlutterMacOS
}); });
} }
for (final Method func in api.methods) { for (final Method func in api.methods) {
final _SwiftFunctionComponents components =
_SwiftFunctionComponents.fromMethod(func);
final String channelName = makeChannelName(api, func); final String channelName = makeChannelName(api, func);
final String returnType = func.returnType.isVoid final String returnType = func.returnType.isVoid
? '' ? ''
@ -309,8 +312,11 @@ import FlutterMacOS
} else { } else {
final Iterable<String> argTypes = func.arguments final Iterable<String> argTypes = func.arguments
.map((NamedType e) => _nullsafeSwiftTypeForDartType(e.type)); .map((NamedType e) => _nullsafeSwiftTypeForDartType(e.type));
final Iterable<String> argLabels = final Iterable<String> argLabels = indexMap(components.arguments,
indexMap(func.arguments, _getArgumentName); (int index, _SwiftFunctionArgument argument) {
return argument.label ??
_getArgumentName(index, argument.namedType);
});
final Iterable<String> argNames = final Iterable<String> argNames =
indexMap(func.arguments, _getSafeArgumentName); indexMap(func.arguments, _getSafeArgumentName);
sendArgument = '[${argNames.join(', ')}] as [Any?]'; sendArgument = '[${argNames.join(', ')}] as [Any?]';
@ -322,10 +328,10 @@ import FlutterMacOS
'$label $name: $type').join(', '); '$label $name: $type').join(', ');
if (func.returnType.isVoid) { if (func.returnType.isVoid) {
indent.write( indent.write(
'func ${func.name}($argsSignature, completion: @escaping () -> Void) '); 'func ${components.name}($argsSignature, completion: @escaping () -> Void) ');
} else { } else {
indent.write( indent.write(
'func ${func.name}($argsSignature, completion: @escaping ($returnType) -> Void) '); 'func ${components.name}($argsSignature, completion: @escaping ($returnType) -> Void) ');
} }
} }
indent.addScoped('{', '}', () { indent.addScoped('{', '}', () {
@ -369,7 +375,6 @@ import FlutterMacOS
if (isCustomCodec) { if (isCustomCodec) {
_writeCodec(indent, api, root); _writeCodec(indent, api, root);
} }
const List<String> generatedComments = <String>[ const List<String> generatedComments = <String>[
' Generated protocol from Pigeon that represents a handler of messages from Flutter.' ' Generated protocol from Pigeon that represents a handler of messages from Flutter.'
]; ];
@ -379,17 +384,15 @@ import FlutterMacOS
indent.write('protocol $apiName '); indent.write('protocol $apiName ');
indent.addScoped('{', '}', () { indent.addScoped('{', '}', () {
for (final Method method in api.methods) { for (final Method method in api.methods) {
final List<String> argSignature = <String>[]; final _SwiftFunctionComponents components =
if (method.arguments.isNotEmpty) { _SwiftFunctionComponents.fromMethod(method);
final Iterable<String> argTypes = method.arguments final List<String> argSignature =
.map((NamedType e) => _nullsafeSwiftTypeForDartType(e.type)); components.arguments.map((_SwiftFunctionArgument argument) {
final Iterable<String> argNames = final String? label = argument.label;
method.arguments.map((NamedType e) => e.name); final String name = argument.name;
argSignature.addAll( final String type = _nullsafeSwiftTypeForDartType(argument.type);
map2(argTypes, argNames, (String argType, String argName) { return '${label == null ? '' : '$label '}$name: $type';
return '$argName: $argType'; }).toList();
}));
}
final String returnType = method.returnType.isVoid final String returnType = method.returnType.isVoid
? '' ? ''
@ -399,12 +402,12 @@ import FlutterMacOS
if (method.isAsynchronous) { if (method.isAsynchronous) {
argSignature.add('completion: @escaping ($returnType) -> Void'); 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) { } else if (method.returnType.isVoid) {
indent.writeln('func ${method.name}(${argSignature.join(', ')})'); indent.writeln('func ${components.name}(${argSignature.join(', ')})');
} else { } else {
indent.writeln( indent.writeln(
'func ${method.name}(${argSignature.join(', ')}) -> $returnType'); 'func ${components.name}(${argSignature.join(', ')}) -> $returnType');
} }
} }
}); });
@ -428,6 +431,9 @@ import FlutterMacOS
'static func setUp(binaryMessenger: FlutterBinaryMessenger, api: $apiName?) '); 'static func setUp(binaryMessenger: FlutterBinaryMessenger, api: $apiName?) ');
indent.addScoped('{', '}', () { indent.addScoped('{', '}', () {
for (final Method method in api.methods) { for (final Method method in api.methods) {
final _SwiftFunctionComponents components =
_SwiftFunctionComponents.fromMethod(method);
final String channelName = makeChannelName(api, method); final String channelName = makeChannelName(api, method);
final String varChannelName = '${method.name}Channel'; final String varChannelName = '${method.name}Channel';
addDocumentationComments( addDocumentationComments(
@ -442,18 +448,25 @@ import FlutterMacOS
method.arguments.isNotEmpty ? 'message' : '_'; method.arguments.isNotEmpty ? 'message' : '_';
indent.addScoped('{ $messageVarName, reply in', '}', () { indent.addScoped('{ $messageVarName, reply in', '}', () {
final List<String> methodArgument = <String>[]; final List<String> methodArgument = <String>[];
if (method.arguments.isNotEmpty) { if (components.arguments.isNotEmpty) {
indent.writeln('let args = message as! [Any?]'); indent.writeln('let args = message as! [Any?]');
enumerate(method.arguments, (int index, NamedType arg) { enumerate(components.arguments,
final String argName = _getSafeArgumentName(index, arg); (int index, _SwiftFunctionArgument arg) {
final String argName =
_getSafeArgumentName(index, arg.namedType);
final String argIndex = 'args[$index]'; final String argIndex = 'args[$index]';
indent.writeln( indent.writeln(
'let $argName = ${_castForceUnwrap(argIndex, arg.type, root)}'); 'let $argName = ${_castForceUnwrap(argIndex, arg.type, root)}');
methodArgument.add('${arg.name}: $argName');
if (arg.label == '_') {
methodArgument.add(argName);
} else {
methodArgument.add('${arg.label ?? arg.name}: $argName');
}
}); });
} }
final String call = final String call =
'api.${method.name}(${methodArgument.join(', ')})'; 'api.${components.name}(${methodArgument.join(', ')})';
if (method.isAsynchronous) { if (method.isAsynchronous) {
indent.write('$call '); indent.write('$call ');
if (method.returnType.isVoid) { if (method.returnType.isVoid) {
@ -695,3 +708,87 @@ String _nullsafeSwiftTypeForDartType(TypeDeclaration type) {
final String nullSafe = type.isNullable ? '?' : ''; final String nullSafe = type.isNullable ? '?' : '';
return '${_swiftTypeForDartType(type)}$nullSafe'; 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,
required this.type,
required this.namedType,
this.label,
});
final String name;
final TypeDeclaration type;
final NamedType namedType;
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,
required this.arguments,
required this.returnType,
required this.method,
});
/// Constructor that generates a [_SwiftFunctionComponents] from a [Method].
factory _SwiftFunctionComponents.fromMethod(Method method) {
if (method.swiftFunction.isEmpty) {
return _SwiftFunctionComponents._(
name: method.name,
returnType: method.returnType,
arguments: method.arguments
.map((NamedType field) => _SwiftFunctionArgument(
name: field.name,
type: field.type,
namedType: field,
))
.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<String> labels = match
.groups(List<int>.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;
final List<_SwiftFunctionArgument> arguments;
final TypeDeclaration returnType;
final Method method;
}

View File

@ -96,10 +96,12 @@ abstract class HostIntegrationCoreApi {
/// Returns the passed object, to test serialization and deserialization. /// Returns the passed object, to test serialization and deserialization.
@ObjCSelector('echoAllTypes:') @ObjCSelector('echoAllTypes:')
@SwiftFunction('echo(_:)')
AllTypes echoAllTypes(AllTypes everything); AllTypes echoAllTypes(AllTypes everything);
/// Returns the passed object, to test serialization and deserialization. /// Returns the passed object, to test serialization and deserialization.
@ObjCSelector('echoAllNullableTypes:') @ObjCSelector('echoAllNullableTypes:')
@SwiftFunction('echo(_:)')
AllNullableTypes? echoAllNullableTypes(AllNullableTypes? everything); AllNullableTypes? echoAllNullableTypes(AllNullableTypes? everything);
/// Returns an error, to test error handling. /// Returns an error, to test error handling.
@ -107,26 +109,32 @@ abstract class HostIntegrationCoreApi {
/// Returns passed in int. /// Returns passed in int.
@ObjCSelector('echoInt:') @ObjCSelector('echoInt:')
@SwiftFunction('echo(_:)')
int echoInt(int anInt); int echoInt(int anInt);
/// Returns passed in double. /// Returns passed in double.
@ObjCSelector('echoDouble:') @ObjCSelector('echoDouble:')
@SwiftFunction('echo(_:)')
double echoDouble(double aDouble); double echoDouble(double aDouble);
/// Returns the passed in boolean. /// Returns the passed in boolean.
@ObjCSelector('echoBool:') @ObjCSelector('echoBool:')
@SwiftFunction('echo(_:)')
bool echoBool(bool aBool); bool echoBool(bool aBool);
/// Returns the passed in string. /// Returns the passed in string.
@ObjCSelector('echoString:') @ObjCSelector('echoString:')
@SwiftFunction('echo(_:)')
String echoString(String aString); String echoString(String aString);
/// Returns the passed in Uint8List. /// Returns the passed in Uint8List.
@ObjCSelector('echoUint8List:') @ObjCSelector('echoUint8List:')
@SwiftFunction('echo(_:)')
Uint8List echoUint8List(Uint8List aUint8List); Uint8List echoUint8List(Uint8List aUint8List);
/// Returns the passed in generic Object. /// Returns the passed in generic Object.
@ObjCSelector('echoObject:') @ObjCSelector('echoObject:')
@SwiftFunction('echo(_:)')
Object echoObject(Object anObject); Object echoObject(Object anObject);
// ========== Syncronous nullable method tests ========== // ========== Syncronous nullable method tests ==========
@ -134,40 +142,49 @@ abstract class HostIntegrationCoreApi {
/// 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. /// sending of nested objects.
@ObjCSelector('extractNestedNullableStringFrom:') @ObjCSelector('extractNestedNullableStringFrom:')
@SwiftFunction('extractNestedNullableString(from:)')
String? extractNestedNullableString(AllNullableTypesWrapper wrapper); String? extractNestedNullableString(AllNullableTypesWrapper wrapper);
/// 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. /// sending of nested objects.
@ObjCSelector('createNestedObjectWithNullableString:') @ObjCSelector('createNestedObjectWithNullableString:')
@SwiftFunction('createNestedObject(with:)')
AllNullableTypesWrapper createNestedNullableString(String? nullableString); AllNullableTypesWrapper createNestedNullableString(String? nullableString);
/// Returns passed in arguments of multiple types. /// Returns passed in arguments of multiple types.
@ObjCSelector('sendMultipleNullableTypesABool:anInt:aString:') @ObjCSelector('sendMultipleNullableTypesABool:anInt:aString:')
@SwiftFunction('sendMultipleNullableTypes(aBool:anInt:aString:)')
AllNullableTypes sendMultipleNullableTypes( AllNullableTypes sendMultipleNullableTypes(
bool? aNullableBool, int? aNullableInt, String? aNullableString); bool? aNullableBool, int? aNullableInt, String? aNullableString);
/// Returns passed in int. /// Returns passed in int.
@ObjCSelector('echoNullableInt:') @ObjCSelector('echoNullableInt:')
@SwiftFunction('echo(_:)')
int? echoNullableInt(int? aNullableInt); int? echoNullableInt(int? aNullableInt);
/// Returns passed in double. /// Returns passed in double.
@ObjCSelector('echoNullableDouble:') @ObjCSelector('echoNullableDouble:')
@SwiftFunction('echo(_:)')
double? echoNullableDouble(double? aNullableDouble); double? echoNullableDouble(double? aNullableDouble);
/// Returns the passed in boolean. /// Returns the passed in boolean.
@ObjCSelector('echoNullableBool:') @ObjCSelector('echoNullableBool:')
@SwiftFunction('echo(_:)')
bool? echoNullableBool(bool? aNullableBool); bool? echoNullableBool(bool? aNullableBool);
/// Returns the passed in string. /// Returns the passed in string.
@ObjCSelector('echoNullableString:') @ObjCSelector('echoNullableString:')
@SwiftFunction('echo(_:)')
String? echoNullableString(String? aNullableString); String? echoNullableString(String? aNullableString);
/// Returns the passed in Uint8List. /// Returns the passed in Uint8List.
@ObjCSelector('echoNullableUint8List:') @ObjCSelector('echoNullableUint8List:')
@SwiftFunction('echo(_:)')
Uint8List? echoNullableUint8List(Uint8List? aNullableUint8List); Uint8List? echoNullableUint8List(Uint8List? aNullableUint8List);
/// Returns the passed in generic Object. /// Returns the passed in generic Object.
@ObjCSelector('echoNullableObject:') @ObjCSelector('echoNullableObject:')
@SwiftFunction('echo(_:)')
Object? echoNullableObject(Object? aNullableObject); Object? echoNullableObject(Object? aNullableObject);
// ========== Asyncronous method tests ========== // ========== Asyncronous method tests ==========
@ -180,6 +197,7 @@ abstract class HostIntegrationCoreApi {
/// Returns the passed string asynchronously. /// Returns the passed string asynchronously.
@async @async
@ObjCSelector('echoAsyncString:') @ObjCSelector('echoAsyncString:')
@SwiftFunction('echoAsync(_:)')
String echoAsyncString(String aString); String echoAsyncString(String aString);
// ========== Flutter API test wrappers ========== // ========== Flutter API test wrappers ==========
@ -189,6 +207,7 @@ abstract class HostIntegrationCoreApi {
@async @async
@ObjCSelector('callFlutterEchoAllTypes:') @ObjCSelector('callFlutterEchoAllTypes:')
@SwiftFunction('callFlutterEcho(_:)')
AllTypes callFlutterEchoAllTypes(AllTypes everything); AllTypes callFlutterEchoAllTypes(AllTypes everything);
// TODO(stuartmorgan): Add callFlutterEchoAllNullableTypes and the associated // TODO(stuartmorgan): Add callFlutterEchoAllNullableTypes and the associated
@ -198,63 +217,78 @@ abstract class HostIntegrationCoreApi {
@async @async
@ObjCSelector('callFlutterSendMultipleNullableTypesABool:anInt:aString:') @ObjCSelector('callFlutterSendMultipleNullableTypesABool:anInt:aString:')
@SwiftFunction('callFlutterSendMultipleNullableTypes(aBool:anInt:aString:)')
AllNullableTypes callFlutterSendMultipleNullableTypes( AllNullableTypes callFlutterSendMultipleNullableTypes(
bool? aNullableBool, int? aNullableInt, String? aNullableString); bool? aNullableBool, int? aNullableInt, String? aNullableString);
@async @async
@ObjCSelector('callFlutterEchoBool:') @ObjCSelector('callFlutterEchoBool:')
@SwiftFunction('callFlutterEcho(_:)')
bool callFlutterEchoBool(bool aBool); bool callFlutterEchoBool(bool aBool);
@async @async
@ObjCSelector('callFlutterEchoInt:') @ObjCSelector('callFlutterEchoInt:')
@SwiftFunction('callFlutterEcho(_:)')
int callFlutterEchoInt(int anInt); int callFlutterEchoInt(int anInt);
@async @async
@ObjCSelector('callFlutterEchoDouble:') @ObjCSelector('callFlutterEchoDouble:')
@SwiftFunction('callFlutterEcho(_:)')
double callFlutterEchoDouble(double aDouble); double callFlutterEchoDouble(double aDouble);
@async @async
@ObjCSelector('callFlutterEchoString:') @ObjCSelector('callFlutterEchoString:')
@SwiftFunction('callFlutterEcho(_:)')
String callFlutterEchoString(String aString); String callFlutterEchoString(String aString);
@async @async
@ObjCSelector('callFlutterEchoUint8List:') @ObjCSelector('callFlutterEchoUint8List:')
@SwiftFunction('callFlutterEcho(_:)')
Uint8List callFlutterEchoUint8List(Uint8List aList); Uint8List callFlutterEchoUint8List(Uint8List aList);
@async @async
@ObjCSelector('callFlutterEchoList:') @ObjCSelector('callFlutterEchoList:')
@SwiftFunction('callFlutterEcho(_:)')
List<Object?> callFlutterEchoList(List<Object?> aList); List<Object?> callFlutterEchoList(List<Object?> aList);
@async @async
@ObjCSelector('callFlutterEchoMap:') @ObjCSelector('callFlutterEchoMap:')
@SwiftFunction('callFlutterEcho(_:)')
Map<String?, Object?> callFlutterEchoMap(Map<String?, Object?> aMap); Map<String?, Object?> callFlutterEchoMap(Map<String?, Object?> aMap);
@async @async
@ObjCSelector('callFlutterEchoNullableBool:') @ObjCSelector('callFlutterEchoNullableBool:')
@SwiftFunction('callFlutterEchoNullable(_:)')
bool? callFlutterEchoNullableBool(bool? aBool); bool? callFlutterEchoNullableBool(bool? aBool);
@async @async
@ObjCSelector('callFlutterEchoNullableInt:') @ObjCSelector('callFlutterEchoNullableInt:')
@SwiftFunction('callFlutterEchoNullable(_:)')
int? callFlutterEchoNullableInt(int? anInt); int? callFlutterEchoNullableInt(int? anInt);
@async @async
@ObjCSelector('callFlutterEchoNullableDouble:') @ObjCSelector('callFlutterEchoNullableDouble:')
@SwiftFunction('callFlutterEchoNullable(_:)')
double? callFlutterEchoNullableDouble(double? aDouble); double? callFlutterEchoNullableDouble(double? aDouble);
@async @async
@ObjCSelector('callFlutterEchoNullableString:') @ObjCSelector('callFlutterEchoNullableString:')
@SwiftFunction('callFlutterEchoNullable(_:)')
String? callFlutterEchoNullableString(String? aString); String? callFlutterEchoNullableString(String? aString);
@async @async
@ObjCSelector('callFlutterEchoNullableUint8List:') @ObjCSelector('callFlutterEchoNullableUint8List:')
@SwiftFunction('callFlutterEchoNullable(_:)')
Uint8List? callFlutterEchoNullableUint8List(Uint8List? aList); Uint8List? callFlutterEchoNullableUint8List(Uint8List? aList);
@async @async
@ObjCSelector('callFlutterEchoNullableList:') @ObjCSelector('callFlutterEchoNullableList:')
@SwiftFunction('callFlutterEchoNullable(_:)')
List<Object?>? callFlutterEchoNullableList(List<Object?>? aList); List<Object?>? callFlutterEchoNullableList(List<Object?>? aList);
@async @async
@ObjCSelector('callFlutterEchoNullableMap:') @ObjCSelector('callFlutterEchoNullableMap:')
@SwiftFunction('callFlutterEchoNullable(_:)')
Map<String?, Object?>? callFlutterEchoNullableMap( Map<String?, Object?>? callFlutterEchoNullableMap(
Map<String?, Object?>? aMap); Map<String?, Object?>? aMap);
} }
@ -269,16 +303,19 @@ abstract class FlutterIntegrationCoreApi {
/// Returns the passed object, to test serialization and deserialization. /// Returns the passed object, to test serialization and deserialization.
@ObjCSelector('echoAllTypes:') @ObjCSelector('echoAllTypes:')
@SwiftFunction('echo(_:)')
AllTypes echoAllTypes(AllTypes everything); AllTypes echoAllTypes(AllTypes everything);
/// Returns the passed object, to test serialization and deserialization. /// Returns the passed object, to test serialization and deserialization.
@ObjCSelector('echoAllNullableTypes:') @ObjCSelector('echoAllNullableTypes:')
@SwiftFunction('echoNullable(_:)')
AllNullableTypes echoAllNullableTypes(AllNullableTypes everything); AllNullableTypes echoAllNullableTypes(AllNullableTypes everything);
/// Returns passed in arguments of multiple types. /// Returns passed in arguments of multiple types.
/// ///
/// Tests multiple-arity FlutterApi handling. /// Tests multiple-arity FlutterApi handling.
@ObjCSelector('sendMultipleNullableTypesABool:anInt:aString:') @ObjCSelector('sendMultipleNullableTypesABool:anInt:aString:')
@SwiftFunction('sendMultipleNullableTypes(aBool:anInt:aString:)')
AllNullableTypes sendMultipleNullableTypes( AllNullableTypes sendMultipleNullableTypes(
bool? aNullableBool, int? aNullableInt, String? aNullableString); bool? aNullableBool, int? aNullableInt, String? aNullableString);
@ -286,60 +323,74 @@ abstract class FlutterIntegrationCoreApi {
/// Returns the passed boolean, to test serialization and deserialization. /// Returns the passed boolean, to test serialization and deserialization.
@ObjCSelector('echoBool:') @ObjCSelector('echoBool:')
@SwiftFunction('echo(_:)')
bool echoBool(bool aBool); bool echoBool(bool aBool);
/// Returns the passed int, to test serialization and deserialization. /// Returns the passed int, to test serialization and deserialization.
@ObjCSelector('echoInt:') @ObjCSelector('echoInt:')
@SwiftFunction('echo(_:)')
int echoInt(int anInt); int echoInt(int anInt);
/// Returns the passed double, to test serialization and deserialization. /// Returns the passed double, to test serialization and deserialization.
@ObjCSelector('echoDouble:') @ObjCSelector('echoDouble:')
@SwiftFunction('echo(_:)')
double echoDouble(double aDouble); double echoDouble(double aDouble);
/// Returns the passed string, to test serialization and deserialization. /// Returns the passed string, to test serialization and deserialization.
@ObjCSelector('echoString:') @ObjCSelector('echoString:')
@SwiftFunction('echo(_:)')
String echoString(String aString); String echoString(String aString);
/// Returns the passed byte list, to test serialization and deserialization. /// Returns the passed byte list, to test serialization and deserialization.
@ObjCSelector('echoUint8List:') @ObjCSelector('echoUint8List:')
@SwiftFunction('echo(_:)')
Uint8List echoUint8List(Uint8List aList); Uint8List echoUint8List(Uint8List aList);
/// Returns the passed list, to test serialization and deserialization. /// Returns the passed list, to test serialization and deserialization.
@ObjCSelector('echoList:') @ObjCSelector('echoList:')
@SwiftFunction('echo(_:)')
List<Object?> echoList(List<Object?> aList); List<Object?> echoList(List<Object?> aList);
/// Returns the passed map, to test serialization and deserialization. /// Returns the passed map, to test serialization and deserialization.
@ObjCSelector('echoMap:') @ObjCSelector('echoMap:')
@SwiftFunction('echo(_:)')
Map<String?, Object?> echoMap(Map<String?, Object?> aMap); Map<String?, Object?> echoMap(Map<String?, Object?> aMap);
// ========== Nullable argument/return type tests ========== // ========== Nullable argument/return type tests ==========
/// Returns the passed boolean, to test serialization and deserialization. /// Returns the passed boolean, to test serialization and deserialization.
@ObjCSelector('echoNullableBool:') @ObjCSelector('echoNullableBool:')
@SwiftFunction('echoNullable(_:)')
bool? echoNullableBool(bool? aBool); bool? echoNullableBool(bool? aBool);
/// Returns the passed int, to test serialization and deserialization. /// Returns the passed int, to test serialization and deserialization.
@ObjCSelector('echoNullableInt:') @ObjCSelector('echoNullableInt:')
@SwiftFunction('echoNullable(_:)')
int? echoNullableInt(int? anInt); int? echoNullableInt(int? anInt);
/// Returns the passed double, to test serialization and deserialization. /// Returns the passed double, to test serialization and deserialization.
@ObjCSelector('echoNullableDouble:') @ObjCSelector('echoNullableDouble:')
@SwiftFunction('echoNullable(_:)')
double? echoNullableDouble(double? aDouble); double? echoNullableDouble(double? aDouble);
/// Returns the passed string, to test serialization and deserialization. /// Returns the passed string, to test serialization and deserialization.
@ObjCSelector('echoNullableString:') @ObjCSelector('echoNullableString:')
@SwiftFunction('echoNullable(_:)')
String? echoNullableString(String? aString); String? echoNullableString(String? aString);
/// Returns the passed byte list, to test serialization and deserialization. /// Returns the passed byte list, to test serialization and deserialization.
@ObjCSelector('echoNullableUint8List:') @ObjCSelector('echoNullableUint8List:')
@SwiftFunction('echoNullable(_:)')
Uint8List? echoNullableUint8List(Uint8List? aList); Uint8List? echoNullableUint8List(Uint8List? aList);
/// Returns the passed list, to test serialization and deserialization. /// Returns the passed list, to test serialization and deserialization.
@ObjCSelector('echoNullableList:') @ObjCSelector('echoNullableList:')
@SwiftFunction('echoNullable(_:)')
List<Object?>? echoNullableList(List<Object?>? aList); List<Object?>? echoNullableList(List<Object?>? aList);
/// Returns the passed map, to test serialization and deserialization. /// Returns the passed map, to test serialization and deserialization.
@ObjCSelector('echoNullableMap:') @ObjCSelector('echoNullableMap:')
@SwiftFunction('echoNullable(_:)')
Map<String?, Object?>? echoNullableMap(Map<String?, Object?>? aMap); Map<String?, Object?>? echoNullableMap(Map<String?, Object?>? aMap);
} }

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
// Autogenerated from Pigeon (v7.0.5), do not edit directly. // Autogenerated from Pigeon (v7.1.0), do not edit directly.
// See also: https://pub.dev/packages/pigeon // See also: https://pub.dev/packages/pigeon
package com.example.alternate_language_test_plugin; package com.example.alternate_language_test_plugin;

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
// Autogenerated from Pigeon (v7.0.5), do not edit directly. // Autogenerated from Pigeon (v7.1.0), do not edit directly.
// See also: https://pub.dev/packages/pigeon // See also: https://pub.dev/packages/pigeon
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
// Autogenerated from Pigeon (v7.0.5), do not edit directly. // Autogenerated from Pigeon (v7.1.0), do not edit directly.
// See also: https://pub.dev/packages/pigeon // See also: https://pub.dev/packages/pigeon
#import "CoreTests.gen.h" #import "CoreTests.gen.h"

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
// Autogenerated from Pigeon (v7.0.5), do not edit directly. // Autogenerated from Pigeon (v7.1.0), do not edit directly.
// See also: https://pub.dev/packages/pigeon // 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 // 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

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
// Autogenerated from Pigeon (v7.0.5), do not edit directly. // Autogenerated from Pigeon (v7.1.0), do not edit directly.
// See also: https://pub.dev/packages/pigeon // See also: https://pub.dev/packages/pigeon
package com.example.test_plugin package com.example.test_plugin

View File

@ -15,7 +15,7 @@ class AllDatatypesTests: XCTestCase {
let expectation = XCTestExpectation(description: "callback") let expectation = XCTestExpectation(description: "callback")
api.echoAllNullableTypes(everything: everything) { result in api.echoNullable(everything) { result in
XCTAssertNil(result.aNullableBool) XCTAssertNil(result.aNullableBool)
XCTAssertNil(result.aNullableInt) XCTAssertNil(result.aNullableInt)
XCTAssertNil(result.aNullableDouble) XCTAssertNil(result.aNullableDouble)
@ -57,7 +57,7 @@ class AllDatatypesTests: XCTestCase {
let expectation = XCTestExpectation(description: "callback") let expectation = XCTestExpectation(description: "callback")
api.echoAllNullableTypes(everything: everything) { result in api.echoNullable(everything) { result in
XCTAssertEqual(result.aNullableBool, everything.aNullableBool) XCTAssertEqual(result.aNullableBool, everything.aNullableBool)
XCTAssertEqual(result.aNullableInt, everything.aNullableInt) XCTAssertEqual(result.aNullableInt, everything.aNullableInt)
XCTAssertEqual(result.aNullableDouble, everything.aNullableDouble) XCTAssertEqual(result.aNullableDouble, everything.aNullableDouble)

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1420"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "33A341DA291ED36900D34E0F"
BuildableName = "RunnerTests.xctest"
BlueprintName = "RunnerTests"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
// Autogenerated from Pigeon (v7.0.5), do not edit directly. // Autogenerated from Pigeon (v7.1.0), do not edit directly.
// See also: https://pub.dev/packages/pigeon // See also: https://pub.dev/packages/pigeon
import Foundation import Foundation
@ -238,65 +238,65 @@ protocol HostIntegrationCoreApi {
/// test basic calling. /// test basic calling.
func noop() func noop()
/// Returns the passed object, to test serialization and deserialization. /// 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. /// 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. /// Returns an error, to test error handling.
func throwError() func throwError()
/// Returns passed in int. /// Returns passed in int.
func echoInt(anInt: Int32) -> Int32 func echo(_ anInt: Int32) -> Int32
/// Returns passed in double. /// Returns passed in double.
func echoDouble(aDouble: Double) -> Double func echo(_ aDouble: Double) -> Double
/// Returns the passed in boolean. /// Returns the passed in boolean.
func echoBool(aBool: Bool) -> Bool func echo(_ aBool: Bool) -> Bool
/// Returns the passed in string. /// Returns the passed in string.
func echoString(aString: String) -> String func echo(_ aString: String) -> String
/// Returns the passed in Uint8List. /// Returns the passed in Uint8List.
func echoUint8List(aUint8List: FlutterStandardTypedData) -> FlutterStandardTypedData func echo(_ aUint8List: FlutterStandardTypedData) -> FlutterStandardTypedData
/// Returns the passed in generic Object. /// 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 /// Returns the inner `aString` value from the wrapped object, to test
/// sending of nested objects. /// 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 /// Returns the inner `aString` value from the wrapped object, to test
/// sending of nested objects. /// sending of nested objects.
func createNestedNullableString(nullableString: String?) -> AllNullableTypesWrapper func createNestedObject(with nullableString: String?) -> AllNullableTypesWrapper
/// Returns passed in arguments of multiple types. /// 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. /// Returns passed in int.
func echoNullableInt(aNullableInt: Int32?) -> Int32? func echo(_ aNullableInt: Int32?) -> Int32?
/// Returns passed in double. /// Returns passed in double.
func echoNullableDouble(aNullableDouble: Double?) -> Double? func echo(_ aNullableDouble: Double?) -> Double?
/// Returns the passed in boolean. /// Returns the passed in boolean.
func echoNullableBool(aNullableBool: Bool?) -> Bool? func echo(_ aNullableBool: Bool?) -> Bool?
/// Returns the passed in string. /// Returns the passed in string.
func echoNullableString(aNullableString: String?) -> String? func echo(_ aNullableString: String?) -> String?
/// Returns the passed in Uint8List. /// Returns the passed in Uint8List.
func echoNullableUint8List(aNullableUint8List: FlutterStandardTypedData?) -> FlutterStandardTypedData? func echo(_ aNullableUint8List: FlutterStandardTypedData?) -> FlutterStandardTypedData?
/// Returns the passed in generic Object. /// 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 /// A no-op function taking no arguments and returning no value, to sanity
/// test basic asynchronous calling. /// test basic asynchronous calling.
func noopAsync(completion: @escaping () -> Void) func noopAsync(completion: @escaping () -> Void)
/// Returns the passed string asynchronously. /// 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 callFlutterNoop(completion: @escaping () -> Void)
func callFlutterEchoAllTypes(everything: AllTypes, completion: @escaping (AllTypes) -> Void) func callFlutterEcho(_ everything: AllTypes, completion: @escaping (AllTypes) -> Void)
func callFlutterSendMultipleNullableTypes(aNullableBool: Bool?, aNullableInt: Int32?, aNullableString: String?, completion: @escaping (AllNullableTypes) -> Void) func callFlutterSendMultipleNullableTypes(aBool aNullableBool: Bool?, anInt aNullableInt: Int32?, aString aNullableString: String?, completion: @escaping (AllNullableTypes) -> Void)
func callFlutterEchoBool(aBool: Bool, completion: @escaping (Bool) -> Void) func callFlutterEcho(_ aBool: Bool, completion: @escaping (Bool) -> Void)
func callFlutterEchoInt(anInt: Int32, completion: @escaping (Int32) -> Void) func callFlutterEcho(_ anInt: Int32, completion: @escaping (Int32) -> Void)
func callFlutterEchoDouble(aDouble: Double, completion: @escaping (Double) -> Void) func callFlutterEcho(_ aDouble: Double, completion: @escaping (Double) -> Void)
func callFlutterEchoString(aString: String, completion: @escaping (String) -> Void) func callFlutterEcho(_ aString: String, completion: @escaping (String) -> Void)
func callFlutterEchoUint8List(aList: FlutterStandardTypedData, completion: @escaping (FlutterStandardTypedData) -> Void) func callFlutterEcho(_ aList: FlutterStandardTypedData, completion: @escaping (FlutterStandardTypedData) -> Void)
func callFlutterEchoList(aList: [Any?], completion: @escaping ([Any?]) -> Void) func callFlutterEcho(_ aList: [Any?], completion: @escaping ([Any?]) -> Void)
func callFlutterEchoMap(aMap: [String?: Any?], completion: @escaping ([String?: Any?]) -> Void) func callFlutterEcho(_ aMap: [String?: Any?], completion: @escaping ([String?: Any?]) -> Void)
func callFlutterEchoNullableBool(aBool: Bool?, completion: @escaping (Bool?) -> Void) func callFlutterEchoNullable(_ aBool: Bool?, completion: @escaping (Bool?) -> Void)
func callFlutterEchoNullableInt(anInt: Int32?, completion: @escaping (Int32?) -> Void) func callFlutterEchoNullable(_ anInt: Int32?, completion: @escaping (Int32?) -> Void)
func callFlutterEchoNullableDouble(aDouble: Double?, completion: @escaping (Double?) -> Void) func callFlutterEchoNullable(_ aDouble: Double?, completion: @escaping (Double?) -> Void)
func callFlutterEchoNullableString(aString: String?, completion: @escaping (String?) -> Void) func callFlutterEchoNullable(_ aString: String?, completion: @escaping (String?) -> Void)
func callFlutterEchoNullableUint8List(aList: FlutterStandardTypedData?, completion: @escaping (FlutterStandardTypedData?) -> Void) func callFlutterEchoNullable(_ aList: FlutterStandardTypedData?, completion: @escaping (FlutterStandardTypedData?) -> Void)
func callFlutterEchoNullableList(aList: [Any?]?, completion: @escaping ([Any?]?) -> Void) func callFlutterEchoNullable(_ aList: [Any?]?, completion: @escaping ([Any?]?) -> Void)
func callFlutterEchoNullableMap(aMap: [String?: Any?]?, completion: @escaping ([String?: Any?]?) -> Void) func callFlutterEchoNullable(_ aMap: [String?: Any?]?, completion: @escaping ([String?: Any?]?) -> Void)
} }
/// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`.
@ -322,7 +322,7 @@ class HostIntegrationCoreApiSetup {
echoAllTypesChannel.setMessageHandler { message, reply in echoAllTypesChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let everythingArg = args[0] as! AllTypes let everythingArg = args[0] as! AllTypes
let result = api.echoAllTypes(everything: everythingArg) let result = api.echo(everythingArg)
reply(wrapResult(result)) reply(wrapResult(result))
} }
} else { } else {
@ -334,7 +334,7 @@ class HostIntegrationCoreApiSetup {
echoAllNullableTypesChannel.setMessageHandler { message, reply in echoAllNullableTypesChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let everythingArg = args[0] as? AllNullableTypes let everythingArg = args[0] as? AllNullableTypes
let result = api.echoAllNullableTypes(everything: everythingArg) let result = api.echo(everythingArg)
reply(wrapResult(result)) reply(wrapResult(result))
} }
} else { } else {
@ -356,7 +356,7 @@ class HostIntegrationCoreApiSetup {
echoIntChannel.setMessageHandler { message, reply in echoIntChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let anIntArg = args[0] as! Int32 let anIntArg = args[0] as! Int32
let result = api.echoInt(anInt: anIntArg) let result = api.echo(anIntArg)
reply(wrapResult(result)) reply(wrapResult(result))
} }
} else { } else {
@ -368,7 +368,7 @@ class HostIntegrationCoreApiSetup {
echoDoubleChannel.setMessageHandler { message, reply in echoDoubleChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aDoubleArg = args[0] as! Double let aDoubleArg = args[0] as! Double
let result = api.echoDouble(aDouble: aDoubleArg) let result = api.echo(aDoubleArg)
reply(wrapResult(result)) reply(wrapResult(result))
} }
} else { } else {
@ -380,7 +380,7 @@ class HostIntegrationCoreApiSetup {
echoBoolChannel.setMessageHandler { message, reply in echoBoolChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aBoolArg = args[0] as! Bool let aBoolArg = args[0] as! Bool
let result = api.echoBool(aBool: aBoolArg) let result = api.echo(aBoolArg)
reply(wrapResult(result)) reply(wrapResult(result))
} }
} else { } else {
@ -392,7 +392,7 @@ class HostIntegrationCoreApiSetup {
echoStringChannel.setMessageHandler { message, reply in echoStringChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aStringArg = args[0] as! String let aStringArg = args[0] as! String
let result = api.echoString(aString: aStringArg) let result = api.echo(aStringArg)
reply(wrapResult(result)) reply(wrapResult(result))
} }
} else { } else {
@ -404,7 +404,7 @@ class HostIntegrationCoreApiSetup {
echoUint8ListChannel.setMessageHandler { message, reply in echoUint8ListChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aUint8ListArg = args[0] as! FlutterStandardTypedData let aUint8ListArg = args[0] as! FlutterStandardTypedData
let result = api.echoUint8List(aUint8List: aUint8ListArg) let result = api.echo(aUint8ListArg)
reply(wrapResult(result)) reply(wrapResult(result))
} }
} else { } else {
@ -416,7 +416,7 @@ class HostIntegrationCoreApiSetup {
echoObjectChannel.setMessageHandler { message, reply in echoObjectChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let anObjectArg = args[0]! let anObjectArg = args[0]!
let result = api.echoObject(anObject: anObjectArg) let result = api.echo(anObjectArg)
reply(wrapResult(result)) reply(wrapResult(result))
} }
} else { } else {
@ -429,7 +429,7 @@ class HostIntegrationCoreApiSetup {
extractNestedNullableStringChannel.setMessageHandler { message, reply in extractNestedNullableStringChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let wrapperArg = args[0] as! AllNullableTypesWrapper let wrapperArg = args[0] as! AllNullableTypesWrapper
let result = api.extractNestedNullableString(wrapper: wrapperArg) let result = api.extractNestedNullableString(from: wrapperArg)
reply(wrapResult(result)) reply(wrapResult(result))
} }
} else { } else {
@ -442,7 +442,7 @@ class HostIntegrationCoreApiSetup {
createNestedNullableStringChannel.setMessageHandler { message, reply in createNestedNullableStringChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let nullableStringArg = args[0] as? String let nullableStringArg = args[0] as? String
let result = api.createNestedNullableString(nullableString: nullableStringArg) let result = api.createNestedObject(with: nullableStringArg)
reply(wrapResult(result)) reply(wrapResult(result))
} }
} else { } else {
@ -456,7 +456,7 @@ class HostIntegrationCoreApiSetup {
let aNullableBoolArg = args[0] as? Bool let aNullableBoolArg = args[0] as? Bool
let aNullableIntArg = args[1] as? Int32 let aNullableIntArg = args[1] as? Int32
let aNullableStringArg = args[2] as? String 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)) reply(wrapResult(result))
} }
} else { } else {
@ -468,7 +468,7 @@ class HostIntegrationCoreApiSetup {
echoNullableIntChannel.setMessageHandler { message, reply in echoNullableIntChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aNullableIntArg = args[0] as? Int32 let aNullableIntArg = args[0] as? Int32
let result = api.echoNullableInt(aNullableInt: aNullableIntArg) let result = api.echo(aNullableIntArg)
reply(wrapResult(result)) reply(wrapResult(result))
} }
} else { } else {
@ -480,7 +480,7 @@ class HostIntegrationCoreApiSetup {
echoNullableDoubleChannel.setMessageHandler { message, reply in echoNullableDoubleChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aNullableDoubleArg = args[0] as? Double let aNullableDoubleArg = args[0] as? Double
let result = api.echoNullableDouble(aNullableDouble: aNullableDoubleArg) let result = api.echo(aNullableDoubleArg)
reply(wrapResult(result)) reply(wrapResult(result))
} }
} else { } else {
@ -492,7 +492,7 @@ class HostIntegrationCoreApiSetup {
echoNullableBoolChannel.setMessageHandler { message, reply in echoNullableBoolChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aNullableBoolArg = args[0] as? Bool let aNullableBoolArg = args[0] as? Bool
let result = api.echoNullableBool(aNullableBool: aNullableBoolArg) let result = api.echo(aNullableBoolArg)
reply(wrapResult(result)) reply(wrapResult(result))
} }
} else { } else {
@ -504,7 +504,7 @@ class HostIntegrationCoreApiSetup {
echoNullableStringChannel.setMessageHandler { message, reply in echoNullableStringChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aNullableStringArg = args[0] as? String let aNullableStringArg = args[0] as? String
let result = api.echoNullableString(aNullableString: aNullableStringArg) let result = api.echo(aNullableStringArg)
reply(wrapResult(result)) reply(wrapResult(result))
} }
} else { } else {
@ -516,7 +516,7 @@ class HostIntegrationCoreApiSetup {
echoNullableUint8ListChannel.setMessageHandler { message, reply in echoNullableUint8ListChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aNullableUint8ListArg = args[0] as? FlutterStandardTypedData let aNullableUint8ListArg = args[0] as? FlutterStandardTypedData
let result = api.echoNullableUint8List(aNullableUint8List: aNullableUint8ListArg) let result = api.echo(aNullableUint8ListArg)
reply(wrapResult(result)) reply(wrapResult(result))
} }
} else { } else {
@ -528,7 +528,7 @@ class HostIntegrationCoreApiSetup {
echoNullableObjectChannel.setMessageHandler { message, reply in echoNullableObjectChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aNullableObjectArg = args[0] let aNullableObjectArg = args[0]
let result = api.echoNullableObject(aNullableObject: aNullableObjectArg) let result = api.echo(aNullableObjectArg)
reply(wrapResult(result)) reply(wrapResult(result))
} }
} else { } else {
@ -552,7 +552,7 @@ class HostIntegrationCoreApiSetup {
echoAsyncStringChannel.setMessageHandler { message, reply in echoAsyncStringChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aStringArg = args[0] as! String let aStringArg = args[0] as! String
api.echoAsyncString(aString: aStringArg) { result in api.echoAsync(aStringArg) { result in
reply(wrapResult(result)) reply(wrapResult(result))
} }
} }
@ -574,7 +574,7 @@ class HostIntegrationCoreApiSetup {
callFlutterEchoAllTypesChannel.setMessageHandler { message, reply in callFlutterEchoAllTypesChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let everythingArg = args[0] as! AllTypes let everythingArg = args[0] as! AllTypes
api.callFlutterEchoAllTypes(everything: everythingArg) { result in api.callFlutterEcho(everythingArg) { result in
reply(wrapResult(result)) reply(wrapResult(result))
} }
} }
@ -588,7 +588,7 @@ class HostIntegrationCoreApiSetup {
let aNullableBoolArg = args[0] as? Bool let aNullableBoolArg = args[0] as? Bool
let aNullableIntArg = args[1] as? Int32 let aNullableIntArg = args[1] as? Int32
let aNullableStringArg = args[2] as? String 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)) reply(wrapResult(result))
} }
} }
@ -600,7 +600,7 @@ class HostIntegrationCoreApiSetup {
callFlutterEchoBoolChannel.setMessageHandler { message, reply in callFlutterEchoBoolChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aBoolArg = args[0] as! Bool let aBoolArg = args[0] as! Bool
api.callFlutterEchoBool(aBool: aBoolArg) { result in api.callFlutterEcho(aBoolArg) { result in
reply(wrapResult(result)) reply(wrapResult(result))
} }
} }
@ -612,7 +612,7 @@ class HostIntegrationCoreApiSetup {
callFlutterEchoIntChannel.setMessageHandler { message, reply in callFlutterEchoIntChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let anIntArg = args[0] as! Int32 let anIntArg = args[0] as! Int32
api.callFlutterEchoInt(anInt: anIntArg) { result in api.callFlutterEcho(anIntArg) { result in
reply(wrapResult(result)) reply(wrapResult(result))
} }
} }
@ -624,7 +624,7 @@ class HostIntegrationCoreApiSetup {
callFlutterEchoDoubleChannel.setMessageHandler { message, reply in callFlutterEchoDoubleChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aDoubleArg = args[0] as! Double let aDoubleArg = args[0] as! Double
api.callFlutterEchoDouble(aDouble: aDoubleArg) { result in api.callFlutterEcho(aDoubleArg) { result in
reply(wrapResult(result)) reply(wrapResult(result))
} }
} }
@ -636,7 +636,7 @@ class HostIntegrationCoreApiSetup {
callFlutterEchoStringChannel.setMessageHandler { message, reply in callFlutterEchoStringChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aStringArg = args[0] as! String let aStringArg = args[0] as! String
api.callFlutterEchoString(aString: aStringArg) { result in api.callFlutterEcho(aStringArg) { result in
reply(wrapResult(result)) reply(wrapResult(result))
} }
} }
@ -648,7 +648,7 @@ class HostIntegrationCoreApiSetup {
callFlutterEchoUint8ListChannel.setMessageHandler { message, reply in callFlutterEchoUint8ListChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aListArg = args[0] as! FlutterStandardTypedData let aListArg = args[0] as! FlutterStandardTypedData
api.callFlutterEchoUint8List(aList: aListArg) { result in api.callFlutterEcho(aListArg) { result in
reply(wrapResult(result)) reply(wrapResult(result))
} }
} }
@ -660,7 +660,7 @@ class HostIntegrationCoreApiSetup {
callFlutterEchoListChannel.setMessageHandler { message, reply in callFlutterEchoListChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aListArg = args[0] as! [Any?] let aListArg = args[0] as! [Any?]
api.callFlutterEchoList(aList: aListArg) { result in api.callFlutterEcho(aListArg) { result in
reply(wrapResult(result)) reply(wrapResult(result))
} }
} }
@ -672,7 +672,7 @@ class HostIntegrationCoreApiSetup {
callFlutterEchoMapChannel.setMessageHandler { message, reply in callFlutterEchoMapChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aMapArg = args[0] as! [String?: Any?] let aMapArg = args[0] as! [String?: Any?]
api.callFlutterEchoMap(aMap: aMapArg) { result in api.callFlutterEcho(aMapArg) { result in
reply(wrapResult(result)) reply(wrapResult(result))
} }
} }
@ -684,7 +684,7 @@ class HostIntegrationCoreApiSetup {
callFlutterEchoNullableBoolChannel.setMessageHandler { message, reply in callFlutterEchoNullableBoolChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aBoolArg = args[0] as? Bool let aBoolArg = args[0] as? Bool
api.callFlutterEchoNullableBool(aBool: aBoolArg) { result in api.callFlutterEchoNullable(aBoolArg) { result in
reply(wrapResult(result)) reply(wrapResult(result))
} }
} }
@ -696,7 +696,7 @@ class HostIntegrationCoreApiSetup {
callFlutterEchoNullableIntChannel.setMessageHandler { message, reply in callFlutterEchoNullableIntChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let anIntArg = args[0] as? Int32 let anIntArg = args[0] as? Int32
api.callFlutterEchoNullableInt(anInt: anIntArg) { result in api.callFlutterEchoNullable(anIntArg) { result in
reply(wrapResult(result)) reply(wrapResult(result))
} }
} }
@ -708,7 +708,7 @@ class HostIntegrationCoreApiSetup {
callFlutterEchoNullableDoubleChannel.setMessageHandler { message, reply in callFlutterEchoNullableDoubleChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aDoubleArg = args[0] as? Double let aDoubleArg = args[0] as? Double
api.callFlutterEchoNullableDouble(aDouble: aDoubleArg) { result in api.callFlutterEchoNullable(aDoubleArg) { result in
reply(wrapResult(result)) reply(wrapResult(result))
} }
} }
@ -720,7 +720,7 @@ class HostIntegrationCoreApiSetup {
callFlutterEchoNullableStringChannel.setMessageHandler { message, reply in callFlutterEchoNullableStringChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aStringArg = args[0] as? String let aStringArg = args[0] as? String
api.callFlutterEchoNullableString(aString: aStringArg) { result in api.callFlutterEchoNullable(aStringArg) { result in
reply(wrapResult(result)) reply(wrapResult(result))
} }
} }
@ -732,7 +732,7 @@ class HostIntegrationCoreApiSetup {
callFlutterEchoNullableUint8ListChannel.setMessageHandler { message, reply in callFlutterEchoNullableUint8ListChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aListArg = args[0] as? FlutterStandardTypedData let aListArg = args[0] as? FlutterStandardTypedData
api.callFlutterEchoNullableUint8List(aList: aListArg) { result in api.callFlutterEchoNullable(aListArg) { result in
reply(wrapResult(result)) reply(wrapResult(result))
} }
} }
@ -744,7 +744,7 @@ class HostIntegrationCoreApiSetup {
callFlutterEchoNullableListChannel.setMessageHandler { message, reply in callFlutterEchoNullableListChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aListArg = args[0] as? [Any?] let aListArg = args[0] as? [Any?]
api.callFlutterEchoNullableList(aList: aListArg) { result in api.callFlutterEchoNullable(aListArg) { result in
reply(wrapResult(result)) reply(wrapResult(result))
} }
} }
@ -756,7 +756,7 @@ class HostIntegrationCoreApiSetup {
callFlutterEchoNullableMapChannel.setMessageHandler { message, reply in callFlutterEchoNullableMapChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aMapArg = args[0] as? [String?: Any?] let aMapArg = args[0] as? [String?: Any?]
api.callFlutterEchoNullableMap(aMap: aMapArg) { result in api.callFlutterEchoNullable(aMapArg) { result in
reply(wrapResult(result)) reply(wrapResult(result))
} }
} }
@ -832,7 +832,7 @@ class FlutterIntegrationCoreApi {
} }
} }
/// Returns the passed object, to test serialization and deserialization. /// 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) let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllTypes", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([everythingArg] as [Any?]) { response in channel.sendMessage([everythingArg] as [Any?]) { response in
let result = response as! AllTypes let result = response as! AllTypes
@ -840,7 +840,7 @@ class FlutterIntegrationCoreApi {
} }
} }
/// Returns the passed object, to test serialization and deserialization. /// 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) let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([everythingArg] as [Any?]) { response in channel.sendMessage([everythingArg] as [Any?]) { response in
let result = response as! AllNullableTypes let result = response as! AllNullableTypes
@ -850,7 +850,7 @@ class FlutterIntegrationCoreApi {
/// Returns passed in arguments of multiple types. /// Returns passed in arguments of multiple types.
/// ///
/// Tests multiple-arity FlutterApi handling. /// 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) let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.sendMultipleNullableTypes", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aNullableBoolArg, aNullableIntArg, aNullableStringArg] as [Any?]) { response in channel.sendMessage([aNullableBoolArg, aNullableIntArg, aNullableStringArg] as [Any?]) { response in
let result = response as! AllNullableTypes let result = response as! AllNullableTypes
@ -858,7 +858,7 @@ class FlutterIntegrationCoreApi {
} }
} }
/// Returns the passed boolean, to test serialization and deserialization. /// 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) let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoBool", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aBoolArg] as [Any?]) { response in channel.sendMessage([aBoolArg] as [Any?]) { response in
let result = response as! Bool let result = response as! Bool
@ -866,7 +866,7 @@ class FlutterIntegrationCoreApi {
} }
} }
/// Returns the passed int, to test serialization and deserialization. /// 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) let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoInt", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([anIntArg] as [Any?]) { response in channel.sendMessage([anIntArg] as [Any?]) { response in
let result = response as! Int32 let result = response as! Int32
@ -874,7 +874,7 @@ class FlutterIntegrationCoreApi {
} }
} }
/// Returns the passed double, to test serialization and deserialization. /// 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) let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoDouble", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aDoubleArg] as [Any?]) { response in channel.sendMessage([aDoubleArg] as [Any?]) { response in
let result = response as! Double let result = response as! Double
@ -882,7 +882,7 @@ class FlutterIntegrationCoreApi {
} }
} }
/// Returns the passed string, to test serialization and deserialization. /// 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) let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoString", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aStringArg] as [Any?]) { response in channel.sendMessage([aStringArg] as [Any?]) { response in
let result = response as! String let result = response as! String
@ -890,7 +890,7 @@ class FlutterIntegrationCoreApi {
} }
} }
/// Returns the passed byte list, to test serialization and deserialization. /// 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) let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoUint8List", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aListArg] as [Any?]) { response in channel.sendMessage([aListArg] as [Any?]) { response in
let result = response as! FlutterStandardTypedData let result = response as! FlutterStandardTypedData
@ -898,7 +898,7 @@ class FlutterIntegrationCoreApi {
} }
} }
/// Returns the passed list, to test serialization and deserialization. /// 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) let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoList", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aListArg] as [Any?]) { response in channel.sendMessage([aListArg] as [Any?]) { response in
let result = response as! [Any?] let result = response as! [Any?]
@ -906,7 +906,7 @@ class FlutterIntegrationCoreApi {
} }
} }
/// Returns the passed map, to test serialization and deserialization. /// 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) let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoMap", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aMapArg] as [Any?]) { response in channel.sendMessage([aMapArg] as [Any?]) { response in
let result = response as! [String?: Any?] let result = response as! [String?: Any?]
@ -914,7 +914,7 @@ class FlutterIntegrationCoreApi {
} }
} }
/// Returns the passed boolean, to test serialization and deserialization. /// 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) let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableBool", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aBoolArg] as [Any?]) { response in channel.sendMessage([aBoolArg] as [Any?]) { response in
let result = response as? Bool let result = response as? Bool
@ -922,7 +922,7 @@ class FlutterIntegrationCoreApi {
} }
} }
/// Returns the passed int, to test serialization and deserialization. /// 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) let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableInt", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([anIntArg] as [Any?]) { response in channel.sendMessage([anIntArg] as [Any?]) { response in
let result = response as? Int32 let result = response as? Int32
@ -930,7 +930,7 @@ class FlutterIntegrationCoreApi {
} }
} }
/// Returns the passed double, to test serialization and deserialization. /// 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) let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableDouble", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aDoubleArg] as [Any?]) { response in channel.sendMessage([aDoubleArg] as [Any?]) { response in
let result = response as? Double let result = response as? Double
@ -938,7 +938,7 @@ class FlutterIntegrationCoreApi {
} }
} }
/// Returns the passed string, to test serialization and deserialization. /// 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) let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableString", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aStringArg] as [Any?]) { response in channel.sendMessage([aStringArg] as [Any?]) { response in
let result = response as? String let result = response as? String
@ -946,7 +946,7 @@ class FlutterIntegrationCoreApi {
} }
} }
/// Returns the passed byte list, to test serialization and deserialization. /// 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) let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableUint8List", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aListArg] as [Any?]) { response in channel.sendMessage([aListArg] as [Any?]) { response in
let result = response as? FlutterStandardTypedData let result = response as? FlutterStandardTypedData
@ -954,7 +954,7 @@ class FlutterIntegrationCoreApi {
} }
} }
/// Returns the passed list, to test serialization and deserialization. /// 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) let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aListArg] as [Any?]) { response in channel.sendMessage([aListArg] as [Any?]) { response in
let result = response as? [Any?] let result = response as? [Any?]
@ -962,7 +962,7 @@ class FlutterIntegrationCoreApi {
} }
} }
/// Returns the passed map, to test serialization and deserialization. /// 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) let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aMapArg] as [Any?]) { response in channel.sendMessage([aMapArg] as [Any?]) { response in
let result = response as? [String?: Any?] let result = response as? [String?: Any?]

View File

@ -26,11 +26,11 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi {
func noop() { func noop() {
} }
func echoAllTypes(everything: AllTypes) -> AllTypes { func echo(_ everything: AllTypes) -> AllTypes {
return everything return everything
} }
func echoAllNullableTypes(everything: AllNullableTypes?) -> AllNullableTypes? { func echo(_ everything: AllNullableTypes?) -> AllNullableTypes? {
return everything return everything
} }
@ -39,64 +39,64 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi {
// https://github.com/flutter/flutter/issues/112483 // https://github.com/flutter/flutter/issues/112483
} }
func echoInt(anInt: Int32) -> Int32 { func echo(_ anInt: Int32) -> Int32 {
return anInt return anInt
} }
func echoDouble(aDouble: Double) -> Double { func echo(_ aDouble: Double) -> Double {
return aDouble return aDouble
} }
func echoBool(aBool: Bool) -> Bool { func echo(_ aBool: Bool) -> Bool {
return aBool return aBool
} }
func echoString(aString: String) -> String { func echo(_ aString: String) -> String {
return aString return aString
} }
func echoUint8List(aUint8List: FlutterStandardTypedData) -> FlutterStandardTypedData { func echo(_ aUint8List: FlutterStandardTypedData) -> FlutterStandardTypedData {
return aUint8List return aUint8List
} }
func echoObject(anObject: Any) -> Any { func echo(_ anObject: Any) -> Any {
return anObject return anObject
} }
func extractNestedNullableString(wrapper: AllNullableTypesWrapper) -> String? { func extractNestedNullableString(from wrapper: AllNullableTypesWrapper) -> String? {
return wrapper.values.aNullableString; return wrapper.values.aNullableString;
} }
func createNestedNullableString(nullableString: String?) -> AllNullableTypesWrapper { func createNestedObject(with nullableString: String?) -> AllNullableTypesWrapper {
return AllNullableTypesWrapper(values: AllNullableTypes(aNullableString: nullableString)) 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) let someThings = AllNullableTypes(aNullableBool: aNullableBool, aNullableInt: aNullableInt, aNullableString: aNullableString)
return someThings return someThings
} }
func echoNullableInt(aNullableInt: Int32?) -> Int32? { func echo(_ aNullableInt: Int32?) -> Int32? {
return aNullableInt return aNullableInt
} }
func echoNullableDouble(aNullableDouble: Double?) -> Double? { func echo(_ aNullableDouble: Double?) -> Double? {
return aNullableDouble return aNullableDouble
} }
func echoNullableBool(aNullableBool: Bool?) -> Bool? { func echo(_ aNullableBool: Bool?) -> Bool? {
return aNullableBool return aNullableBool
} }
func echoNullableString(aNullableString: String?) -> String? { func echo(_ aNullableString: String?) -> String? {
return aNullableString return aNullableString
} }
func echoNullableUint8List(aNullableUint8List: FlutterStandardTypedData?) -> FlutterStandardTypedData? { func echo(_ aNullableUint8List: FlutterStandardTypedData?) -> FlutterStandardTypedData? {
return aNullableUint8List return aNullableUint8List
} }
func echoNullableObject(aNullableObject: Any?) -> Any? { func echo(_ aNullableObject: Any?) -> Any? {
return aNullableObject return aNullableObject
} }
@ -104,7 +104,7 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi {
completion() completion()
} }
func echoAsyncString(aString: String, completion: @escaping (String) -> Void) { func echoAsync(_ aString: String, completion: @escaping (String) -> Void) {
completion(aString) completion(aString)
} }
@ -114,78 +114,78 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi {
} }
} }
func callFlutterEchoAllTypes(everything: AllTypes, completion: @escaping (AllTypes) -> Void) { func callFlutterEcho(_ everything: AllTypes, completion: @escaping (AllTypes) -> Void) {
flutterAPI.echoAllTypes(everything: everything) { completion($0) } flutterAPI.echo(everything) { completion($0) }
} }
func callFlutterSendMultipleNullableTypes( func callFlutterSendMultipleNullableTypes(
aNullableBool: Bool?, aBool aNullableBool: Bool?,
aNullableInt: Int32?, anInt aNullableInt: Int32?,
aNullableString: String?, aString aNullableString: String?,
completion: @escaping (AllNullableTypes) -> Void completion: @escaping (AllNullableTypes) -> Void
) { ) {
flutterAPI.sendMultipleNullableTypes( flutterAPI.sendMultipleNullableTypes(
aNullableBool: aNullableBool, aBool: aNullableBool,
aNullableInt: aNullableInt, anInt: aNullableInt,
aNullableString: aNullableString aString: aNullableString
) { ) {
completion($0) completion($0)
} }
} }
func callFlutterEchoBool(aBool: Bool, completion: @escaping (Bool) -> Void) { func callFlutterEcho(_ aBool: Bool, completion: @escaping (Bool) -> Void) {
flutterAPI.echoBool(aBool: aBool) { completion($0) } flutterAPI.echo(aBool) { completion($0) }
} }
func callFlutterEchoInt(anInt: Int32, completion: @escaping (Int32) -> Void) { func callFlutterEcho(_ anInt: Int32, completion: @escaping (Int32) -> Void) {
flutterAPI.echoInt(anInt: anInt) { completion($0) } flutterAPI.echo(anInt) { completion($0) }
} }
func callFlutterEchoDouble(aDouble: Double, completion: @escaping (Double) -> Void) { func callFlutterEcho(_ aDouble: Double, completion: @escaping (Double) -> Void) {
flutterAPI.echoDouble(aDouble: aDouble) { completion($0) } flutterAPI.echo(aDouble) { completion($0) }
} }
func callFlutterEchoString(aString: String, completion: @escaping (String) -> Void) { func callFlutterEcho(_ aString: String, completion: @escaping (String) -> Void) {
flutterAPI.echoString(aString: aString) { completion($0) } flutterAPI.echo(aString) { completion($0) }
} }
func callFlutterEchoUint8List(aList: FlutterStandardTypedData, completion: @escaping (FlutterStandardTypedData) -> Void) { func callFlutterEcho(_ aList: FlutterStandardTypedData, completion: @escaping (FlutterStandardTypedData) -> Void) {
flutterAPI.echoUint8List(aList: aList) { completion($0) } flutterAPI.echo(aList) { completion($0) }
} }
func callFlutterEchoList(aList: [Any?], completion: @escaping ([Any?]) -> Void) { func callFlutterEcho(_ aList: [Any?], completion: @escaping ([Any?]) -> Void) {
flutterAPI.echoList(aList: aList) { completion($0) } flutterAPI.echo(aList) { completion($0) }
} }
func callFlutterEchoMap(aMap: [String? : Any?], completion: @escaping ([String? : Any?]) -> Void) { func callFlutterEcho(_ aMap: [String? : Any?], completion: @escaping ([String? : Any?]) -> Void) {
flutterAPI.echoMap(aMap: aMap) { completion($0) } flutterAPI.echo(aMap) { completion($0) }
} }
func callFlutterEchoNullableBool(aBool: Bool?, completion: @escaping (Bool?) -> Void) { func callFlutterEchoNullable(_ aBool: Bool?, completion: @escaping (Bool?) -> Void) {
flutterAPI.echoNullableBool(aBool: aBool) { completion($0) } flutterAPI.echoNullable(aBool) { completion($0) }
} }
func callFlutterEchoNullableInt(anInt: Int32?, completion: @escaping (Int32?) -> Void) { func callFlutterEchoNullable(_ anInt: Int32?, completion: @escaping (Int32?) -> Void) {
flutterAPI.echoNullableInt(anInt: anInt) { completion($0) } flutterAPI.echoNullable(anInt) { completion($0) }
} }
func callFlutterEchoNullableDouble(aDouble: Double?, completion: @escaping (Double?) -> Void) { func callFlutterEchoNullable(_ aDouble: Double?, completion: @escaping (Double?) -> Void) {
flutterAPI.echoNullableDouble(aDouble: aDouble) { completion($0) } flutterAPI.echoNullable(aDouble) { completion($0) }
} }
func callFlutterEchoNullableString(aString: String?, completion: @escaping (String?) -> Void) { func callFlutterEchoNullable(_ aString: String?, completion: @escaping (String?) -> Void) {
flutterAPI.echoNullableString(aString: aString) { completion($0) } flutterAPI.echoNullable(aString) { completion($0) }
} }
func callFlutterEchoNullableUint8List(aList: FlutterStandardTypedData?, completion: @escaping (FlutterStandardTypedData?) -> Void) { func callFlutterEchoNullable(_ aList: FlutterStandardTypedData?, completion: @escaping (FlutterStandardTypedData?) -> Void) {
flutterAPI.echoNullableUint8List(aList: aList) { completion($0) } flutterAPI.echoNullable(aList) { completion($0) }
} }
func callFlutterEchoNullableList(aList: [Any?]?, completion: @escaping ([Any?]?) -> Void) { func callFlutterEchoNullable(_ aList: [Any?]?, completion: @escaping ([Any?]?) -> Void) {
flutterAPI.echoNullableList(aList: aList) { completion($0) } flutterAPI.echoNullable(aList) { completion($0) }
} }
func callFlutterEchoNullableMap(aMap: [String? : Any?]?, completion: @escaping ([String? : Any?]?) -> Void) { func callFlutterEchoNullable(_ aMap: [String? : Any?]?, completion: @escaping ([String? : Any?]?) -> Void) {
flutterAPI.echoNullableMap(aMap: aMap) { completion($0) } flutterAPI.echoNullable(aMap) { completion($0) }
} }
} }

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
// Autogenerated from Pigeon (v7.0.5), do not edit directly. // Autogenerated from Pigeon (v7.1.0), do not edit directly.
// See also: https://pub.dev/packages/pigeon // See also: https://pub.dev/packages/pigeon
import Foundation import Foundation
@ -238,65 +238,65 @@ protocol HostIntegrationCoreApi {
/// test basic calling. /// test basic calling.
func noop() func noop()
/// Returns the passed object, to test serialization and deserialization. /// 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. /// 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. /// Returns an error, to test error handling.
func throwError() func throwError()
/// Returns passed in int. /// Returns passed in int.
func echoInt(anInt: Int32) -> Int32 func echo(_ anInt: Int32) -> Int32
/// Returns passed in double. /// Returns passed in double.
func echoDouble(aDouble: Double) -> Double func echo(_ aDouble: Double) -> Double
/// Returns the passed in boolean. /// Returns the passed in boolean.
func echoBool(aBool: Bool) -> Bool func echo(_ aBool: Bool) -> Bool
/// Returns the passed in string. /// Returns the passed in string.
func echoString(aString: String) -> String func echo(_ aString: String) -> String
/// Returns the passed in Uint8List. /// Returns the passed in Uint8List.
func echoUint8List(aUint8List: FlutterStandardTypedData) -> FlutterStandardTypedData func echo(_ aUint8List: FlutterStandardTypedData) -> FlutterStandardTypedData
/// Returns the passed in generic Object. /// 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 /// Returns the inner `aString` value from the wrapped object, to test
/// sending of nested objects. /// 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 /// Returns the inner `aString` value from the wrapped object, to test
/// sending of nested objects. /// sending of nested objects.
func createNestedNullableString(nullableString: String?) -> AllNullableTypesWrapper func createNestedObject(with nullableString: String?) -> AllNullableTypesWrapper
/// Returns passed in arguments of multiple types. /// 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. /// Returns passed in int.
func echoNullableInt(aNullableInt: Int32?) -> Int32? func echo(_ aNullableInt: Int32?) -> Int32?
/// Returns passed in double. /// Returns passed in double.
func echoNullableDouble(aNullableDouble: Double?) -> Double? func echo(_ aNullableDouble: Double?) -> Double?
/// Returns the passed in boolean. /// Returns the passed in boolean.
func echoNullableBool(aNullableBool: Bool?) -> Bool? func echo(_ aNullableBool: Bool?) -> Bool?
/// Returns the passed in string. /// Returns the passed in string.
func echoNullableString(aNullableString: String?) -> String? func echo(_ aNullableString: String?) -> String?
/// Returns the passed in Uint8List. /// Returns the passed in Uint8List.
func echoNullableUint8List(aNullableUint8List: FlutterStandardTypedData?) -> FlutterStandardTypedData? func echo(_ aNullableUint8List: FlutterStandardTypedData?) -> FlutterStandardTypedData?
/// Returns the passed in generic Object. /// 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 /// A no-op function taking no arguments and returning no value, to sanity
/// test basic asynchronous calling. /// test basic asynchronous calling.
func noopAsync(completion: @escaping () -> Void) func noopAsync(completion: @escaping () -> Void)
/// Returns the passed string asynchronously. /// 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 callFlutterNoop(completion: @escaping () -> Void)
func callFlutterEchoAllTypes(everything: AllTypes, completion: @escaping (AllTypes) -> Void) func callFlutterEcho(_ everything: AllTypes, completion: @escaping (AllTypes) -> Void)
func callFlutterSendMultipleNullableTypes(aNullableBool: Bool?, aNullableInt: Int32?, aNullableString: String?, completion: @escaping (AllNullableTypes) -> Void) func callFlutterSendMultipleNullableTypes(aBool aNullableBool: Bool?, anInt aNullableInt: Int32?, aString aNullableString: String?, completion: @escaping (AllNullableTypes) -> Void)
func callFlutterEchoBool(aBool: Bool, completion: @escaping (Bool) -> Void) func callFlutterEcho(_ aBool: Bool, completion: @escaping (Bool) -> Void)
func callFlutterEchoInt(anInt: Int32, completion: @escaping (Int32) -> Void) func callFlutterEcho(_ anInt: Int32, completion: @escaping (Int32) -> Void)
func callFlutterEchoDouble(aDouble: Double, completion: @escaping (Double) -> Void) func callFlutterEcho(_ aDouble: Double, completion: @escaping (Double) -> Void)
func callFlutterEchoString(aString: String, completion: @escaping (String) -> Void) func callFlutterEcho(_ aString: String, completion: @escaping (String) -> Void)
func callFlutterEchoUint8List(aList: FlutterStandardTypedData, completion: @escaping (FlutterStandardTypedData) -> Void) func callFlutterEcho(_ aList: FlutterStandardTypedData, completion: @escaping (FlutterStandardTypedData) -> Void)
func callFlutterEchoList(aList: [Any?], completion: @escaping ([Any?]) -> Void) func callFlutterEcho(_ aList: [Any?], completion: @escaping ([Any?]) -> Void)
func callFlutterEchoMap(aMap: [String?: Any?], completion: @escaping ([String?: Any?]) -> Void) func callFlutterEcho(_ aMap: [String?: Any?], completion: @escaping ([String?: Any?]) -> Void)
func callFlutterEchoNullableBool(aBool: Bool?, completion: @escaping (Bool?) -> Void) func callFlutterEchoNullable(_ aBool: Bool?, completion: @escaping (Bool?) -> Void)
func callFlutterEchoNullableInt(anInt: Int32?, completion: @escaping (Int32?) -> Void) func callFlutterEchoNullable(_ anInt: Int32?, completion: @escaping (Int32?) -> Void)
func callFlutterEchoNullableDouble(aDouble: Double?, completion: @escaping (Double?) -> Void) func callFlutterEchoNullable(_ aDouble: Double?, completion: @escaping (Double?) -> Void)
func callFlutterEchoNullableString(aString: String?, completion: @escaping (String?) -> Void) func callFlutterEchoNullable(_ aString: String?, completion: @escaping (String?) -> Void)
func callFlutterEchoNullableUint8List(aList: FlutterStandardTypedData?, completion: @escaping (FlutterStandardTypedData?) -> Void) func callFlutterEchoNullable(_ aList: FlutterStandardTypedData?, completion: @escaping (FlutterStandardTypedData?) -> Void)
func callFlutterEchoNullableList(aList: [Any?]?, completion: @escaping ([Any?]?) -> Void) func callFlutterEchoNullable(_ aList: [Any?]?, completion: @escaping ([Any?]?) -> Void)
func callFlutterEchoNullableMap(aMap: [String?: Any?]?, completion: @escaping ([String?: Any?]?) -> Void) func callFlutterEchoNullable(_ aMap: [String?: Any?]?, completion: @escaping ([String?: Any?]?) -> Void)
} }
/// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`.
@ -322,7 +322,7 @@ class HostIntegrationCoreApiSetup {
echoAllTypesChannel.setMessageHandler { message, reply in echoAllTypesChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let everythingArg = args[0] as! AllTypes let everythingArg = args[0] as! AllTypes
let result = api.echoAllTypes(everything: everythingArg) let result = api.echo(everythingArg)
reply(wrapResult(result)) reply(wrapResult(result))
} }
} else { } else {
@ -334,7 +334,7 @@ class HostIntegrationCoreApiSetup {
echoAllNullableTypesChannel.setMessageHandler { message, reply in echoAllNullableTypesChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let everythingArg = args[0] as? AllNullableTypes let everythingArg = args[0] as? AllNullableTypes
let result = api.echoAllNullableTypes(everything: everythingArg) let result = api.echo(everythingArg)
reply(wrapResult(result)) reply(wrapResult(result))
} }
} else { } else {
@ -356,7 +356,7 @@ class HostIntegrationCoreApiSetup {
echoIntChannel.setMessageHandler { message, reply in echoIntChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let anIntArg = args[0] as! Int32 let anIntArg = args[0] as! Int32
let result = api.echoInt(anInt: anIntArg) let result = api.echo(anIntArg)
reply(wrapResult(result)) reply(wrapResult(result))
} }
} else { } else {
@ -368,7 +368,7 @@ class HostIntegrationCoreApiSetup {
echoDoubleChannel.setMessageHandler { message, reply in echoDoubleChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aDoubleArg = args[0] as! Double let aDoubleArg = args[0] as! Double
let result = api.echoDouble(aDouble: aDoubleArg) let result = api.echo(aDoubleArg)
reply(wrapResult(result)) reply(wrapResult(result))
} }
} else { } else {
@ -380,7 +380,7 @@ class HostIntegrationCoreApiSetup {
echoBoolChannel.setMessageHandler { message, reply in echoBoolChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aBoolArg = args[0] as! Bool let aBoolArg = args[0] as! Bool
let result = api.echoBool(aBool: aBoolArg) let result = api.echo(aBoolArg)
reply(wrapResult(result)) reply(wrapResult(result))
} }
} else { } else {
@ -392,7 +392,7 @@ class HostIntegrationCoreApiSetup {
echoStringChannel.setMessageHandler { message, reply in echoStringChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aStringArg = args[0] as! String let aStringArg = args[0] as! String
let result = api.echoString(aString: aStringArg) let result = api.echo(aStringArg)
reply(wrapResult(result)) reply(wrapResult(result))
} }
} else { } else {
@ -404,7 +404,7 @@ class HostIntegrationCoreApiSetup {
echoUint8ListChannel.setMessageHandler { message, reply in echoUint8ListChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aUint8ListArg = args[0] as! FlutterStandardTypedData let aUint8ListArg = args[0] as! FlutterStandardTypedData
let result = api.echoUint8List(aUint8List: aUint8ListArg) let result = api.echo(aUint8ListArg)
reply(wrapResult(result)) reply(wrapResult(result))
} }
} else { } else {
@ -416,7 +416,7 @@ class HostIntegrationCoreApiSetup {
echoObjectChannel.setMessageHandler { message, reply in echoObjectChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let anObjectArg = args[0]! let anObjectArg = args[0]!
let result = api.echoObject(anObject: anObjectArg) let result = api.echo(anObjectArg)
reply(wrapResult(result)) reply(wrapResult(result))
} }
} else { } else {
@ -429,7 +429,7 @@ class HostIntegrationCoreApiSetup {
extractNestedNullableStringChannel.setMessageHandler { message, reply in extractNestedNullableStringChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let wrapperArg = args[0] as! AllNullableTypesWrapper let wrapperArg = args[0] as! AllNullableTypesWrapper
let result = api.extractNestedNullableString(wrapper: wrapperArg) let result = api.extractNestedNullableString(from: wrapperArg)
reply(wrapResult(result)) reply(wrapResult(result))
} }
} else { } else {
@ -442,7 +442,7 @@ class HostIntegrationCoreApiSetup {
createNestedNullableStringChannel.setMessageHandler { message, reply in createNestedNullableStringChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let nullableStringArg = args[0] as? String let nullableStringArg = args[0] as? String
let result = api.createNestedNullableString(nullableString: nullableStringArg) let result = api.createNestedObject(with: nullableStringArg)
reply(wrapResult(result)) reply(wrapResult(result))
} }
} else { } else {
@ -456,7 +456,7 @@ class HostIntegrationCoreApiSetup {
let aNullableBoolArg = args[0] as? Bool let aNullableBoolArg = args[0] as? Bool
let aNullableIntArg = args[1] as? Int32 let aNullableIntArg = args[1] as? Int32
let aNullableStringArg = args[2] as? String 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)) reply(wrapResult(result))
} }
} else { } else {
@ -468,7 +468,7 @@ class HostIntegrationCoreApiSetup {
echoNullableIntChannel.setMessageHandler { message, reply in echoNullableIntChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aNullableIntArg = args[0] as? Int32 let aNullableIntArg = args[0] as? Int32
let result = api.echoNullableInt(aNullableInt: aNullableIntArg) let result = api.echo(aNullableIntArg)
reply(wrapResult(result)) reply(wrapResult(result))
} }
} else { } else {
@ -480,7 +480,7 @@ class HostIntegrationCoreApiSetup {
echoNullableDoubleChannel.setMessageHandler { message, reply in echoNullableDoubleChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aNullableDoubleArg = args[0] as? Double let aNullableDoubleArg = args[0] as? Double
let result = api.echoNullableDouble(aNullableDouble: aNullableDoubleArg) let result = api.echo(aNullableDoubleArg)
reply(wrapResult(result)) reply(wrapResult(result))
} }
} else { } else {
@ -492,7 +492,7 @@ class HostIntegrationCoreApiSetup {
echoNullableBoolChannel.setMessageHandler { message, reply in echoNullableBoolChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aNullableBoolArg = args[0] as? Bool let aNullableBoolArg = args[0] as? Bool
let result = api.echoNullableBool(aNullableBool: aNullableBoolArg) let result = api.echo(aNullableBoolArg)
reply(wrapResult(result)) reply(wrapResult(result))
} }
} else { } else {
@ -504,7 +504,7 @@ class HostIntegrationCoreApiSetup {
echoNullableStringChannel.setMessageHandler { message, reply in echoNullableStringChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aNullableStringArg = args[0] as? String let aNullableStringArg = args[0] as? String
let result = api.echoNullableString(aNullableString: aNullableStringArg) let result = api.echo(aNullableStringArg)
reply(wrapResult(result)) reply(wrapResult(result))
} }
} else { } else {
@ -516,7 +516,7 @@ class HostIntegrationCoreApiSetup {
echoNullableUint8ListChannel.setMessageHandler { message, reply in echoNullableUint8ListChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aNullableUint8ListArg = args[0] as? FlutterStandardTypedData let aNullableUint8ListArg = args[0] as? FlutterStandardTypedData
let result = api.echoNullableUint8List(aNullableUint8List: aNullableUint8ListArg) let result = api.echo(aNullableUint8ListArg)
reply(wrapResult(result)) reply(wrapResult(result))
} }
} else { } else {
@ -528,7 +528,7 @@ class HostIntegrationCoreApiSetup {
echoNullableObjectChannel.setMessageHandler { message, reply in echoNullableObjectChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aNullableObjectArg = args[0] let aNullableObjectArg = args[0]
let result = api.echoNullableObject(aNullableObject: aNullableObjectArg) let result = api.echo(aNullableObjectArg)
reply(wrapResult(result)) reply(wrapResult(result))
} }
} else { } else {
@ -552,7 +552,7 @@ class HostIntegrationCoreApiSetup {
echoAsyncStringChannel.setMessageHandler { message, reply in echoAsyncStringChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aStringArg = args[0] as! String let aStringArg = args[0] as! String
api.echoAsyncString(aString: aStringArg) { result in api.echoAsync(aStringArg) { result in
reply(wrapResult(result)) reply(wrapResult(result))
} }
} }
@ -574,7 +574,7 @@ class HostIntegrationCoreApiSetup {
callFlutterEchoAllTypesChannel.setMessageHandler { message, reply in callFlutterEchoAllTypesChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let everythingArg = args[0] as! AllTypes let everythingArg = args[0] as! AllTypes
api.callFlutterEchoAllTypes(everything: everythingArg) { result in api.callFlutterEcho(everythingArg) { result in
reply(wrapResult(result)) reply(wrapResult(result))
} }
} }
@ -588,7 +588,7 @@ class HostIntegrationCoreApiSetup {
let aNullableBoolArg = args[0] as? Bool let aNullableBoolArg = args[0] as? Bool
let aNullableIntArg = args[1] as? Int32 let aNullableIntArg = args[1] as? Int32
let aNullableStringArg = args[2] as? String 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)) reply(wrapResult(result))
} }
} }
@ -600,7 +600,7 @@ class HostIntegrationCoreApiSetup {
callFlutterEchoBoolChannel.setMessageHandler { message, reply in callFlutterEchoBoolChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aBoolArg = args[0] as! Bool let aBoolArg = args[0] as! Bool
api.callFlutterEchoBool(aBool: aBoolArg) { result in api.callFlutterEcho(aBoolArg) { result in
reply(wrapResult(result)) reply(wrapResult(result))
} }
} }
@ -612,7 +612,7 @@ class HostIntegrationCoreApiSetup {
callFlutterEchoIntChannel.setMessageHandler { message, reply in callFlutterEchoIntChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let anIntArg = args[0] as! Int32 let anIntArg = args[0] as! Int32
api.callFlutterEchoInt(anInt: anIntArg) { result in api.callFlutterEcho(anIntArg) { result in
reply(wrapResult(result)) reply(wrapResult(result))
} }
} }
@ -624,7 +624,7 @@ class HostIntegrationCoreApiSetup {
callFlutterEchoDoubleChannel.setMessageHandler { message, reply in callFlutterEchoDoubleChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aDoubleArg = args[0] as! Double let aDoubleArg = args[0] as! Double
api.callFlutterEchoDouble(aDouble: aDoubleArg) { result in api.callFlutterEcho(aDoubleArg) { result in
reply(wrapResult(result)) reply(wrapResult(result))
} }
} }
@ -636,7 +636,7 @@ class HostIntegrationCoreApiSetup {
callFlutterEchoStringChannel.setMessageHandler { message, reply in callFlutterEchoStringChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aStringArg = args[0] as! String let aStringArg = args[0] as! String
api.callFlutterEchoString(aString: aStringArg) { result in api.callFlutterEcho(aStringArg) { result in
reply(wrapResult(result)) reply(wrapResult(result))
} }
} }
@ -648,7 +648,7 @@ class HostIntegrationCoreApiSetup {
callFlutterEchoUint8ListChannel.setMessageHandler { message, reply in callFlutterEchoUint8ListChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aListArg = args[0] as! FlutterStandardTypedData let aListArg = args[0] as! FlutterStandardTypedData
api.callFlutterEchoUint8List(aList: aListArg) { result in api.callFlutterEcho(aListArg) { result in
reply(wrapResult(result)) reply(wrapResult(result))
} }
} }
@ -660,7 +660,7 @@ class HostIntegrationCoreApiSetup {
callFlutterEchoListChannel.setMessageHandler { message, reply in callFlutterEchoListChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aListArg = args[0] as! [Any?] let aListArg = args[0] as! [Any?]
api.callFlutterEchoList(aList: aListArg) { result in api.callFlutterEcho(aListArg) { result in
reply(wrapResult(result)) reply(wrapResult(result))
} }
} }
@ -672,7 +672,7 @@ class HostIntegrationCoreApiSetup {
callFlutterEchoMapChannel.setMessageHandler { message, reply in callFlutterEchoMapChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aMapArg = args[0] as! [String?: Any?] let aMapArg = args[0] as! [String?: Any?]
api.callFlutterEchoMap(aMap: aMapArg) { result in api.callFlutterEcho(aMapArg) { result in
reply(wrapResult(result)) reply(wrapResult(result))
} }
} }
@ -684,7 +684,7 @@ class HostIntegrationCoreApiSetup {
callFlutterEchoNullableBoolChannel.setMessageHandler { message, reply in callFlutterEchoNullableBoolChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aBoolArg = args[0] as? Bool let aBoolArg = args[0] as? Bool
api.callFlutterEchoNullableBool(aBool: aBoolArg) { result in api.callFlutterEchoNullable(aBoolArg) { result in
reply(wrapResult(result)) reply(wrapResult(result))
} }
} }
@ -696,7 +696,7 @@ class HostIntegrationCoreApiSetup {
callFlutterEchoNullableIntChannel.setMessageHandler { message, reply in callFlutterEchoNullableIntChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let anIntArg = args[0] as? Int32 let anIntArg = args[0] as? Int32
api.callFlutterEchoNullableInt(anInt: anIntArg) { result in api.callFlutterEchoNullable(anIntArg) { result in
reply(wrapResult(result)) reply(wrapResult(result))
} }
} }
@ -708,7 +708,7 @@ class HostIntegrationCoreApiSetup {
callFlutterEchoNullableDoubleChannel.setMessageHandler { message, reply in callFlutterEchoNullableDoubleChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aDoubleArg = args[0] as? Double let aDoubleArg = args[0] as? Double
api.callFlutterEchoNullableDouble(aDouble: aDoubleArg) { result in api.callFlutterEchoNullable(aDoubleArg) { result in
reply(wrapResult(result)) reply(wrapResult(result))
} }
} }
@ -720,7 +720,7 @@ class HostIntegrationCoreApiSetup {
callFlutterEchoNullableStringChannel.setMessageHandler { message, reply in callFlutterEchoNullableStringChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aStringArg = args[0] as? String let aStringArg = args[0] as? String
api.callFlutterEchoNullableString(aString: aStringArg) { result in api.callFlutterEchoNullable(aStringArg) { result in
reply(wrapResult(result)) reply(wrapResult(result))
} }
} }
@ -732,7 +732,7 @@ class HostIntegrationCoreApiSetup {
callFlutterEchoNullableUint8ListChannel.setMessageHandler { message, reply in callFlutterEchoNullableUint8ListChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aListArg = args[0] as? FlutterStandardTypedData let aListArg = args[0] as? FlutterStandardTypedData
api.callFlutterEchoNullableUint8List(aList: aListArg) { result in api.callFlutterEchoNullable(aListArg) { result in
reply(wrapResult(result)) reply(wrapResult(result))
} }
} }
@ -744,7 +744,7 @@ class HostIntegrationCoreApiSetup {
callFlutterEchoNullableListChannel.setMessageHandler { message, reply in callFlutterEchoNullableListChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aListArg = args[0] as? [Any?] let aListArg = args[0] as? [Any?]
api.callFlutterEchoNullableList(aList: aListArg) { result in api.callFlutterEchoNullable(aListArg) { result in
reply(wrapResult(result)) reply(wrapResult(result))
} }
} }
@ -756,7 +756,7 @@ class HostIntegrationCoreApiSetup {
callFlutterEchoNullableMapChannel.setMessageHandler { message, reply in callFlutterEchoNullableMapChannel.setMessageHandler { message, reply in
let args = message as! [Any?] let args = message as! [Any?]
let aMapArg = args[0] as? [String?: Any?] let aMapArg = args[0] as? [String?: Any?]
api.callFlutterEchoNullableMap(aMap: aMapArg) { result in api.callFlutterEchoNullable(aMapArg) { result in
reply(wrapResult(result)) reply(wrapResult(result))
} }
} }
@ -832,7 +832,7 @@ class FlutterIntegrationCoreApi {
} }
} }
/// Returns the passed object, to test serialization and deserialization. /// 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) let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllTypes", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([everythingArg] as [Any?]) { response in channel.sendMessage([everythingArg] as [Any?]) { response in
let result = response as! AllTypes let result = response as! AllTypes
@ -840,7 +840,7 @@ class FlutterIntegrationCoreApi {
} }
} }
/// Returns the passed object, to test serialization and deserialization. /// 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) let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoAllNullableTypes", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([everythingArg] as [Any?]) { response in channel.sendMessage([everythingArg] as [Any?]) { response in
let result = response as! AllNullableTypes let result = response as! AllNullableTypes
@ -850,7 +850,7 @@ class FlutterIntegrationCoreApi {
/// Returns passed in arguments of multiple types. /// Returns passed in arguments of multiple types.
/// ///
/// Tests multiple-arity FlutterApi handling. /// 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) let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.sendMultipleNullableTypes", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aNullableBoolArg, aNullableIntArg, aNullableStringArg] as [Any?]) { response in channel.sendMessage([aNullableBoolArg, aNullableIntArg, aNullableStringArg] as [Any?]) { response in
let result = response as! AllNullableTypes let result = response as! AllNullableTypes
@ -858,7 +858,7 @@ class FlutterIntegrationCoreApi {
} }
} }
/// Returns the passed boolean, to test serialization and deserialization. /// 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) let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoBool", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aBoolArg] as [Any?]) { response in channel.sendMessage([aBoolArg] as [Any?]) { response in
let result = response as! Bool let result = response as! Bool
@ -866,7 +866,7 @@ class FlutterIntegrationCoreApi {
} }
} }
/// Returns the passed int, to test serialization and deserialization. /// 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) let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoInt", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([anIntArg] as [Any?]) { response in channel.sendMessage([anIntArg] as [Any?]) { response in
let result = response as! Int32 let result = response as! Int32
@ -874,7 +874,7 @@ class FlutterIntegrationCoreApi {
} }
} }
/// Returns the passed double, to test serialization and deserialization. /// 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) let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoDouble", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aDoubleArg] as [Any?]) { response in channel.sendMessage([aDoubleArg] as [Any?]) { response in
let result = response as! Double let result = response as! Double
@ -882,7 +882,7 @@ class FlutterIntegrationCoreApi {
} }
} }
/// Returns the passed string, to test serialization and deserialization. /// 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) let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoString", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aStringArg] as [Any?]) { response in channel.sendMessage([aStringArg] as [Any?]) { response in
let result = response as! String let result = response as! String
@ -890,7 +890,7 @@ class FlutterIntegrationCoreApi {
} }
} }
/// Returns the passed byte list, to test serialization and deserialization. /// 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) let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoUint8List", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aListArg] as [Any?]) { response in channel.sendMessage([aListArg] as [Any?]) { response in
let result = response as! FlutterStandardTypedData let result = response as! FlutterStandardTypedData
@ -898,7 +898,7 @@ class FlutterIntegrationCoreApi {
} }
} }
/// Returns the passed list, to test serialization and deserialization. /// 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) let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoList", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aListArg] as [Any?]) { response in channel.sendMessage([aListArg] as [Any?]) { response in
let result = response as! [Any?] let result = response as! [Any?]
@ -906,7 +906,7 @@ class FlutterIntegrationCoreApi {
} }
} }
/// Returns the passed map, to test serialization and deserialization. /// 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) let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoMap", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aMapArg] as [Any?]) { response in channel.sendMessage([aMapArg] as [Any?]) { response in
let result = response as! [String?: Any?] let result = response as! [String?: Any?]
@ -914,7 +914,7 @@ class FlutterIntegrationCoreApi {
} }
} }
/// Returns the passed boolean, to test serialization and deserialization. /// 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) let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableBool", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aBoolArg] as [Any?]) { response in channel.sendMessage([aBoolArg] as [Any?]) { response in
let result = response as? Bool let result = response as? Bool
@ -922,7 +922,7 @@ class FlutterIntegrationCoreApi {
} }
} }
/// Returns the passed int, to test serialization and deserialization. /// 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) let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableInt", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([anIntArg] as [Any?]) { response in channel.sendMessage([anIntArg] as [Any?]) { response in
let result = response as? Int32 let result = response as? Int32
@ -930,7 +930,7 @@ class FlutterIntegrationCoreApi {
} }
} }
/// Returns the passed double, to test serialization and deserialization. /// 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) let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableDouble", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aDoubleArg] as [Any?]) { response in channel.sendMessage([aDoubleArg] as [Any?]) { response in
let result = response as? Double let result = response as? Double
@ -938,7 +938,7 @@ class FlutterIntegrationCoreApi {
} }
} }
/// Returns the passed string, to test serialization and deserialization. /// 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) let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableString", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aStringArg] as [Any?]) { response in channel.sendMessage([aStringArg] as [Any?]) { response in
let result = response as? String let result = response as? String
@ -946,7 +946,7 @@ class FlutterIntegrationCoreApi {
} }
} }
/// Returns the passed byte list, to test serialization and deserialization. /// 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) let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableUint8List", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aListArg] as [Any?]) { response in channel.sendMessage([aListArg] as [Any?]) { response in
let result = response as? FlutterStandardTypedData let result = response as? FlutterStandardTypedData
@ -954,7 +954,7 @@ class FlutterIntegrationCoreApi {
} }
} }
/// Returns the passed list, to test serialization and deserialization. /// 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) let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableList", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aListArg] as [Any?]) { response in channel.sendMessage([aListArg] as [Any?]) { response in
let result = response as? [Any?] let result = response as? [Any?]
@ -962,7 +962,7 @@ class FlutterIntegrationCoreApi {
} }
} }
/// Returns the passed map, to test serialization and deserialization. /// 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) let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.FlutterIntegrationCoreApi.echoNullableMap", binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([aMapArg] as [Any?]) { response in channel.sendMessage([aMapArg] as [Any?]) { response in
let result = response as? [String?: Any?] let result = response as? [String?: Any?]

View File

@ -26,11 +26,11 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi {
func noop() { func noop() {
} }
func echoAllTypes(everything: AllTypes) -> AllTypes { func echo(_ everything: AllTypes) -> AllTypes {
return everything return everything
} }
func echoAllNullableTypes(everything: AllNullableTypes?) -> AllNullableTypes? { func echo(_ everything: AllNullableTypes?) -> AllNullableTypes? {
return everything return everything
} }
@ -39,64 +39,64 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi {
// https://github.com/flutter/flutter/issues/112483 // https://github.com/flutter/flutter/issues/112483
} }
func echoInt(anInt: Int32) -> Int32 { func echo(_ anInt: Int32) -> Int32 {
return anInt return anInt
} }
func echoDouble(aDouble: Double) -> Double { func echo(_ aDouble: Double) -> Double {
return aDouble return aDouble
} }
func echoBool(aBool: Bool) -> Bool { func echo(_ aBool: Bool) -> Bool {
return aBool return aBool
} }
func echoString(aString: String) -> String { func echo(_ aString: String) -> String {
return aString return aString
} }
func echoUint8List(aUint8List: FlutterStandardTypedData) -> FlutterStandardTypedData { func echo(_ aUint8List: FlutterStandardTypedData) -> FlutterStandardTypedData {
return aUint8List return aUint8List
} }
func echoObject(anObject: Any) -> Any { func echo(_ anObject: Any) -> Any {
return anObject return anObject
} }
func extractNestedNullableString(wrapper: AllNullableTypesWrapper) -> String? { func extractNestedNullableString(from wrapper: AllNullableTypesWrapper) -> String? {
return wrapper.values.aNullableString; return wrapper.values.aNullableString;
} }
func createNestedNullableString(nullableString: String?) -> AllNullableTypesWrapper { func createNestedObject(with nullableString: String?) -> AllNullableTypesWrapper {
return AllNullableTypesWrapper(values: AllNullableTypes(aNullableString: nullableString)) 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) let someThings = AllNullableTypes(aNullableBool: aNullableBool, aNullableInt: aNullableInt, aNullableString: aNullableString)
return someThings return someThings
} }
func echoNullableInt(aNullableInt: Int32?) -> Int32? { func echo(_ aNullableInt: Int32?) -> Int32? {
return aNullableInt return aNullableInt
} }
func echoNullableDouble(aNullableDouble: Double?) -> Double? { func echo(_ aNullableDouble: Double?) -> Double? {
return aNullableDouble return aNullableDouble
} }
func echoNullableBool(aNullableBool: Bool?) -> Bool? { func echo(_ aNullableBool: Bool?) -> Bool? {
return aNullableBool return aNullableBool
} }
func echoNullableString(aNullableString: String?) -> String? { func echo(_ aNullableString: String?) -> String? {
return aNullableString return aNullableString
} }
func echoNullableUint8List(aNullableUint8List: FlutterStandardTypedData?) -> FlutterStandardTypedData? { func echo(_ aNullableUint8List: FlutterStandardTypedData?) -> FlutterStandardTypedData? {
return aNullableUint8List return aNullableUint8List
} }
func echoNullableObject(aNullableObject: Any?) -> Any? { func echo(_ aNullableObject: Any?) -> Any? {
return aNullableObject return aNullableObject
} }
@ -104,7 +104,7 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi {
completion() completion()
} }
func echoAsyncString(aString: String, completion: @escaping (String) -> Void) { func echoAsync(_ aString: String, completion: @escaping (String) -> Void) {
completion(aString) completion(aString)
} }
@ -114,78 +114,78 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi {
} }
} }
func callFlutterEchoAllTypes(everything: AllTypes, completion: @escaping (AllTypes) -> Void) { func callFlutterEcho(_ everything: AllTypes, completion: @escaping (AllTypes) -> Void) {
flutterAPI.echoAllTypes(everything: everything) { completion($0) } flutterAPI.echo(everything) { completion($0) }
} }
func callFlutterSendMultipleNullableTypes( func callFlutterSendMultipleNullableTypes(
aNullableBool: Bool?, aBool aNullableBool: Bool?,
aNullableInt: Int32?, anInt aNullableInt: Int32?,
aNullableString: String?, aString aNullableString: String?,
completion: @escaping (AllNullableTypes) -> Void completion: @escaping (AllNullableTypes) -> Void
) { ) {
flutterAPI.sendMultipleNullableTypes( flutterAPI.sendMultipleNullableTypes(
aNullableBool: aNullableBool, aBool: aNullableBool,
aNullableInt: aNullableInt, anInt: aNullableInt,
aNullableString: aNullableString aString: aNullableString
) { ) {
completion($0) completion($0)
} }
} }
func callFlutterEchoBool(aBool: Bool, completion: @escaping (Bool) -> Void) { func callFlutterEcho(_ aBool: Bool, completion: @escaping (Bool) -> Void) {
flutterAPI.echoBool(aBool: aBool) { completion($0) } flutterAPI.echo(aBool) { completion($0) }
} }
func callFlutterEchoInt(anInt: Int32, completion: @escaping (Int32) -> Void) { func callFlutterEcho(_ anInt: Int32, completion: @escaping (Int32) -> Void) {
flutterAPI.echoInt(anInt: anInt) { completion($0) } flutterAPI.echo(anInt) { completion($0) }
} }
func callFlutterEchoDouble(aDouble: Double, completion: @escaping (Double) -> Void) { func callFlutterEcho(_ aDouble: Double, completion: @escaping (Double) -> Void) {
flutterAPI.echoDouble(aDouble: aDouble) { completion($0) } flutterAPI.echo(aDouble) { completion($0) }
} }
func callFlutterEchoString(aString: String, completion: @escaping (String) -> Void) { func callFlutterEcho(_ aString: String, completion: @escaping (String) -> Void) {
flutterAPI.echoString(aString: aString) { completion($0) } flutterAPI.echo(aString) { completion($0) }
} }
func callFlutterEchoUint8List(aList: FlutterStandardTypedData, completion: @escaping (FlutterStandardTypedData) -> Void) { func callFlutterEcho(_ aList: FlutterStandardTypedData, completion: @escaping (FlutterStandardTypedData) -> Void) {
flutterAPI.echoUint8List(aList: aList) { completion($0) } flutterAPI.echo(aList) { completion($0) }
} }
func callFlutterEchoList(aList: [Any?], completion: @escaping ([Any?]) -> Void) { func callFlutterEcho(_ aList: [Any?], completion: @escaping ([Any?]) -> Void) {
flutterAPI.echoList(aList: aList) { completion($0) } flutterAPI.echo(aList) { completion($0) }
} }
func callFlutterEchoMap(aMap: [String? : Any?], completion: @escaping ([String? : Any?]) -> Void) { func callFlutterEcho(_ aMap: [String? : Any?], completion: @escaping ([String? : Any?]) -> Void) {
flutterAPI.echoMap(aMap: aMap) { completion($0) } flutterAPI.echo(aMap) { completion($0) }
} }
func callFlutterEchoNullableBool(aBool: Bool?, completion: @escaping (Bool?) -> Void) { func callFlutterEchoNullable(_ aBool: Bool?, completion: @escaping (Bool?) -> Void) {
flutterAPI.echoNullableBool(aBool: aBool) { completion($0) } flutterAPI.echoNullable(aBool) { completion($0) }
} }
func callFlutterEchoNullableInt(anInt: Int32?, completion: @escaping (Int32?) -> Void) { func callFlutterEchoNullable(_ anInt: Int32?, completion: @escaping (Int32?) -> Void) {
flutterAPI.echoNullableInt(anInt: anInt) { completion($0) } flutterAPI.echoNullable(anInt) { completion($0) }
} }
func callFlutterEchoNullableDouble(aDouble: Double?, completion: @escaping (Double?) -> Void) { func callFlutterEchoNullable(_ aDouble: Double?, completion: @escaping (Double?) -> Void) {
flutterAPI.echoNullableDouble(aDouble: aDouble) { completion($0) } flutterAPI.echoNullable(aDouble) { completion($0) }
} }
func callFlutterEchoNullableString(aString: String?, completion: @escaping (String?) -> Void) { func callFlutterEchoNullable(_ aString: String?, completion: @escaping (String?) -> Void) {
flutterAPI.echoNullableString(aString: aString) { completion($0) } flutterAPI.echoNullable(aString) { completion($0) }
} }
func callFlutterEchoNullableUint8List(aList: FlutterStandardTypedData?, completion: @escaping (FlutterStandardTypedData?) -> Void) { func callFlutterEchoNullable(_ aList: FlutterStandardTypedData?, completion: @escaping (FlutterStandardTypedData?) -> Void) {
flutterAPI.echoNullableUint8List(aList: aList) { completion($0) } flutterAPI.echoNullable(aList) { completion($0) }
} }
func callFlutterEchoNullableList(aList: [Any?]?, completion: @escaping ([Any?]?) -> Void) { func callFlutterEchoNullable(_ aList: [Any?]?, completion: @escaping ([Any?]?) -> Void) {
flutterAPI.echoNullableList(aList: aList) { completion($0) } flutterAPI.echoNullable(aList) { completion($0) }
} }
func callFlutterEchoNullableMap(aMap: [String? : Any?]?, completion: @escaping ([String? : Any?]?) -> Void) { func callFlutterEchoNullable(_ aMap: [String? : Any?]?, completion: @escaping ([String? : Any?]?) -> Void) {
flutterAPI.echoNullableMap(aMap: aMap) { completion($0) } flutterAPI.echoNullable(aMap) { completion($0) }
} }
} }

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
// Autogenerated from Pigeon (v7.0.5), do not edit directly. // Autogenerated from Pigeon (v7.1.0), do not edit directly.
// See also: https://pub.dev/packages/pigeon // See also: https://pub.dev/packages/pigeon
#undef _HAS_EXCEPTIONS #undef _HAS_EXCEPTIONS

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
// Autogenerated from Pigeon (v7.0.5), do not edit directly. // Autogenerated from Pigeon (v7.1.0), do not edit directly.
// See also: https://pub.dev/packages/pigeon // See also: https://pub.dev/packages/pigeon
#ifndef PIGEON_CORE_TESTS_GEN_H_ #ifndef PIGEON_CORE_TESTS_GEN_H_

View File

@ -2,7 +2,7 @@ name: pigeon
description: Code generator tool to make communication between Flutter and the host platform type-safe and easier. 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 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 issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3Apigeon
version: 7.0.5 # This must match the version in lib/generator_tools.dart version: 7.1.0 # This must match the version in lib/generator_tools.dart
environment: environment:
sdk: ">=2.12.0 <3.0.0" sdk: ">=2.12.0 <3.0.0"

View File

@ -931,6 +931,52 @@ abstract class Api {
expect(results.root.apis[0].methods[0].objcSelector, equals('foobar')); expect(results.root.apis[0].methods[0].objcSelector, equals('foobar'));
}); });
test('custom swift valid 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', () { test('dart test has copyright', () {
final Root root = Root(apis: <Api>[], classes: <Class>[], enums: <Enum>[]); final Root root = Root(apis: <Api>[], classes: <Class>[], enums: <Enum>[]);
const PigeonOptions options = PigeonOptions( const PigeonOptions options = PigeonOptions(

View File

@ -1142,4 +1142,96 @@ void main() {
final String code = sink.toString(); final String code = sink.toString();
expect(code, contains(': FlutterStandardReader ')); expect(code, contains(': FlutterStandardReader '));
}); });
test('swift function signature', () {
final Root root = Root(
apis: <Api>[
Api(name: 'Api', location: ApiLocation.host, methods: <Method>[
Method(
name: 'set',
arguments: <NamedType>[
NamedType(
type: const TypeDeclaration(
baseName: 'int',
isNullable: false,
),
name: 'value',
),
NamedType(
type: const TypeDeclaration(
baseName: 'String',
isNullable: false,
),
name: 'key',
),
],
swiftFunction: 'setValue(_:for:)',
returnType: const TypeDeclaration.voidDeclaration(),
)
])
],
classes: <Class>[],
enums: <Enum>[],
);
final StringBuffer sink = StringBuffer();
const SwiftOptions swiftOptions = SwiftOptions();
const SwiftGenerator generator = SwiftGenerator();
generator.generate(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>[
Api(name: 'Api', location: ApiLocation.host, methods: <Method>[
Method(
name: 'set',
arguments: <NamedType>[
NamedType(
type: const TypeDeclaration(
baseName: 'String',
isNullable: false,
),
name: 'key',
),
],
swiftFunction: 'removeValue(key:)',
returnType: const TypeDeclaration.voidDeclaration(),
)
])
],
classes: <Class>[],
enums: <Enum>[],
);
final StringBuffer sink = StringBuffer();
const SwiftOptions swiftOptions = SwiftOptions();
const SwiftGenerator generator = SwiftGenerator();
generator.generate(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>[
Api(name: 'Api', location: ApiLocation.host, methods: <Method>[
Method(
name: 'clear',
arguments: <NamedType>[],
swiftFunction: 'removeAll()',
returnType: const TypeDeclaration.voidDeclaration(),
)
])
],
classes: <Class>[],
enums: <Enum>[],
);
final StringBuffer sink = StringBuffer();
const SwiftOptions swiftOptions = SwiftOptions();
const SwiftGenerator generator = SwiftGenerator();
generator.generate(swiftOptions, root, sink);
final String code = sink.toString();
expect(code, contains('func removeAll()'));
});
} }