mirror of
https://github.com/flutter/packages.git
synced 2025-07-03 09:08:54 +08:00
[pigeon] added support for explicit objects (#483)
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
## 1.0.8
|
||||||
|
|
||||||
|
* [front-end] Started accepting explicit Object references in type arguments.
|
||||||
|
* [codecs] Fixed nuisance where duplicate entries could show up in custom codecs.
|
||||||
|
|
||||||
## 1.0.7
|
## 1.0.7
|
||||||
|
|
||||||
* [front-end] Fixed bug where nested classes' type arguments aren't included in
|
* [front-end] Fixed bug where nested classes' type arguments aren't included in
|
||||||
|
@ -2,6 +2,11 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
|
import 'package:collection/collection.dart' show ListEquality;
|
||||||
|
import 'package:meta/meta.dart';
|
||||||
|
|
||||||
|
final Function _listEquals = const ListEquality<dynamic>().equals;
|
||||||
|
|
||||||
/// Enum that represents where an [Api] is located, on the host or Flutter.
|
/// Enum that represents where an [Api] is located, on the host or Flutter.
|
||||||
enum ApiLocation {
|
enum ApiLocation {
|
||||||
/// The API is for calling functions defined on the host.
|
/// The API is for calling functions defined on the host.
|
||||||
@ -79,16 +84,17 @@ class Api extends Node {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A specific instance of a type.
|
/// A specific instance of a type.
|
||||||
|
@immutable
|
||||||
class TypeDeclaration {
|
class TypeDeclaration {
|
||||||
/// Constructor for [TypeDeclaration].
|
/// Constructor for [TypeDeclaration].
|
||||||
TypeDeclaration({
|
const TypeDeclaration({
|
||||||
required this.baseName,
|
required this.baseName,
|
||||||
required this.isNullable,
|
required this.isNullable,
|
||||||
this.typeArguments = const <TypeDeclaration>[],
|
this.typeArguments = const <TypeDeclaration>[],
|
||||||
});
|
});
|
||||||
|
|
||||||
/// Void constructor.
|
/// Void constructor.
|
||||||
TypeDeclaration.voidDeclaration()
|
const TypeDeclaration.voidDeclaration()
|
||||||
: baseName = 'void',
|
: baseName = 'void',
|
||||||
isNullable = false,
|
isNullable = false,
|
||||||
typeArguments = const <TypeDeclaration>[];
|
typeArguments = const <TypeDeclaration>[];
|
||||||
@ -105,6 +111,31 @@ class TypeDeclaration {
|
|||||||
/// True if the type is nullable.
|
/// True if the type is nullable.
|
||||||
final bool isNullable;
|
final bool isNullable;
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode {
|
||||||
|
// This has to be implemented because TypeDeclaration is used as a Key to a
|
||||||
|
// Map in generator_tools.dart.
|
||||||
|
int hash = 17;
|
||||||
|
hash = hash * 37 + baseName.hashCode;
|
||||||
|
hash = hash * 37 + isNullable.hashCode;
|
||||||
|
for (final TypeDeclaration typeArgument in typeArguments) {
|
||||||
|
hash = hash * 37 + typeArgument.hashCode;
|
||||||
|
}
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
if (other.runtimeType != runtimeType) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return other is TypeDeclaration &&
|
||||||
|
baseName == other.baseName &&
|
||||||
|
isNullable == other.isNullable &&
|
||||||
|
_listEquals(typeArguments, other.typeArguments);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return '(TypeDeclaration baseName:$baseName isNullable:$isNullable typeArguments:$typeArguments)';
|
return '(TypeDeclaration baseName:$baseName isNullable:$isNullable typeArguments:$typeArguments)';
|
||||||
|
@ -8,7 +8,7 @@ import 'dart:mirrors';
|
|||||||
import 'ast.dart';
|
import 'ast.dart';
|
||||||
|
|
||||||
/// The current version of pigeon. This must match the version in pubspec.yaml.
|
/// The current version of pigeon. This must match the version in pubspec.yaml.
|
||||||
const String pigeonVersion = '1.0.7';
|
const String pigeonVersion = '1.0.8';
|
||||||
|
|
||||||
/// Read all the content from [stdin] to a String.
|
/// Read all the content from [stdin] to a String.
|
||||||
String readStdin() {
|
String readStdin() {
|
||||||
@ -275,6 +275,7 @@ const List<String> validTypes = <String>[
|
|||||||
'Float64List',
|
'Float64List',
|
||||||
'List',
|
'List',
|
||||||
'Map',
|
'Map',
|
||||||
|
'Object',
|
||||||
];
|
];
|
||||||
|
|
||||||
/// Custom codecs' custom types are enumerated from 255 down to this number to
|
/// Custom codecs' custom types are enumerated from 255 down to this number to
|
||||||
|
@ -62,48 +62,58 @@ String _className(String? prefix, String className) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String _callbackForType(TypeDeclaration type, String objcType) {
|
String _callbackForType(TypeDeclaration type, _ObjcPtr objcType) {
|
||||||
return type.isVoid
|
return type.isVoid
|
||||||
? 'void(^)(NSError *_Nullable)'
|
? 'void(^)(NSError *_Nullable)'
|
||||||
: 'void(^)($objcType *, NSError *_Nullable)';
|
: 'void(^)(${objcType.ptr.trim()}, NSError *_Nullable)';
|
||||||
}
|
}
|
||||||
|
|
||||||
const Map<String, String> _objcTypeForDartTypeMap = <String, String>{
|
class _ObjcPtr {
|
||||||
'bool': 'NSNumber',
|
const _ObjcPtr({required this.baseName}) : hasAsterisk = baseName != 'id';
|
||||||
'int': 'NSNumber',
|
final String baseName;
|
||||||
'String': 'NSString',
|
final bool hasAsterisk;
|
||||||
'double': 'NSNumber',
|
String get ptr => '$baseName${hasAsterisk ? ' *' : ' '}';
|
||||||
'Uint8List': 'FlutterStandardTypedData',
|
}
|
||||||
'Int32List': 'FlutterStandardTypedData',
|
|
||||||
'Int64List': 'FlutterStandardTypedData',
|
const Map<String, _ObjcPtr> _objcTypeForDartTypeMap = <String, _ObjcPtr>{
|
||||||
'Float64List': 'FlutterStandardTypedData',
|
'bool': _ObjcPtr(baseName: 'NSNumber'),
|
||||||
'List': 'NSArray',
|
'int': _ObjcPtr(baseName: 'NSNumber'),
|
||||||
'Map': 'NSDictionary',
|
'String': _ObjcPtr(baseName: 'NSString'),
|
||||||
|
'double': _ObjcPtr(baseName: 'NSNumber'),
|
||||||
|
'Uint8List': _ObjcPtr(baseName: 'FlutterStandardTypedData'),
|
||||||
|
'Int32List': _ObjcPtr(baseName: 'FlutterStandardTypedData'),
|
||||||
|
'Int64List': _ObjcPtr(baseName: 'FlutterStandardTypedData'),
|
||||||
|
'Float64List': _ObjcPtr(baseName: 'FlutterStandardTypedData'),
|
||||||
|
'List': _ObjcPtr(baseName: 'NSArray'),
|
||||||
|
'Map': _ObjcPtr(baseName: 'NSDictionary'),
|
||||||
|
'Object': _ObjcPtr(baseName: 'id'),
|
||||||
};
|
};
|
||||||
|
|
||||||
String _flattenTypeArguments(String? classPrefix, List<TypeDeclaration> args) {
|
String _flattenTypeArguments(String? classPrefix, List<TypeDeclaration> args) {
|
||||||
final String result = args
|
final String result = args
|
||||||
.map<String>(
|
.map<String>((TypeDeclaration e) =>
|
||||||
(TypeDeclaration e) => '${_objcTypeForDartType(classPrefix, e)} *')
|
_objcTypeForDartType(classPrefix, e).ptr.trim())
|
||||||
.join(', ');
|
.join(', ');
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
String? _objcTypePtrForPrimitiveDartType(String? classPrefix, NamedType field) {
|
String? _objcTypePtrForPrimitiveDartType(String? classPrefix, NamedType field) {
|
||||||
return _objcTypeForDartTypeMap.containsKey(field.type.baseName)
|
return _objcTypeForDartTypeMap.containsKey(field.type.baseName)
|
||||||
? '${_objcTypeForDartType(classPrefix, field.type)} *'
|
? _objcTypeForDartType(classPrefix, field.type).ptr
|
||||||
: null;
|
: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the objc type for a dart [type], prepending the [classPrefix] for
|
/// Returns the objc type for a dart [type], prepending the [classPrefix] for
|
||||||
/// generated classes. For example:
|
/// generated classes. For example:
|
||||||
/// _objcTypeForDartType(null, 'int') => 'NSNumber'.
|
/// _objcTypeForDartType(null, 'int') => 'NSNumber'.
|
||||||
String _objcTypeForDartType(String? classPrefix, TypeDeclaration field) {
|
_ObjcPtr _objcTypeForDartType(String? classPrefix, TypeDeclaration field) {
|
||||||
return _objcTypeForDartTypeMap.containsKey(field.baseName)
|
return _objcTypeForDartTypeMap.containsKey(field.baseName)
|
||||||
? field.typeArguments.isEmpty
|
? field.typeArguments.isEmpty
|
||||||
? _objcTypeForDartTypeMap[field.baseName]!
|
? _objcTypeForDartTypeMap[field.baseName]!
|
||||||
: '${_objcTypeForDartTypeMap[field.baseName]}<${_flattenTypeArguments(classPrefix, field.typeArguments)}>'
|
: _ObjcPtr(
|
||||||
: _className(classPrefix, field.baseName);
|
baseName:
|
||||||
|
'${_objcTypeForDartTypeMap[field.baseName]!.baseName}<${_flattenTypeArguments(classPrefix, field.typeArguments)}>')
|
||||||
|
: _ObjcPtr(baseName: _className(classPrefix, field.baseName));
|
||||||
}
|
}
|
||||||
|
|
||||||
String _propertyTypeForDartType(NamedType field) {
|
String _propertyTypeForDartType(NamedType field) {
|
||||||
@ -293,8 +303,8 @@ String _makeObjcSignature({
|
|||||||
final Iterable<String> argTypes = followedByOne(
|
final Iterable<String> argTypes = followedByOne(
|
||||||
func.arguments.map((NamedType arg) {
|
func.arguments.map((NamedType arg) {
|
||||||
final String nullable = func.isAsynchronous ? 'nullable ' : '';
|
final String nullable = func.isAsynchronous ? 'nullable ' : '';
|
||||||
final String argType = _objcTypeForDartType(options.prefix, arg.type);
|
final _ObjcPtr argType = _objcTypeForDartType(options.prefix, arg.type);
|
||||||
return '$nullable$argType *';
|
return '$nullable${argType.ptr.trim()}';
|
||||||
}),
|
}),
|
||||||
lastArgType,
|
lastArgType,
|
||||||
);
|
);
|
||||||
@ -313,7 +323,7 @@ void _writeHostApiDeclaration(Indent indent, Api api, ObjcOptions options) {
|
|||||||
final String apiName = _className(options.prefix, api.name);
|
final String apiName = _className(options.prefix, api.name);
|
||||||
indent.writeln('@protocol $apiName');
|
indent.writeln('@protocol $apiName');
|
||||||
for (final Method func in api.methods) {
|
for (final Method func in api.methods) {
|
||||||
final String returnTypeName =
|
final _ObjcPtr returnTypeName =
|
||||||
_objcTypeForDartType(options.prefix, func.returnType);
|
_objcTypeForDartType(options.prefix, func.returnType);
|
||||||
|
|
||||||
String? lastArgName;
|
String? lastArgName;
|
||||||
@ -326,12 +336,13 @@ void _writeHostApiDeclaration(Indent indent, Api api, ObjcOptions options) {
|
|||||||
lastArgName = 'completion';
|
lastArgName = 'completion';
|
||||||
} else {
|
} else {
|
||||||
lastArgType =
|
lastArgType =
|
||||||
'void(^)($returnTypeName *_Nullable, FlutterError *_Nullable)';
|
'void(^)(${returnTypeName.ptr}_Nullable, FlutterError *_Nullable)';
|
||||||
lastArgName = 'completion';
|
lastArgName = 'completion';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
returnType =
|
returnType = func.returnType.isVoid
|
||||||
func.returnType.isVoid ? 'void' : 'nullable $returnTypeName *';
|
? 'void'
|
||||||
|
: 'nullable ${returnTypeName.ptr.trim()}';
|
||||||
lastArgType = 'FlutterError *_Nullable *_Nonnull';
|
lastArgType = 'FlutterError *_Nullable *_Nonnull';
|
||||||
lastArgName = 'error';
|
lastArgName = 'error';
|
||||||
}
|
}
|
||||||
@ -356,7 +367,7 @@ void _writeFlutterApiDeclaration(Indent indent, Api api, ObjcOptions options) {
|
|||||||
indent.writeln(
|
indent.writeln(
|
||||||
'- (instancetype)initWithBinaryMessenger:(id<FlutterBinaryMessenger>)binaryMessenger;');
|
'- (instancetype)initWithBinaryMessenger:(id<FlutterBinaryMessenger>)binaryMessenger;');
|
||||||
for (final Method func in api.methods) {
|
for (final Method func in api.methods) {
|
||||||
final String returnType =
|
final _ObjcPtr returnType =
|
||||||
_objcTypeForDartType(options.prefix, func.returnType);
|
_objcTypeForDartType(options.prefix, func.returnType);
|
||||||
final String callbackType = _callbackForType(func.returnType, returnType);
|
final String callbackType = _callbackForType(func.returnType, returnType);
|
||||||
indent.writeln(_makeObjcSignature(
|
indent.writeln(_makeObjcSignature(
|
||||||
@ -492,7 +503,7 @@ void _writeHostApiSource(Indent indent, ObjcOptions options, Api api) {
|
|||||||
indent.write(
|
indent.write(
|
||||||
'[channel setMessageHandler:^(id _Nullable message, FlutterReply callback) ');
|
'[channel setMessageHandler:^(id _Nullable message, FlutterReply callback) ');
|
||||||
indent.scoped('{', '}];', () {
|
indent.scoped('{', '}];', () {
|
||||||
final String returnType =
|
final _ObjcPtr returnType =
|
||||||
_objcTypeForDartType(options.prefix, func.returnType);
|
_objcTypeForDartType(options.prefix, func.returnType);
|
||||||
String syncCall;
|
String syncCall;
|
||||||
String? callSignature;
|
String? callSignature;
|
||||||
@ -506,9 +517,9 @@ void _writeHostApiSource(Indent indent, ObjcOptions options, Api api) {
|
|||||||
indexMap(func.arguments, _getSafeArgName);
|
indexMap(func.arguments, _getSafeArgName);
|
||||||
map3(wholeNumbers.take(func.arguments.length), argNames,
|
map3(wholeNumbers.take(func.arguments.length), argNames,
|
||||||
func.arguments, (int count, String argName, NamedType arg) {
|
func.arguments, (int count, String argName, NamedType arg) {
|
||||||
final String argType =
|
final _ObjcPtr argType =
|
||||||
_objcTypeForDartType(options.prefix, arg.type);
|
_objcTypeForDartType(options.prefix, arg.type);
|
||||||
return '$argType *$argName = args[$count];';
|
return '${argType.ptr}$argName = args[$count];';
|
||||||
}).forEach(indent.writeln);
|
}).forEach(indent.writeln);
|
||||||
callSignature =
|
callSignature =
|
||||||
map2(selectorComponents.take(argNames.length), argNames,
|
map2(selectorComponents.take(argNames.length), argNames,
|
||||||
@ -537,13 +548,13 @@ void _writeHostApiSource(Indent indent, ObjcOptions options, Api api) {
|
|||||||
const String callback = 'callback(wrapResult(output, error));';
|
const String callback = 'callback(wrapResult(output, error));';
|
||||||
if (func.arguments.isEmpty) {
|
if (func.arguments.isEmpty) {
|
||||||
indent.writeScoped(
|
indent.writeScoped(
|
||||||
'[api ${selectorComponents.first}:^($returnType *_Nullable output, FlutterError *_Nullable error) {',
|
'[api ${selectorComponents.first}:^(${returnType.ptr}_Nullable output, FlutterError *_Nullable error) {',
|
||||||
'}];', () {
|
'}];', () {
|
||||||
indent.writeln(callback);
|
indent.writeln(callback);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
indent.writeScoped(
|
indent.writeScoped(
|
||||||
'[api $callSignature ${selectorComponents.last}:^($returnType *_Nullable output, FlutterError *_Nullable error) {',
|
'[api $callSignature ${selectorComponents.last}:^(${returnType.ptr}_Nullable output, FlutterError *_Nullable error) {',
|
||||||
'}];', () {
|
'}];', () {
|
||||||
indent.writeln(callback);
|
indent.writeln(callback);
|
||||||
});
|
});
|
||||||
@ -555,7 +566,7 @@ void _writeHostApiSource(Indent indent, ObjcOptions options, Api api) {
|
|||||||
indent.writeln('$syncCall;');
|
indent.writeln('$syncCall;');
|
||||||
indent.writeln('callback(wrapResult(nil, error));');
|
indent.writeln('callback(wrapResult(nil, error));');
|
||||||
} else {
|
} else {
|
||||||
indent.writeln('$returnType *output = $syncCall;');
|
indent.writeln('${returnType.ptr}output = $syncCall;');
|
||||||
indent.writeln('callback(wrapResult(output, error));');
|
indent.writeln('callback(wrapResult(output, error));');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -591,7 +602,7 @@ void _writeFlutterApiSource(Indent indent, ObjcOptions options, Api api) {
|
|||||||
});
|
});
|
||||||
indent.addln('');
|
indent.addln('');
|
||||||
for (final Method func in api.methods) {
|
for (final Method func in api.methods) {
|
||||||
final String returnType =
|
final _ObjcPtr returnType =
|
||||||
_objcTypeForDartType(options.prefix, func.returnType);
|
_objcTypeForDartType(options.prefix, func.returnType);
|
||||||
final String callbackType = _callbackForType(func.returnType, returnType);
|
final String callbackType = _callbackForType(func.returnType, returnType);
|
||||||
|
|
||||||
@ -627,7 +638,7 @@ void _writeFlutterApiSource(Indent indent, ObjcOptions options, Api api) {
|
|||||||
if (func.returnType.isVoid) {
|
if (func.returnType.isVoid) {
|
||||||
indent.writeln('completion(nil);');
|
indent.writeln('completion(nil);');
|
||||||
} else {
|
} else {
|
||||||
indent.writeln('$returnType *output = reply;');
|
indent.writeln('${returnType.ptr}output = reply;');
|
||||||
indent.writeln('completion(output, nil);');
|
indent.writeln('completion(output, nil);');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -565,6 +565,7 @@ class _RootBuilder extends dart_ast_visitor.RecursiveAstVisitor<Object?> {
|
|||||||
!validTypes.contains(element.key.baseName) &&
|
!validTypes.contains(element.key.baseName) &&
|
||||||
!element.key.isVoid &&
|
!element.key.isVoid &&
|
||||||
element.key.baseName != 'dynamic' &&
|
element.key.baseName != 'dynamic' &&
|
||||||
|
element.key.baseName != 'Object' &&
|
||||||
element.key.baseName.isNotEmpty) {
|
element.key.baseName.isNotEmpty) {
|
||||||
final int? lineNumber = element.value.isEmpty
|
final int? lineNumber = element.value.isEmpty
|
||||||
? null
|
? null
|
||||||
@ -709,7 +710,7 @@ class _RootBuilder extends dart_ast_visitor.RecursiveAstVisitor<Object?> {
|
|||||||
} else {
|
} else {
|
||||||
return NamedType(
|
return NamedType(
|
||||||
name: '',
|
name: '',
|
||||||
type: TypeDeclaration(baseName: '', isNullable: false),
|
type: const TypeDeclaration(baseName: '', isNullable: false),
|
||||||
offset: parameter.offset,
|
offset: parameter.offset,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ class Everything {
|
|||||||
Map? aMap;
|
Map? aMap;
|
||||||
List<List<bool?>?>? nestedList;
|
List<List<bool?>?>? nestedList;
|
||||||
Map<String?, String?>? mapWithAnnotations;
|
Map<String?, String?>? mapWithAnnotations;
|
||||||
|
Map<String?, Object?>? mapWithObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@HostApi()
|
@HostApi()
|
||||||
|
@ -51,6 +51,7 @@ public class AllDatatypesTest {
|
|||||||
assertNull(everything.getAFloatArray());
|
assertNull(everything.getAFloatArray());
|
||||||
assertNull(everything.getAList());
|
assertNull(everything.getAList());
|
||||||
assertNull(everything.getAMap());
|
assertNull(everything.getAMap());
|
||||||
|
assertNull(everything.getMapWithObject());
|
||||||
});
|
});
|
||||||
assertTrue(didCall[0]);
|
assertTrue(didCall[0]);
|
||||||
}
|
}
|
||||||
@ -61,6 +62,12 @@ public class AllDatatypesTest {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static HashMap<String, Object> makeStringMap(String key, Integer value) {
|
||||||
|
HashMap<String, Object> result = new HashMap<String, Object>();
|
||||||
|
result.put(key, value);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
private static boolean floatArraysEqual(double[] x, double[] y) {
|
private static boolean floatArraysEqual(double[] x, double[] y) {
|
||||||
if (x.length != y.length) {
|
if (x.length != y.length) {
|
||||||
return false;
|
return false;
|
||||||
@ -86,6 +93,7 @@ public class AllDatatypesTest {
|
|||||||
everything.setAFloatArray(new double[] {0.5, 0.25, 1.5, 1.25});
|
everything.setAFloatArray(new double[] {0.5, 0.25, 1.5, 1.25});
|
||||||
everything.setAList(Arrays.asList(new int[] {1, 2, 3}));
|
everything.setAList(Arrays.asList(new int[] {1, 2, 3}));
|
||||||
everything.setAMap(makeMap("hello", 1234));
|
everything.setAMap(makeMap("hello", 1234));
|
||||||
|
everything.setMapWithObject(makeStringMap("hello", 1234));
|
||||||
BinaryMessenger binaryMessenger = mock(BinaryMessenger.class);
|
BinaryMessenger binaryMessenger = mock(BinaryMessenger.class);
|
||||||
doAnswer(
|
doAnswer(
|
||||||
invocation -> {
|
invocation -> {
|
||||||
@ -120,6 +128,9 @@ public class AllDatatypesTest {
|
|||||||
everything.getAMap().keySet().toArray(), result.getAMap().keySet().toArray());
|
everything.getAMap().keySet().toArray(), result.getAMap().keySet().toArray());
|
||||||
assertArrayEquals(
|
assertArrayEquals(
|
||||||
everything.getAMap().values().toArray(), result.getAMap().values().toArray());
|
everything.getAMap().values().toArray(), result.getAMap().values().toArray());
|
||||||
|
assertArrayEquals(
|
||||||
|
everything.getMapWithObject().values().toArray(),
|
||||||
|
result.getMapWithObject().values().toArray());
|
||||||
});
|
});
|
||||||
assertTrue(didCall[0]);
|
assertTrue(didCall[0]);
|
||||||
}
|
}
|
||||||
|
@ -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 (v0.3.0), do not edit directly.
|
// Autogenerated from Pigeon (v1.0.8), 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
|
// 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
|
||||||
// @dart = 2.12
|
// @dart = 2.12
|
||||||
@ -25,6 +25,7 @@ class Everything {
|
|||||||
Map<Object?, Object?>? aMap;
|
Map<Object?, Object?>? aMap;
|
||||||
List<List<bool?>?>? nestedList;
|
List<List<bool?>?>? nestedList;
|
||||||
Map<String?, String?>? mapWithAnnotations;
|
Map<String?, String?>? mapWithAnnotations;
|
||||||
|
Map<String?, Object?>? mapWithObject;
|
||||||
|
|
||||||
Object encode() {
|
Object encode() {
|
||||||
final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
|
final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
|
||||||
@ -40,6 +41,7 @@ class Everything {
|
|||||||
pigeonMap['aMap'] = aMap;
|
pigeonMap['aMap'] = aMap;
|
||||||
pigeonMap['nestedList'] = nestedList;
|
pigeonMap['nestedList'] = nestedList;
|
||||||
pigeonMap['mapWithAnnotations'] = mapWithAnnotations;
|
pigeonMap['mapWithAnnotations'] = mapWithAnnotations;
|
||||||
|
pigeonMap['mapWithObject'] = mapWithObject;
|
||||||
return pigeonMap;
|
return pigeonMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +62,9 @@ class Everything {
|
|||||||
(pigeonMap['nestedList'] as List<Object?>?)?.cast<List<bool?>?>()
|
(pigeonMap['nestedList'] as List<Object?>?)?.cast<List<bool?>?>()
|
||||||
..mapWithAnnotations =
|
..mapWithAnnotations =
|
||||||
(pigeonMap['mapWithAnnotations'] as Map<Object?, Object?>?)
|
(pigeonMap['mapWithAnnotations'] as Map<Object?, Object?>?)
|
||||||
?.cast<String?, String?>();
|
?.cast<String?, String?>()
|
||||||
|
..mapWithObject = (pigeonMap['mapWithObject'] as Map<Object?, Object?>?)
|
||||||
|
?.cast<String?, Object?>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ void main() {
|
|||||||
expect(result.aMap, isNull);
|
expect(result.aMap, isNull);
|
||||||
expect(result.nestedList, isNull);
|
expect(result.nestedList, isNull);
|
||||||
expect(result.mapWithAnnotations, isNull);
|
expect(result.mapWithAnnotations, isNull);
|
||||||
|
expect(result.mapWithObject, isNull);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('with values', () async {
|
test('with values', () async {
|
||||||
@ -54,6 +55,7 @@ void main() {
|
|||||||
<bool?>[true]
|
<bool?>[true]
|
||||||
];
|
];
|
||||||
everything.mapWithAnnotations = <String?, String?>{'hello': 'world'};
|
everything.mapWithAnnotations = <String?, String?>{'hello': 'world'};
|
||||||
|
everything.mapWithObject = <String?, Object?>{'hello': 1234};
|
||||||
final BinaryMessenger mockMessenger = MockBinaryMessenger();
|
final BinaryMessenger mockMessenger = MockBinaryMessenger();
|
||||||
echoOneArgument(
|
echoOneArgument(
|
||||||
mockMessenger,
|
mockMessenger,
|
||||||
@ -74,5 +76,6 @@ void main() {
|
|||||||
expect(result.aMap, everything.aMap);
|
expect(result.aMap, everything.aMap);
|
||||||
expect(result.aList, everything.aList);
|
expect(result.aList, everything.aList);
|
||||||
expect(result.mapWithAnnotations, everything.mapWithAnnotations);
|
expect(result.mapWithAnnotations, everything.mapWithAnnotations);
|
||||||
|
expect(result.mapWithObject, everything.mapWithObject);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "1020"
|
LastUpgradeVersion = "1300"
|
||||||
version = "1.3">
|
version = "1.3">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
typedDataWithFloat64:[@"12345678" dataUsingEncoding:NSUTF8StringEncoding]];
|
typedDataWithFloat64:[@"12345678" dataUsingEncoding:NSUTF8StringEncoding]];
|
||||||
everything.aList = @[ @(1), @(2) ];
|
everything.aList = @[ @(1), @(2) ];
|
||||||
everything.aMap = @{ @"hello" : @(1234) };
|
everything.aMap = @{ @"hello" : @(1234) };
|
||||||
|
everything.mapWithObject = @{ @"hello" : @(1234), @"goodbye" : @"world" };
|
||||||
EchoBinaryMessenger* binaryMessenger =
|
EchoBinaryMessenger* binaryMessenger =
|
||||||
[[EchoBinaryMessenger alloc] initWithCodec:FlutterEverythingGetCodec()];
|
[[EchoBinaryMessenger alloc] initWithCodec:FlutterEverythingGetCodec()];
|
||||||
FlutterEverything* api = [[FlutterEverything alloc] initWithBinaryMessenger:binaryMessenger];
|
FlutterEverything* api = [[FlutterEverything alloc] initWithBinaryMessenger:binaryMessenger];
|
||||||
@ -69,6 +70,7 @@
|
|||||||
XCTAssertEqualObjects(result.aFloatArray.data, everything.aFloatArray.data);
|
XCTAssertEqualObjects(result.aFloatArray.data, everything.aFloatArray.data);
|
||||||
XCTAssertEqualObjects(result.aList, everything.aList);
|
XCTAssertEqualObjects(result.aList, everything.aList);
|
||||||
XCTAssertEqualObjects(result.aMap, everything.aMap);
|
XCTAssertEqualObjects(result.aMap, everything.aMap);
|
||||||
|
XCTAssertEqualObjects(result.mapWithObject, everything.mapWithObject);
|
||||||
[expectation fulfill];
|
[expectation fulfill];
|
||||||
}];
|
}];
|
||||||
[self waitForExpectations:@[ expectation ] timeout:1.0];
|
[self waitForExpectations:@[ expectation ] timeout:1.0];
|
||||||
|
@ -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/master/packages/pigeon
|
repository: https://github.com/flutter/packages/tree/master/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: 1.0.7 # This must match the version in lib/generator_tools.dart
|
version: 1.0.8 # 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'
|
||||||
@ -10,6 +10,8 @@ environment:
|
|||||||
dependencies:
|
dependencies:
|
||||||
analyzer: ^2.4.0
|
analyzer: ^2.4.0
|
||||||
args: ^2.0.0
|
args: ^2.0.0
|
||||||
|
collection: ^1.15.0
|
||||||
|
meta: ^1.7.0
|
||||||
path: ^1.8.0
|
path: ^1.8.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
|
@ -234,8 +234,8 @@ run_mock_handler_tests() {
|
|||||||
--input pigeons/message.dart \
|
--input pigeons/message.dart \
|
||||||
--dart_out mock_handler_tester/test/message.dart \
|
--dart_out mock_handler_tester/test/message.dart \
|
||||||
--dart_test_out mock_handler_tester/test/test.dart
|
--dart_test_out mock_handler_tester/test/test.dart
|
||||||
dartfmt -w mock_handler_tester/test/message.dart
|
dart format mock_handler_tester/test/message.dart
|
||||||
dartfmt -w mock_handler_tester/test/test.dart
|
dart format mock_handler_tester/test/test.dart
|
||||||
cd mock_handler_tester
|
cd mock_handler_tester
|
||||||
flutter test
|
flutter test
|
||||||
popd
|
popd
|
||||||
@ -299,7 +299,7 @@ run_ios_e2e_tests() {
|
|||||||
--objc_header_out $DARTLE_H \
|
--objc_header_out $DARTLE_H \
|
||||||
--objc_source_out $DARTLE_M \
|
--objc_source_out $DARTLE_M \
|
||||||
--java_out $PIGEON_JAVA
|
--java_out $PIGEON_JAVA
|
||||||
dartfmt -w $DARTLE_DART
|
dart format $DARTLE_DART
|
||||||
|
|
||||||
pushd $PWD
|
pushd $PWD
|
||||||
cd e2e_tests/test_objc
|
cd e2e_tests/test_objc
|
||||||
|
@ -13,7 +13,7 @@ void main() {
|
|||||||
name: 'Foobar',
|
name: 'Foobar',
|
||||||
fields: <NamedType>[
|
fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'dataType1',
|
baseName: 'dataType1',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -61,21 +61,22 @@ void main() {
|
|||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Input',
|
baseName: 'Input',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
),
|
),
|
||||||
name: 'input',
|
name: 'input',
|
||||||
offset: null)
|
offset: null)
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration(baseName: 'Output', isNullable: false),
|
returnType:
|
||||||
|
const TypeDeclaration(baseName: 'Output', isNullable: false),
|
||||||
isAsynchronous: false,
|
isAsynchronous: false,
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Input', fields: <NamedType>[
|
Class(name: 'Input', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'String',
|
baseName: 'String',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -84,7 +85,7 @@ void main() {
|
|||||||
]),
|
]),
|
||||||
Class(name: 'Output', fields: <NamedType>[
|
Class(name: 'Output', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'String',
|
baseName: 'String',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -107,12 +108,14 @@ void main() {
|
|||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
name: 'x',
|
name: 'x',
|
||||||
type: TypeDeclaration(isNullable: false, baseName: 'int')),
|
type:
|
||||||
|
const TypeDeclaration(isNullable: false, baseName: 'int')),
|
||||||
NamedType(
|
NamedType(
|
||||||
name: 'y',
|
name: 'y',
|
||||||
type: TypeDeclaration(isNullable: false, baseName: 'int')),
|
type:
|
||||||
|
const TypeDeclaration(isNullable: false, baseName: 'int')),
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration(baseName: 'int', isNullable: false),
|
returnType: const TypeDeclaration(baseName: 'int', isNullable: false),
|
||||||
isAsynchronous: false,
|
isAsynchronous: false,
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
@ -133,12 +136,14 @@ void main() {
|
|||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
name: 'x',
|
name: 'x',
|
||||||
type: TypeDeclaration(isNullable: false, baseName: 'int')),
|
type:
|
||||||
|
const TypeDeclaration(isNullable: false, baseName: 'int')),
|
||||||
NamedType(
|
NamedType(
|
||||||
name: 'y',
|
name: 'y',
|
||||||
type: TypeDeclaration(isNullable: false, baseName: 'int')),
|
type:
|
||||||
|
const TypeDeclaration(isNullable: false, baseName: 'int')),
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration(baseName: 'int', isNullable: false),
|
returnType: const TypeDeclaration(baseName: 'int', isNullable: false),
|
||||||
isAsynchronous: false,
|
isAsynchronous: false,
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
@ -161,7 +166,7 @@ void main() {
|
|||||||
name: 'Input',
|
name: 'Input',
|
||||||
fields: <NamedType>[
|
fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'String',
|
baseName: 'String',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -173,7 +178,7 @@ void main() {
|
|||||||
name: 'Nested',
|
name: 'Nested',
|
||||||
fields: <NamedType>[
|
fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Input',
|
baseName: 'Input',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -206,21 +211,22 @@ void main() {
|
|||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Input',
|
baseName: 'Input',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
),
|
),
|
||||||
name: 'input',
|
name: 'input',
|
||||||
offset: null)
|
offset: null)
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration(baseName: 'Output', isNullable: false),
|
returnType:
|
||||||
|
const TypeDeclaration(baseName: 'Output', isNullable: false),
|
||||||
isAsynchronous: false,
|
isAsynchronous: false,
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Input', fields: <NamedType>[
|
Class(name: 'Input', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'String',
|
baseName: 'String',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -229,7 +235,7 @@ void main() {
|
|||||||
]),
|
]),
|
||||||
Class(name: 'Output', fields: <NamedType>[
|
Class(name: 'Output', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'String',
|
baseName: 'String',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -252,21 +258,21 @@ void main() {
|
|||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Input',
|
baseName: 'Input',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
),
|
),
|
||||||
name: '',
|
name: '',
|
||||||
offset: null)
|
offset: null)
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration.voidDeclaration(),
|
returnType: const TypeDeclaration.voidDeclaration(),
|
||||||
isAsynchronous: false,
|
isAsynchronous: false,
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Input', fields: <NamedType>[
|
Class(name: 'Input', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'String',
|
baseName: 'String',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -288,21 +294,21 @@ void main() {
|
|||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Input',
|
baseName: 'Input',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
),
|
),
|
||||||
name: '',
|
name: '',
|
||||||
offset: null)
|
offset: null)
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration.voidDeclaration(),
|
returnType: const TypeDeclaration.voidDeclaration(),
|
||||||
isAsynchronous: false,
|
isAsynchronous: false,
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Input', fields: <NamedType>[
|
Class(name: 'Input', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'String',
|
baseName: 'String',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -326,14 +332,15 @@ void main() {
|
|||||||
Method(
|
Method(
|
||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[],
|
arguments: <NamedType>[],
|
||||||
returnType: TypeDeclaration(baseName: 'Output', isNullable: false),
|
returnType:
|
||||||
|
const TypeDeclaration(baseName: 'Output', isNullable: false),
|
||||||
isAsynchronous: false,
|
isAsynchronous: false,
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Output', fields: <NamedType>[
|
Class(name: 'Output', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'String',
|
baseName: 'String',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -355,21 +362,22 @@ void main() {
|
|||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'EnumClass',
|
baseName: 'EnumClass',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
),
|
),
|
||||||
name: '',
|
name: '',
|
||||||
offset: null)
|
offset: null)
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration(baseName: 'EnumClass', isNullable: false),
|
returnType:
|
||||||
|
const TypeDeclaration(baseName: 'EnumClass', isNullable: false),
|
||||||
isAsynchronous: false,
|
isAsynchronous: false,
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'EnumClass', fields: <NamedType>[
|
Class(name: 'EnumClass', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Enum',
|
baseName: 'Enum',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -401,21 +409,22 @@ void main() {
|
|||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'EnumClass',
|
baseName: 'EnumClass',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
),
|
),
|
||||||
name: '',
|
name: '',
|
||||||
offset: null)
|
offset: null)
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration(baseName: 'EnumClass', isNullable: false),
|
returnType:
|
||||||
|
const TypeDeclaration(baseName: 'EnumClass', isNullable: false),
|
||||||
isAsynchronous: false,
|
isAsynchronous: false,
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'EnumClass', fields: <NamedType>[
|
Class(name: 'EnumClass', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Enum',
|
baseName: 'Enum',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -448,14 +457,15 @@ void main() {
|
|||||||
Method(
|
Method(
|
||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[],
|
arguments: <NamedType>[],
|
||||||
returnType: TypeDeclaration(baseName: 'Output', isNullable: false),
|
returnType:
|
||||||
|
const TypeDeclaration(baseName: 'Output', isNullable: false),
|
||||||
isAsynchronous: false,
|
isAsynchronous: false,
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Output', fields: <NamedType>[
|
Class(name: 'Output', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'String',
|
baseName: 'String',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -480,7 +490,7 @@ void main() {
|
|||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Input',
|
baseName: 'Input',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
),
|
),
|
||||||
@ -488,28 +498,28 @@ void main() {
|
|||||||
offset: null)
|
offset: null)
|
||||||
],
|
],
|
||||||
returnType:
|
returnType:
|
||||||
TypeDeclaration(baseName: 'Output', isNullable: false),
|
const TypeDeclaration(baseName: 'Output', isNullable: false),
|
||||||
isAsynchronous: false,
|
isAsynchronous: false,
|
||||||
),
|
),
|
||||||
Method(
|
Method(
|
||||||
name: 'voidReturner',
|
name: 'voidReturner',
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Input',
|
baseName: 'Input',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
),
|
),
|
||||||
name: '',
|
name: '',
|
||||||
offset: null)
|
offset: null)
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration.voidDeclaration(),
|
returnType: const TypeDeclaration.voidDeclaration(),
|
||||||
isAsynchronous: false,
|
isAsynchronous: false,
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Input', fields: <NamedType>[
|
Class(name: 'Input', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'String',
|
baseName: 'String',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -518,7 +528,7 @@ void main() {
|
|||||||
]),
|
]),
|
||||||
Class(name: 'Output', fields: <NamedType>[
|
Class(name: 'Output', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'String',
|
baseName: 'String',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -552,7 +562,7 @@ void main() {
|
|||||||
name: 'Foobar',
|
name: 'Foobar',
|
||||||
fields: <NamedType>[
|
fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'dataType1',
|
baseName: 'dataType1',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -578,21 +588,22 @@ void main() {
|
|||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Input',
|
baseName: 'Input',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
),
|
),
|
||||||
name: '',
|
name: '',
|
||||||
offset: null)
|
offset: null)
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration(baseName: 'Output', isNullable: false),
|
returnType:
|
||||||
|
const TypeDeclaration(baseName: 'Output', isNullable: false),
|
||||||
isAsynchronous: true,
|
isAsynchronous: true,
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Input', fields: <NamedType>[
|
Class(name: 'Input', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'String',
|
baseName: 'String',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -601,7 +612,7 @@ void main() {
|
|||||||
]),
|
]),
|
||||||
Class(name: 'Output', fields: <NamedType>[
|
Class(name: 'Output', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'String',
|
baseName: 'String',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -625,21 +636,21 @@ void main() {
|
|||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Input',
|
baseName: 'Input',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
),
|
),
|
||||||
name: '',
|
name: '',
|
||||||
offset: null)
|
offset: null)
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration.voidDeclaration(),
|
returnType: const TypeDeclaration.voidDeclaration(),
|
||||||
isAsynchronous: true,
|
isAsynchronous: true,
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Input', fields: <NamedType>[
|
Class(name: 'Input', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'String',
|
baseName: 'String',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -648,7 +659,7 @@ void main() {
|
|||||||
]),
|
]),
|
||||||
Class(name: 'Output', fields: <NamedType>[
|
Class(name: 'Output', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'String',
|
baseName: 'String',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -671,21 +682,22 @@ void main() {
|
|||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Input',
|
baseName: 'Input',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
),
|
),
|
||||||
name: '',
|
name: '',
|
||||||
offset: null)
|
offset: null)
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration(baseName: 'Output', isNullable: false),
|
returnType:
|
||||||
|
const TypeDeclaration(baseName: 'Output', isNullable: false),
|
||||||
isAsynchronous: true,
|
isAsynchronous: true,
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Input', fields: <NamedType>[
|
Class(name: 'Input', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'String',
|
baseName: 'String',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -694,7 +706,7 @@ void main() {
|
|||||||
]),
|
]),
|
||||||
Class(name: 'Output', fields: <NamedType>[
|
Class(name: 'Output', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'String',
|
baseName: 'String',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -715,14 +727,15 @@ void main() {
|
|||||||
Method(
|
Method(
|
||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[],
|
arguments: <NamedType>[],
|
||||||
returnType: TypeDeclaration(baseName: 'Output', isNullable: false),
|
returnType:
|
||||||
|
const TypeDeclaration(baseName: 'Output', isNullable: false),
|
||||||
isAsynchronous: true,
|
isAsynchronous: true,
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Output', fields: <NamedType>[
|
Class(name: 'Output', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'String',
|
baseName: 'String',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -758,7 +771,7 @@ void main() {
|
|||||||
name: 'Foobar',
|
name: 'Foobar',
|
||||||
fields: <NamedType>[
|
fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'List',
|
baseName: 'List',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
typeArguments: <TypeDeclaration>[
|
typeArguments: <TypeDeclaration>[
|
||||||
@ -785,7 +798,7 @@ void main() {
|
|||||||
name: 'Foobar',
|
name: 'Foobar',
|
||||||
fields: <NamedType>[
|
fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Map',
|
baseName: 'Map',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
typeArguments: <TypeDeclaration>[
|
typeArguments: <TypeDeclaration>[
|
||||||
@ -814,10 +827,10 @@ void main() {
|
|||||||
Api(name: 'Api', location: ApiLocation.host, methods: <Method>[
|
Api(name: 'Api', location: ApiLocation.host, methods: <Method>[
|
||||||
Method(
|
Method(
|
||||||
name: 'doit',
|
name: 'doit',
|
||||||
returnType: TypeDeclaration.voidDeclaration(),
|
returnType: const TypeDeclaration.voidDeclaration(),
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'List',
|
baseName: 'List',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
typeArguments: <TypeDeclaration>[
|
typeArguments: <TypeDeclaration>[
|
||||||
@ -843,10 +856,10 @@ void main() {
|
|||||||
Api(name: 'Api', location: ApiLocation.flutter, methods: <Method>[
|
Api(name: 'Api', location: ApiLocation.flutter, methods: <Method>[
|
||||||
Method(
|
Method(
|
||||||
name: 'doit',
|
name: 'doit',
|
||||||
returnType: TypeDeclaration.voidDeclaration(),
|
returnType: const TypeDeclaration.voidDeclaration(),
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'List',
|
baseName: 'List',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
typeArguments: <TypeDeclaration>[
|
typeArguments: <TypeDeclaration>[
|
||||||
@ -872,7 +885,7 @@ void main() {
|
|||||||
Api(name: 'Api', location: ApiLocation.host, methods: <Method>[
|
Api(name: 'Api', location: ApiLocation.host, methods: <Method>[
|
||||||
Method(
|
Method(
|
||||||
name: 'doit',
|
name: 'doit',
|
||||||
returnType: TypeDeclaration(
|
returnType: const TypeDeclaration(
|
||||||
baseName: 'List',
|
baseName: 'List',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
typeArguments: <TypeDeclaration>[
|
typeArguments: <TypeDeclaration>[
|
||||||
@ -900,7 +913,7 @@ void main() {
|
|||||||
Api(name: 'Api', location: ApiLocation.flutter, methods: <Method>[
|
Api(name: 'Api', location: ApiLocation.flutter, methods: <Method>[
|
||||||
Method(
|
Method(
|
||||||
name: 'doit',
|
name: 'doit',
|
||||||
returnType: TypeDeclaration(
|
returnType: const TypeDeclaration(
|
||||||
baseName: 'List',
|
baseName: 'List',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
typeArguments: <TypeDeclaration>[
|
typeArguments: <TypeDeclaration>[
|
||||||
@ -908,7 +921,7 @@ void main() {
|
|||||||
]),
|
]),
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'List',
|
baseName: 'List',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
typeArguments: <TypeDeclaration>[
|
typeArguments: <TypeDeclaration>[
|
||||||
|
@ -72,7 +72,7 @@ void main() {
|
|||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'List',
|
baseName: 'List',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
typeArguments: <TypeDeclaration>[
|
typeArguments: <TypeDeclaration>[
|
||||||
@ -83,7 +83,8 @@ void main() {
|
|||||||
offset: null,
|
offset: null,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration(baseName: 'Output', isNullable: false),
|
returnType:
|
||||||
|
const TypeDeclaration(baseName: 'Output', isNullable: false),
|
||||||
isAsynchronous: true,
|
isAsynchronous: true,
|
||||||
)
|
)
|
||||||
]);
|
]);
|
||||||
@ -110,12 +111,12 @@ void main() {
|
|||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'Output', isNullable: false),
|
type: const TypeDeclaration(baseName: 'Output', isNullable: false),
|
||||||
name: '',
|
name: '',
|
||||||
offset: null,
|
offset: null,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration(
|
returnType: const TypeDeclaration(
|
||||||
baseName: 'List',
|
baseName: 'List',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
typeArguments: <TypeDeclaration>[
|
typeArguments: <TypeDeclaration>[
|
||||||
@ -148,17 +149,17 @@ void main() {
|
|||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'Foo', isNullable: false),
|
type: const TypeDeclaration(baseName: 'Foo', isNullable: false),
|
||||||
name: '',
|
name: '',
|
||||||
offset: null,
|
offset: null,
|
||||||
),
|
),
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'Bar', isNullable: false),
|
type: const TypeDeclaration(baseName: 'Bar', isNullable: false),
|
||||||
name: '',
|
name: '',
|
||||||
offset: null,
|
offset: null,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration(
|
returnType: const TypeDeclaration(
|
||||||
baseName: 'List',
|
baseName: 'List',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
typeArguments: <TypeDeclaration>[TypeDeclaration.voidDeclaration()],
|
typeArguments: <TypeDeclaration>[TypeDeclaration.voidDeclaration()],
|
||||||
@ -190,14 +191,14 @@ void main() {
|
|||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
name: 'x',
|
name: 'x',
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
baseName: 'List',
|
baseName: 'List',
|
||||||
typeArguments: <TypeDeclaration>[
|
typeArguments: <TypeDeclaration>[
|
||||||
TypeDeclaration(baseName: 'Foo', isNullable: true)
|
TypeDeclaration(baseName: 'Foo', isNullable: true)
|
||||||
])),
|
])),
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration.voidDeclaration(),
|
returnType: const TypeDeclaration.voidDeclaration(),
|
||||||
isAsynchronous: false,
|
isAsynchronous: false,
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
@ -205,12 +206,12 @@ void main() {
|
|||||||
Class(name: 'Foo', fields: <NamedType>[
|
Class(name: 'Foo', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
name: 'bar',
|
name: 'bar',
|
||||||
type: TypeDeclaration(baseName: 'Bar', isNullable: true)),
|
type: const TypeDeclaration(baseName: 'Bar', isNullable: true)),
|
||||||
]),
|
]),
|
||||||
Class(name: 'Bar', fields: <NamedType>[
|
Class(name: 'Bar', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
name: 'value',
|
name: 'value',
|
||||||
type: TypeDeclaration(baseName: 'int', isNullable: true))
|
type: const TypeDeclaration(baseName: 'int', isNullable: true))
|
||||||
])
|
])
|
||||||
], enums: <Enum>[]);
|
], enums: <Enum>[]);
|
||||||
final List<EnumeratedClass> classes =
|
final List<EnumeratedClass> classes =
|
||||||
@ -227,4 +228,57 @@ void main() {
|
|||||||
.length,
|
.length,
|
||||||
1);
|
1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('getCodecClasses: unique entries', () {
|
||||||
|
final Root root = Root(apis: <Api>[
|
||||||
|
Api(
|
||||||
|
name: 'Api1',
|
||||||
|
location: ApiLocation.flutter,
|
||||||
|
methods: <Method>[
|
||||||
|
Method(
|
||||||
|
name: 'foo',
|
||||||
|
arguments: <NamedType>[
|
||||||
|
NamedType(
|
||||||
|
name: 'x',
|
||||||
|
type: const TypeDeclaration(
|
||||||
|
isNullable: false, baseName: 'Foo')),
|
||||||
|
],
|
||||||
|
returnType: const TypeDeclaration.voidDeclaration(),
|
||||||
|
isAsynchronous: false,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Api(
|
||||||
|
name: 'Api2',
|
||||||
|
location: ApiLocation.host,
|
||||||
|
methods: <Method>[
|
||||||
|
Method(
|
||||||
|
name: 'foo',
|
||||||
|
arguments: <NamedType>[
|
||||||
|
NamedType(
|
||||||
|
name: 'x',
|
||||||
|
type: const TypeDeclaration(
|
||||||
|
isNullable: false, baseName: 'Foo')),
|
||||||
|
],
|
||||||
|
returnType: const TypeDeclaration.voidDeclaration(),
|
||||||
|
isAsynchronous: false,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
], classes: <Class>[
|
||||||
|
Class(name: 'Foo', fields: <NamedType>[
|
||||||
|
NamedType(
|
||||||
|
name: 'bar',
|
||||||
|
type: const TypeDeclaration(baseName: 'int', isNullable: true)),
|
||||||
|
]),
|
||||||
|
], enums: <Enum>[]);
|
||||||
|
final List<EnumeratedClass> classes =
|
||||||
|
getCodecClasses(root.apis[0], root).toList();
|
||||||
|
expect(classes.length, 1);
|
||||||
|
expect(
|
||||||
|
classes
|
||||||
|
.where((EnumeratedClass element) => element.name == 'Foo')
|
||||||
|
.length,
|
||||||
|
1);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ void main() {
|
|||||||
name: 'Foobar',
|
name: 'Foobar',
|
||||||
fields: <NamedType>[
|
fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'int',
|
baseName: 'int',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -64,7 +64,7 @@ void main() {
|
|||||||
name: 'Foobar',
|
name: 'Foobar',
|
||||||
fields: <NamedType>[
|
fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'int',
|
baseName: 'int',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -93,21 +93,22 @@ void main() {
|
|||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Input',
|
baseName: 'Input',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
),
|
),
|
||||||
name: '',
|
name: '',
|
||||||
offset: null)
|
offset: null)
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration(baseName: 'Output', isNullable: false),
|
returnType:
|
||||||
|
const TypeDeclaration(baseName: 'Output', isNullable: false),
|
||||||
isAsynchronous: false,
|
isAsynchronous: false,
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Input', fields: <NamedType>[
|
Class(name: 'Input', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'String',
|
baseName: 'String',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -116,7 +117,7 @@ void main() {
|
|||||||
]),
|
]),
|
||||||
Class(name: 'Output', fields: <NamedType>[
|
Class(name: 'Output', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'String',
|
baseName: 'String',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -137,56 +138,56 @@ void main() {
|
|||||||
final Root root = Root(apis: <Api>[], classes: <Class>[
|
final Root root = Root(apis: <Api>[], classes: <Class>[
|
||||||
Class(name: 'Foobar', fields: <NamedType>[
|
Class(name: 'Foobar', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'bool',
|
baseName: 'bool',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
name: 'aBool',
|
name: 'aBool',
|
||||||
offset: null),
|
offset: null),
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'int',
|
baseName: 'int',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
name: 'aInt',
|
name: 'aInt',
|
||||||
offset: null),
|
offset: null),
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'double',
|
baseName: 'double',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
name: 'aDouble',
|
name: 'aDouble',
|
||||||
offset: null),
|
offset: null),
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'String',
|
baseName: 'String',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
name: 'aString',
|
name: 'aString',
|
||||||
offset: null),
|
offset: null),
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Uint8List',
|
baseName: 'Uint8List',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
name: 'aUint8List',
|
name: 'aUint8List',
|
||||||
offset: null),
|
offset: null),
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Int32List',
|
baseName: 'Int32List',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
name: 'aInt32List',
|
name: 'aInt32List',
|
||||||
offset: null),
|
offset: null),
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Int64List',
|
baseName: 'Int64List',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
name: 'aInt64List',
|
name: 'aInt64List',
|
||||||
offset: null),
|
offset: null),
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Float64List',
|
baseName: 'Float64List',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -216,21 +217,22 @@ void main() {
|
|||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Input',
|
baseName: 'Input',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
),
|
),
|
||||||
name: '',
|
name: '',
|
||||||
offset: null)
|
offset: null)
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration(baseName: 'Output', isNullable: false),
|
returnType:
|
||||||
|
const TypeDeclaration(baseName: 'Output', isNullable: false),
|
||||||
isAsynchronous: false,
|
isAsynchronous: false,
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Input', fields: <NamedType>[
|
Class(name: 'Input', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'String',
|
baseName: 'String',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -239,7 +241,7 @@ void main() {
|
|||||||
]),
|
]),
|
||||||
Class(name: 'Output', fields: <NamedType>[
|
Class(name: 'Output', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'String',
|
baseName: 'String',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -262,21 +264,21 @@ void main() {
|
|||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Input',
|
baseName: 'Input',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
),
|
),
|
||||||
name: '',
|
name: '',
|
||||||
offset: null)
|
offset: null)
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration.voidDeclaration(),
|
returnType: const TypeDeclaration.voidDeclaration(),
|
||||||
isAsynchronous: false,
|
isAsynchronous: false,
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Input', fields: <NamedType>[
|
Class(name: 'Input', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'String',
|
baseName: 'String',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -299,21 +301,21 @@ void main() {
|
|||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Input',
|
baseName: 'Input',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
),
|
),
|
||||||
name: '',
|
name: '',
|
||||||
offset: null)
|
offset: null)
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration.voidDeclaration(),
|
returnType: const TypeDeclaration.voidDeclaration(),
|
||||||
isAsynchronous: false,
|
isAsynchronous: false,
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Input', fields: <NamedType>[
|
Class(name: 'Input', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'String',
|
baseName: 'String',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -335,14 +337,15 @@ void main() {
|
|||||||
Method(
|
Method(
|
||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[],
|
arguments: <NamedType>[],
|
||||||
returnType: TypeDeclaration(baseName: 'Output', isNullable: false),
|
returnType:
|
||||||
|
const TypeDeclaration(baseName: 'Output', isNullable: false),
|
||||||
isAsynchronous: false,
|
isAsynchronous: false,
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Output', fields: <NamedType>[
|
Class(name: 'Output', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'String',
|
baseName: 'String',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -364,14 +367,15 @@ void main() {
|
|||||||
Method(
|
Method(
|
||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[],
|
arguments: <NamedType>[],
|
||||||
returnType: TypeDeclaration(baseName: 'Output', isNullable: false),
|
returnType:
|
||||||
|
const TypeDeclaration(baseName: 'Output', isNullable: false),
|
||||||
isAsynchronous: false,
|
isAsynchronous: false,
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Output', fields: <NamedType>[
|
Class(name: 'Output', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'String',
|
baseName: 'String',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -391,7 +395,7 @@ void main() {
|
|||||||
final Root root = Root(apis: <Api>[], classes: <Class>[
|
final Root root = Root(apis: <Api>[], classes: <Class>[
|
||||||
Class(name: 'Foobar', fields: <NamedType>[
|
Class(name: 'Foobar', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'List',
|
baseName: 'List',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -411,7 +415,7 @@ void main() {
|
|||||||
final Root root = Root(apis: <Api>[], classes: <Class>[
|
final Root root = Root(apis: <Api>[], classes: <Class>[
|
||||||
Class(name: 'Foobar', fields: <NamedType>[
|
Class(name: 'Foobar', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Map',
|
baseName: 'Map',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -432,7 +436,7 @@ void main() {
|
|||||||
name: 'Outer',
|
name: 'Outer',
|
||||||
fields: <NamedType>[
|
fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Nested',
|
baseName: 'Nested',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -444,7 +448,7 @@ void main() {
|
|||||||
name: 'Nested',
|
name: 'Nested',
|
||||||
fields: <NamedType>[
|
fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'int',
|
baseName: 'int',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -477,21 +481,22 @@ void main() {
|
|||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Input',
|
baseName: 'Input',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
),
|
),
|
||||||
name: 'arg',
|
name: 'arg',
|
||||||
offset: null)
|
offset: null)
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration(baseName: 'Output', isNullable: false),
|
returnType:
|
||||||
|
const TypeDeclaration(baseName: 'Output', isNullable: false),
|
||||||
isAsynchronous: true,
|
isAsynchronous: true,
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Input', fields: <NamedType>[
|
Class(name: 'Input', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'String',
|
baseName: 'String',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -500,7 +505,7 @@ void main() {
|
|||||||
]),
|
]),
|
||||||
Class(name: 'Output', fields: <NamedType>[
|
Class(name: 'Output', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'String',
|
baseName: 'String',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -528,21 +533,22 @@ void main() {
|
|||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Input',
|
baseName: 'Input',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
),
|
),
|
||||||
name: '',
|
name: '',
|
||||||
offset: null)
|
offset: null)
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration(baseName: 'Output', isNullable: false),
|
returnType:
|
||||||
|
const TypeDeclaration(baseName: 'Output', isNullable: false),
|
||||||
isAsynchronous: true,
|
isAsynchronous: true,
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Input', fields: <NamedType>[
|
Class(name: 'Input', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'String',
|
baseName: 'String',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -551,7 +557,7 @@ void main() {
|
|||||||
]),
|
]),
|
||||||
Class(name: 'Output', fields: <NamedType>[
|
Class(name: 'Output', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'String',
|
baseName: 'String',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -579,7 +585,7 @@ void main() {
|
|||||||
name: 'EnumClass',
|
name: 'EnumClass',
|
||||||
fields: <NamedType>[
|
fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Enum1',
|
baseName: 'Enum1',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
),
|
),
|
||||||
@ -628,7 +634,7 @@ void main() {
|
|||||||
name: 'Foobar',
|
name: 'Foobar',
|
||||||
fields: <NamedType>[
|
fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'List',
|
baseName: 'List',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
typeArguments: <TypeDeclaration>[
|
typeArguments: <TypeDeclaration>[
|
||||||
@ -656,7 +662,7 @@ void main() {
|
|||||||
name: 'Foobar',
|
name: 'Foobar',
|
||||||
fields: <NamedType>[
|
fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Map',
|
baseName: 'Map',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
typeArguments: <TypeDeclaration>[
|
typeArguments: <TypeDeclaration>[
|
||||||
@ -686,10 +692,10 @@ void main() {
|
|||||||
Api(name: 'Api', location: ApiLocation.host, methods: <Method>[
|
Api(name: 'Api', location: ApiLocation.host, methods: <Method>[
|
||||||
Method(
|
Method(
|
||||||
name: 'doit',
|
name: 'doit',
|
||||||
returnType: TypeDeclaration.voidDeclaration(),
|
returnType: const TypeDeclaration.voidDeclaration(),
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'List',
|
baseName: 'List',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
typeArguments: <TypeDeclaration>[
|
typeArguments: <TypeDeclaration>[
|
||||||
@ -716,10 +722,10 @@ void main() {
|
|||||||
Api(name: 'Api', location: ApiLocation.flutter, methods: <Method>[
|
Api(name: 'Api', location: ApiLocation.flutter, methods: <Method>[
|
||||||
Method(
|
Method(
|
||||||
name: 'doit',
|
name: 'doit',
|
||||||
returnType: TypeDeclaration.voidDeclaration(),
|
returnType: const TypeDeclaration.voidDeclaration(),
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'List',
|
baseName: 'List',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
typeArguments: <TypeDeclaration>[
|
typeArguments: <TypeDeclaration>[
|
||||||
@ -746,7 +752,7 @@ void main() {
|
|||||||
Api(name: 'Api', location: ApiLocation.host, methods: <Method>[
|
Api(name: 'Api', location: ApiLocation.host, methods: <Method>[
|
||||||
Method(
|
Method(
|
||||||
name: 'doit',
|
name: 'doit',
|
||||||
returnType: TypeDeclaration(
|
returnType: const TypeDeclaration(
|
||||||
baseName: 'List',
|
baseName: 'List',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
typeArguments: <TypeDeclaration>[
|
typeArguments: <TypeDeclaration>[
|
||||||
@ -772,7 +778,7 @@ void main() {
|
|||||||
Api(name: 'Api', location: ApiLocation.flutter, methods: <Method>[
|
Api(name: 'Api', location: ApiLocation.flutter, methods: <Method>[
|
||||||
Method(
|
Method(
|
||||||
name: 'doit',
|
name: 'doit',
|
||||||
returnType: TypeDeclaration(
|
returnType: const TypeDeclaration(
|
||||||
baseName: 'List',
|
baseName: 'List',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
typeArguments: <TypeDeclaration>[
|
typeArguments: <TypeDeclaration>[
|
||||||
@ -800,12 +806,14 @@ void main() {
|
|||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
name: 'x',
|
name: 'x',
|
||||||
type: TypeDeclaration(isNullable: false, baseName: 'int')),
|
type:
|
||||||
|
const TypeDeclaration(isNullable: false, baseName: 'int')),
|
||||||
NamedType(
|
NamedType(
|
||||||
name: 'y',
|
name: 'y',
|
||||||
type: TypeDeclaration(isNullable: false, baseName: 'int')),
|
type:
|
||||||
|
const TypeDeclaration(isNullable: false, baseName: 'int')),
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration(baseName: 'int', isNullable: false),
|
returnType: const TypeDeclaration(baseName: 'int', isNullable: false),
|
||||||
isAsynchronous: false,
|
isAsynchronous: false,
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
@ -832,12 +840,14 @@ void main() {
|
|||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
name: 'x',
|
name: 'x',
|
||||||
type: TypeDeclaration(isNullable: false, baseName: 'int')),
|
type:
|
||||||
|
const TypeDeclaration(isNullable: false, baseName: 'int')),
|
||||||
NamedType(
|
NamedType(
|
||||||
name: 'y',
|
name: 'y',
|
||||||
type: TypeDeclaration(isNullable: false, baseName: 'int')),
|
type:
|
||||||
|
const TypeDeclaration(isNullable: false, baseName: 'int')),
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration(baseName: 'int', isNullable: false),
|
returnType: const TypeDeclaration(baseName: 'int', isNullable: false),
|
||||||
isAsynchronous: false,
|
isAsynchronous: false,
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
|
@ -11,7 +11,7 @@ void main() {
|
|||||||
final Root root = Root(apis: <Api>[], classes: <Class>[
|
final Root root = Root(apis: <Api>[], classes: <Class>[
|
||||||
Class(name: 'Foobar', fields: <NamedType>[
|
Class(name: 'Foobar', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type: const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'field1',
|
name: 'field1',
|
||||||
offset: null)
|
offset: null)
|
||||||
]),
|
]),
|
||||||
@ -27,7 +27,7 @@ void main() {
|
|||||||
final Root root = Root(apis: <Api>[], classes: <Class>[
|
final Root root = Root(apis: <Api>[], classes: <Class>[
|
||||||
Class(name: 'Foobar', fields: <NamedType>[
|
Class(name: 'Foobar', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type: const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'field1',
|
name: 'field1',
|
||||||
offset: null)
|
offset: null)
|
||||||
]),
|
]),
|
||||||
@ -83,11 +83,13 @@ void main() {
|
|||||||
name: 'Foobar',
|
name: 'Foobar',
|
||||||
fields: <NamedType>[
|
fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type:
|
||||||
|
const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'field1',
|
name: 'field1',
|
||||||
offset: null),
|
offset: null),
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'Enum1', isNullable: true),
|
type:
|
||||||
|
const TypeDeclaration(baseName: 'Enum1', isNullable: true),
|
||||||
name: 'enum1',
|
name: 'enum1',
|
||||||
offset: null),
|
offset: null),
|
||||||
],
|
],
|
||||||
@ -119,11 +121,13 @@ void main() {
|
|||||||
name: 'Foobar',
|
name: 'Foobar',
|
||||||
fields: <NamedType>[
|
fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type:
|
||||||
|
const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'field1',
|
name: 'field1',
|
||||||
offset: null),
|
offset: null),
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'Enum1', isNullable: true),
|
type:
|
||||||
|
const TypeDeclaration(baseName: 'Enum1', isNullable: true),
|
||||||
name: 'enum1',
|
name: 'enum1',
|
||||||
offset: null),
|
offset: null),
|
||||||
],
|
],
|
||||||
@ -152,22 +156,24 @@ void main() {
|
|||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'Input', isNullable: false),
|
type: const TypeDeclaration(
|
||||||
|
baseName: 'Input', isNullable: false),
|
||||||
name: '',
|
name: '',
|
||||||
offset: null)
|
offset: null)
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration(baseName: 'Output', isNullable: false))
|
returnType:
|
||||||
|
const TypeDeclaration(baseName: 'Output', isNullable: false))
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Input', fields: <NamedType>[
|
Class(name: 'Input', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type: const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'input',
|
name: 'input',
|
||||||
offset: null)
|
offset: null)
|
||||||
]),
|
]),
|
||||||
Class(name: 'Output', fields: <NamedType>[
|
Class(name: 'Output', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type: const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'output',
|
name: 'output',
|
||||||
offset: null)
|
offset: null)
|
||||||
])
|
])
|
||||||
@ -189,25 +195,26 @@ void main() {
|
|||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Input',
|
baseName: 'Input',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
),
|
),
|
||||||
name: '',
|
name: '',
|
||||||
offset: null)
|
offset: null)
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration(baseName: 'Output', isNullable: false))
|
returnType:
|
||||||
|
const TypeDeclaration(baseName: 'Output', isNullable: false))
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Input', fields: <NamedType>[
|
Class(name: 'Input', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type: const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'input',
|
name: 'input',
|
||||||
offset: null)
|
offset: null)
|
||||||
]),
|
]),
|
||||||
Class(name: 'Output', fields: <NamedType>[
|
Class(name: 'Output', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type: const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'output',
|
name: 'output',
|
||||||
offset: null)
|
offset: null)
|
||||||
])
|
])
|
||||||
@ -229,35 +236,39 @@ void main() {
|
|||||||
final Root root = Root(apis: <Api>[], classes: <Class>[
|
final Root root = Root(apis: <Api>[], classes: <Class>[
|
||||||
Class(name: 'Foobar', fields: <NamedType>[
|
Class(name: 'Foobar', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'bool', isNullable: true),
|
type: const TypeDeclaration(baseName: 'bool', isNullable: true),
|
||||||
name: 'aBool',
|
name: 'aBool',
|
||||||
offset: null),
|
offset: null),
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'int', isNullable: true),
|
type: const TypeDeclaration(baseName: 'int', isNullable: true),
|
||||||
name: 'aInt',
|
name: 'aInt',
|
||||||
offset: null),
|
offset: null),
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'double', isNullable: true),
|
type: const TypeDeclaration(baseName: 'double', isNullable: true),
|
||||||
name: 'aDouble',
|
name: 'aDouble',
|
||||||
offset: null),
|
offset: null),
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type: const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'aString',
|
name: 'aString',
|
||||||
offset: null),
|
offset: null),
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'Uint8List', isNullable: true),
|
type:
|
||||||
|
const TypeDeclaration(baseName: 'Uint8List', isNullable: true),
|
||||||
name: 'aUint8List',
|
name: 'aUint8List',
|
||||||
offset: null),
|
offset: null),
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'Int32List', isNullable: true),
|
type:
|
||||||
|
const TypeDeclaration(baseName: 'Int32List', isNullable: true),
|
||||||
name: 'aInt32List',
|
name: 'aInt32List',
|
||||||
offset: null),
|
offset: null),
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'Int64List', isNullable: true),
|
type:
|
||||||
|
const TypeDeclaration(baseName: 'Int64List', isNullable: true),
|
||||||
name: 'aInt64List',
|
name: 'aInt64List',
|
||||||
offset: null),
|
offset: null),
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'Float64List', isNullable: true),
|
type: const TypeDeclaration(
|
||||||
|
baseName: 'Float64List', isNullable: true),
|
||||||
name: 'aFloat64List',
|
name: 'aFloat64List',
|
||||||
offset: null),
|
offset: null),
|
||||||
]),
|
]),
|
||||||
@ -286,7 +297,7 @@ void main() {
|
|||||||
final Root root = Root(apis: <Api>[], classes: <Class>[
|
final Root root = Root(apis: <Api>[], classes: <Class>[
|
||||||
Class(name: 'Foobar', fields: <NamedType>[
|
Class(name: 'Foobar', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'bool', isNullable: true),
|
type: const TypeDeclaration(baseName: 'bool', isNullable: true),
|
||||||
name: 'aBool',
|
name: 'aBool',
|
||||||
offset: null),
|
offset: null),
|
||||||
]),
|
]),
|
||||||
@ -303,13 +314,13 @@ void main() {
|
|||||||
final Root root = Root(apis: <Api>[], classes: <Class>[
|
final Root root = Root(apis: <Api>[], classes: <Class>[
|
||||||
Class(name: 'Input', fields: <NamedType>[
|
Class(name: 'Input', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type: const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'input',
|
name: 'input',
|
||||||
offset: null)
|
offset: null)
|
||||||
]),
|
]),
|
||||||
Class(name: 'Nested', fields: <NamedType>[
|
Class(name: 'Nested', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'Input', isNullable: true),
|
type: const TypeDeclaration(baseName: 'Input', isNullable: true),
|
||||||
name: 'nested',
|
name: 'nested',
|
||||||
offset: null)
|
offset: null)
|
||||||
])
|
])
|
||||||
@ -325,13 +336,13 @@ void main() {
|
|||||||
final Root root = Root(apis: <Api>[], classes: <Class>[
|
final Root root = Root(apis: <Api>[], classes: <Class>[
|
||||||
Class(name: 'Input', fields: <NamedType>[
|
Class(name: 'Input', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type: const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'input',
|
name: 'input',
|
||||||
offset: null)
|
offset: null)
|
||||||
]),
|
]),
|
||||||
Class(name: 'Nested', fields: <NamedType>[
|
Class(name: 'Nested', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'Input', isNullable: true),
|
type: const TypeDeclaration(baseName: 'Input', isNullable: true),
|
||||||
name: 'nested',
|
name: 'nested',
|
||||||
offset: null)
|
offset: null)
|
||||||
])
|
])
|
||||||
@ -347,7 +358,7 @@ void main() {
|
|||||||
final Root root = Root(apis: <Api>[], classes: <Class>[
|
final Root root = Root(apis: <Api>[], classes: <Class>[
|
||||||
Class(name: 'Foobar', fields: <NamedType>[
|
Class(name: 'Foobar', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type: const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'field1',
|
name: 'field1',
|
||||||
offset: null)
|
offset: null)
|
||||||
]),
|
]),
|
||||||
@ -362,7 +373,7 @@ void main() {
|
|||||||
final Root root = Root(apis: <Api>[], classes: <Class>[
|
final Root root = Root(apis: <Api>[], classes: <Class>[
|
||||||
Class(name: 'Foobar', fields: <NamedType>[
|
Class(name: 'Foobar', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type: const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'field1',
|
name: 'field1',
|
||||||
offset: null)
|
offset: null)
|
||||||
]),
|
]),
|
||||||
@ -380,25 +391,26 @@ void main() {
|
|||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Input',
|
baseName: 'Input',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
),
|
),
|
||||||
name: '',
|
name: '',
|
||||||
offset: null)
|
offset: null)
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration(baseName: 'Nested', isNullable: false))
|
returnType:
|
||||||
|
const TypeDeclaration(baseName: 'Nested', isNullable: false))
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Input', fields: <NamedType>[
|
Class(name: 'Input', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type: const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'input',
|
name: 'input',
|
||||||
offset: null)
|
offset: null)
|
||||||
]),
|
]),
|
||||||
Class(name: 'Nested', fields: <NamedType>[
|
Class(name: 'Nested', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'Input', isNullable: true),
|
type: const TypeDeclaration(baseName: 'Input', isNullable: true),
|
||||||
name: 'nested',
|
name: 'nested',
|
||||||
offset: null)
|
offset: null)
|
||||||
])
|
])
|
||||||
@ -418,25 +430,26 @@ void main() {
|
|||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Input',
|
baseName: 'Input',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
),
|
),
|
||||||
name: '',
|
name: '',
|
||||||
offset: null)
|
offset: null)
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration(baseName: 'Nested', isNullable: false))
|
returnType:
|
||||||
|
const TypeDeclaration(baseName: 'Nested', isNullable: false))
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Input', fields: <NamedType>[
|
Class(name: 'Input', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type: const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'input',
|
name: 'input',
|
||||||
offset: null)
|
offset: null)
|
||||||
]),
|
]),
|
||||||
Class(name: 'Nested', fields: <NamedType>[
|
Class(name: 'Nested', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'Input', isNullable: true),
|
type: const TypeDeclaration(baseName: 'Input', isNullable: true),
|
||||||
name: 'nested',
|
name: 'nested',
|
||||||
offset: null)
|
offset: null)
|
||||||
])
|
])
|
||||||
@ -456,25 +469,26 @@ void main() {
|
|||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Input',
|
baseName: 'Input',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
),
|
),
|
||||||
name: '',
|
name: '',
|
||||||
offset: null)
|
offset: null)
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration(baseName: 'Output', isNullable: false))
|
returnType:
|
||||||
|
const TypeDeclaration(baseName: 'Output', isNullable: false))
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Input', fields: <NamedType>[
|
Class(name: 'Input', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type: const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'input',
|
name: 'input',
|
||||||
offset: null)
|
offset: null)
|
||||||
]),
|
]),
|
||||||
Class(name: 'Output', fields: <NamedType>[
|
Class(name: 'Output', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type: const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'output',
|
name: 'output',
|
||||||
offset: null)
|
offset: null)
|
||||||
])
|
])
|
||||||
@ -497,25 +511,26 @@ void main() {
|
|||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Input',
|
baseName: 'Input',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
),
|
),
|
||||||
name: '',
|
name: '',
|
||||||
offset: null)
|
offset: null)
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration(baseName: 'Output', isNullable: false))
|
returnType:
|
||||||
|
const TypeDeclaration(baseName: 'Output', isNullable: false))
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Input', fields: <NamedType>[
|
Class(name: 'Input', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type: const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'input',
|
name: 'input',
|
||||||
offset: null)
|
offset: null)
|
||||||
]),
|
]),
|
||||||
Class(name: 'Output', fields: <NamedType>[
|
Class(name: 'Output', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type: const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'output',
|
name: 'output',
|
||||||
offset: null)
|
offset: null)
|
||||||
])
|
])
|
||||||
@ -534,19 +549,19 @@ void main() {
|
|||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Input',
|
baseName: 'Input',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
),
|
),
|
||||||
name: '',
|
name: '',
|
||||||
offset: null)
|
offset: null)
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration.voidDeclaration())
|
returnType: const TypeDeclaration.voidDeclaration())
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Input', fields: <NamedType>[
|
Class(name: 'Input', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type: const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'input',
|
name: 'input',
|
||||||
offset: null)
|
offset: null)
|
||||||
]),
|
]),
|
||||||
@ -565,19 +580,19 @@ void main() {
|
|||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Input',
|
baseName: 'Input',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
),
|
),
|
||||||
name: '',
|
name: '',
|
||||||
offset: null)
|
offset: null)
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration.voidDeclaration())
|
returnType: const TypeDeclaration.voidDeclaration())
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Input', fields: <NamedType>[
|
Class(name: 'Input', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type: const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'input',
|
name: 'input',
|
||||||
offset: null)
|
offset: null)
|
||||||
]),
|
]),
|
||||||
@ -598,19 +613,19 @@ void main() {
|
|||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Input',
|
baseName: 'Input',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
),
|
),
|
||||||
name: '',
|
name: '',
|
||||||
offset: null)
|
offset: null)
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration.voidDeclaration())
|
returnType: const TypeDeclaration.voidDeclaration())
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Input', fields: <NamedType>[
|
Class(name: 'Input', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type: const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'input',
|
name: 'input',
|
||||||
offset: null)
|
offset: null)
|
||||||
]),
|
]),
|
||||||
@ -629,19 +644,19 @@ void main() {
|
|||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Input',
|
baseName: 'Input',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
),
|
),
|
||||||
name: '',
|
name: '',
|
||||||
offset: null)
|
offset: null)
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration.voidDeclaration())
|
returnType: const TypeDeclaration.voidDeclaration())
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Input', fields: <NamedType>[
|
Class(name: 'Input', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type: const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'input',
|
name: 'input',
|
||||||
offset: null)
|
offset: null)
|
||||||
]),
|
]),
|
||||||
@ -660,12 +675,13 @@ void main() {
|
|||||||
Method(
|
Method(
|
||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[],
|
arguments: <NamedType>[],
|
||||||
returnType: TypeDeclaration(baseName: 'Output', isNullable: false))
|
returnType:
|
||||||
|
const TypeDeclaration(baseName: 'Output', isNullable: false))
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Output', fields: <NamedType>[
|
Class(name: 'Output', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type: const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'output',
|
name: 'output',
|
||||||
offset: null)
|
offset: null)
|
||||||
]),
|
]),
|
||||||
@ -683,12 +699,13 @@ void main() {
|
|||||||
Method(
|
Method(
|
||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[],
|
arguments: <NamedType>[],
|
||||||
returnType: TypeDeclaration(baseName: 'Output', isNullable: false))
|
returnType:
|
||||||
|
const TypeDeclaration(baseName: 'Output', isNullable: false))
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Output', fields: <NamedType>[
|
Class(name: 'Output', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type: const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'output',
|
name: 'output',
|
||||||
offset: null)
|
offset: null)
|
||||||
]),
|
]),
|
||||||
@ -706,12 +723,13 @@ void main() {
|
|||||||
Method(
|
Method(
|
||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[],
|
arguments: <NamedType>[],
|
||||||
returnType: TypeDeclaration(baseName: 'Output', isNullable: false))
|
returnType:
|
||||||
|
const TypeDeclaration(baseName: 'Output', isNullable: false))
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Output', fields: <NamedType>[
|
Class(name: 'Output', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type: const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'output',
|
name: 'output',
|
||||||
offset: null)
|
offset: null)
|
||||||
]),
|
]),
|
||||||
@ -732,12 +750,13 @@ void main() {
|
|||||||
Method(
|
Method(
|
||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[],
|
arguments: <NamedType>[],
|
||||||
returnType: TypeDeclaration(baseName: 'Output', isNullable: false))
|
returnType:
|
||||||
|
const TypeDeclaration(baseName: 'Output', isNullable: false))
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Output', fields: <NamedType>[
|
Class(name: 'Output', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type: const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'output',
|
name: 'output',
|
||||||
offset: null)
|
offset: null)
|
||||||
]),
|
]),
|
||||||
@ -757,7 +776,7 @@ void main() {
|
|||||||
final Root root = Root(apis: <Api>[], classes: <Class>[
|
final Root root = Root(apis: <Api>[], classes: <Class>[
|
||||||
Class(name: 'Foobar', fields: <NamedType>[
|
Class(name: 'Foobar', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'List', isNullable: true),
|
type: const TypeDeclaration(baseName: 'List', isNullable: true),
|
||||||
name: 'field1',
|
name: 'field1',
|
||||||
offset: null)
|
offset: null)
|
||||||
]),
|
]),
|
||||||
@ -773,7 +792,7 @@ void main() {
|
|||||||
final Root root = Root(apis: <Api>[], classes: <Class>[
|
final Root root = Root(apis: <Api>[], classes: <Class>[
|
||||||
Class(name: 'Foobar', fields: <NamedType>[
|
Class(name: 'Foobar', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'Map', isNullable: true),
|
type: const TypeDeclaration(baseName: 'Map', isNullable: true),
|
||||||
name: 'field1',
|
name: 'field1',
|
||||||
offset: null)
|
offset: null)
|
||||||
]),
|
]),
|
||||||
@ -785,6 +804,56 @@ void main() {
|
|||||||
expect(code, matches('@property.*NSDictionary.*field1'));
|
expect(code, matches('@property.*NSDictionary.*field1'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('gen map field with object', () {
|
||||||
|
final Root root = Root(apis: <Api>[], classes: <Class>[
|
||||||
|
Class(name: 'Foobar', fields: <NamedType>[
|
||||||
|
NamedType(
|
||||||
|
type: const TypeDeclaration(
|
||||||
|
baseName: 'Map',
|
||||||
|
isNullable: true,
|
||||||
|
typeArguments: <TypeDeclaration>[
|
||||||
|
TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
|
TypeDeclaration(baseName: 'Object', isNullable: true),
|
||||||
|
]),
|
||||||
|
name: 'field1',
|
||||||
|
offset: null)
|
||||||
|
]),
|
||||||
|
], enums: <Enum>[]);
|
||||||
|
final StringBuffer sink = StringBuffer();
|
||||||
|
generateObjcHeader(const ObjcOptions(), root, sink);
|
||||||
|
final String code = sink.toString();
|
||||||
|
expect(code, contains('@interface Foobar'));
|
||||||
|
expect(
|
||||||
|
code,
|
||||||
|
contains(
|
||||||
|
'@property(nonatomic, strong, nullable) NSDictionary<NSString *, id> *'));
|
||||||
|
});
|
||||||
|
|
||||||
|
test('gen map argument with object', () {
|
||||||
|
final Root root = Root(apis: <Api>[
|
||||||
|
Api(name: 'Api', location: ApiLocation.host, methods: <Method>[
|
||||||
|
Method(
|
||||||
|
name: 'doit',
|
||||||
|
returnType: const TypeDeclaration.voidDeclaration(),
|
||||||
|
arguments: <NamedType>[
|
||||||
|
NamedType(
|
||||||
|
name: 'foo',
|
||||||
|
type: const TypeDeclaration(
|
||||||
|
baseName: 'Map',
|
||||||
|
isNullable: true,
|
||||||
|
typeArguments: <TypeDeclaration>[
|
||||||
|
TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
|
TypeDeclaration(baseName: 'Object', isNullable: true),
|
||||||
|
]))
|
||||||
|
]),
|
||||||
|
])
|
||||||
|
], classes: <Class>[], enums: <Enum>[]);
|
||||||
|
final StringBuffer sink = StringBuffer();
|
||||||
|
generateObjcHeader(const ObjcOptions(), root, sink);
|
||||||
|
final String code = sink.toString();
|
||||||
|
expect(code, contains('(NSDictionary<NSString *, id> *)foo'));
|
||||||
|
});
|
||||||
|
|
||||||
test('async void(input) HostApi header', () {
|
test('async void(input) HostApi header', () {
|
||||||
final Root root = Root(apis: <Api>[
|
final Root root = Root(apis: <Api>[
|
||||||
Api(name: 'Api', location: ApiLocation.host, methods: <Method>[
|
Api(name: 'Api', location: ApiLocation.host, methods: <Method>[
|
||||||
@ -792,26 +861,26 @@ void main() {
|
|||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Input',
|
baseName: 'Input',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
),
|
),
|
||||||
name: 'input',
|
name: 'input',
|
||||||
offset: null)
|
offset: null)
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration.voidDeclaration(),
|
returnType: const TypeDeclaration.voidDeclaration(),
|
||||||
isAsynchronous: true)
|
isAsynchronous: true)
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Input', fields: <NamedType>[
|
Class(name: 'Input', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type: const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'input',
|
name: 'input',
|
||||||
offset: null)
|
offset: null)
|
||||||
]),
|
]),
|
||||||
Class(name: 'Output', fields: <NamedType>[
|
Class(name: 'Output', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type: const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'output',
|
name: 'output',
|
||||||
offset: null)
|
offset: null)
|
||||||
]),
|
]),
|
||||||
@ -833,26 +902,27 @@ void main() {
|
|||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Input',
|
baseName: 'Input',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
),
|
),
|
||||||
name: 'input',
|
name: 'input',
|
||||||
offset: null)
|
offset: null)
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration(baseName: 'Output', isNullable: false),
|
returnType:
|
||||||
|
const TypeDeclaration(baseName: 'Output', isNullable: false),
|
||||||
isAsynchronous: true)
|
isAsynchronous: true)
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Input', fields: <NamedType>[
|
Class(name: 'Input', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type: const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'input',
|
name: 'input',
|
||||||
offset: null)
|
offset: null)
|
||||||
]),
|
]),
|
||||||
Class(name: 'Output', fields: <NamedType>[
|
Class(name: 'Output', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type: const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'output',
|
name: 'output',
|
||||||
offset: null)
|
offset: null)
|
||||||
]),
|
]),
|
||||||
@ -873,13 +943,14 @@ void main() {
|
|||||||
Method(
|
Method(
|
||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[],
|
arguments: <NamedType>[],
|
||||||
returnType: TypeDeclaration(baseName: 'Output', isNullable: false),
|
returnType:
|
||||||
|
const TypeDeclaration(baseName: 'Output', isNullable: false),
|
||||||
isAsynchronous: true)
|
isAsynchronous: true)
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Output', fields: <NamedType>[
|
Class(name: 'Output', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type: const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'output',
|
name: 'output',
|
||||||
offset: null)
|
offset: null)
|
||||||
]),
|
]),
|
||||||
@ -900,7 +971,7 @@ void main() {
|
|||||||
Method(
|
Method(
|
||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[],
|
arguments: <NamedType>[],
|
||||||
returnType: TypeDeclaration.voidDeclaration(),
|
returnType: const TypeDeclaration.voidDeclaration(),
|
||||||
isAsynchronous: true)
|
isAsynchronous: true)
|
||||||
])
|
])
|
||||||
], classes: <Class>[], enums: <Enum>[]);
|
], classes: <Class>[], enums: <Enum>[]);
|
||||||
@ -921,26 +992,27 @@ void main() {
|
|||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Input',
|
baseName: 'Input',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
),
|
),
|
||||||
name: '',
|
name: '',
|
||||||
offset: null)
|
offset: null)
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration(baseName: 'Output', isNullable: false),
|
returnType:
|
||||||
|
const TypeDeclaration(baseName: 'Output', isNullable: false),
|
||||||
isAsynchronous: true)
|
isAsynchronous: true)
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Input', fields: <NamedType>[
|
Class(name: 'Input', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type: const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'input',
|
name: 'input',
|
||||||
offset: null)
|
offset: null)
|
||||||
]),
|
]),
|
||||||
Class(name: 'Output', fields: <NamedType>[
|
Class(name: 'Output', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type: const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'output',
|
name: 'output',
|
||||||
offset: null)
|
offset: null)
|
||||||
]),
|
]),
|
||||||
@ -962,26 +1034,26 @@ void main() {
|
|||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'Input',
|
baseName: 'Input',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
),
|
),
|
||||||
name: 'foo',
|
name: 'foo',
|
||||||
offset: null)
|
offset: null)
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration.voidDeclaration(),
|
returnType: const TypeDeclaration.voidDeclaration(),
|
||||||
isAsynchronous: true)
|
isAsynchronous: true)
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Input', fields: <NamedType>[
|
Class(name: 'Input', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type: const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'input',
|
name: 'input',
|
||||||
offset: null)
|
offset: null)
|
||||||
]),
|
]),
|
||||||
Class(name: 'Output', fields: <NamedType>[
|
Class(name: 'Output', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type: const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'output',
|
name: 'output',
|
||||||
offset: null)
|
offset: null)
|
||||||
]),
|
]),
|
||||||
@ -1002,7 +1074,7 @@ void main() {
|
|||||||
Method(
|
Method(
|
||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[],
|
arguments: <NamedType>[],
|
||||||
returnType: TypeDeclaration.voidDeclaration(),
|
returnType: const TypeDeclaration.voidDeclaration(),
|
||||||
isAsynchronous: true)
|
isAsynchronous: true)
|
||||||
])
|
])
|
||||||
], classes: <Class>[], enums: <Enum>[]);
|
], classes: <Class>[], enums: <Enum>[]);
|
||||||
@ -1022,13 +1094,14 @@ void main() {
|
|||||||
Method(
|
Method(
|
||||||
name: 'doSomething',
|
name: 'doSomething',
|
||||||
arguments: <NamedType>[],
|
arguments: <NamedType>[],
|
||||||
returnType: TypeDeclaration(baseName: 'Output', isNullable: false),
|
returnType:
|
||||||
|
const TypeDeclaration(baseName: 'Output', isNullable: false),
|
||||||
isAsynchronous: true)
|
isAsynchronous: true)
|
||||||
])
|
])
|
||||||
], classes: <Class>[
|
], classes: <Class>[
|
||||||
Class(name: 'Output', fields: <NamedType>[
|
Class(name: 'Output', fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'String', isNullable: true),
|
type: const TypeDeclaration(baseName: 'String', isNullable: true),
|
||||||
name: 'output',
|
name: 'output',
|
||||||
offset: null)
|
offset: null)
|
||||||
]),
|
]),
|
||||||
@ -1082,7 +1155,7 @@ void main() {
|
|||||||
name: 'Foobar',
|
name: 'Foobar',
|
||||||
fields: <NamedType>[
|
fields: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'List',
|
baseName: 'List',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
typeArguments: <TypeDeclaration>[
|
typeArguments: <TypeDeclaration>[
|
||||||
@ -1110,10 +1183,10 @@ void main() {
|
|||||||
Api(name: 'Api', location: ApiLocation.host, methods: <Method>[
|
Api(name: 'Api', location: ApiLocation.host, methods: <Method>[
|
||||||
Method(
|
Method(
|
||||||
name: 'doit',
|
name: 'doit',
|
||||||
returnType: TypeDeclaration.voidDeclaration(),
|
returnType: const TypeDeclaration.voidDeclaration(),
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'List',
|
baseName: 'List',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
typeArguments: <TypeDeclaration>[
|
typeArguments: <TypeDeclaration>[
|
||||||
@ -1149,10 +1222,10 @@ void main() {
|
|||||||
Api(name: 'Api', location: ApiLocation.flutter, methods: <Method>[
|
Api(name: 'Api', location: ApiLocation.flutter, methods: <Method>[
|
||||||
Method(
|
Method(
|
||||||
name: 'doit',
|
name: 'doit',
|
||||||
returnType: TypeDeclaration.voidDeclaration(),
|
returnType: const TypeDeclaration.voidDeclaration(),
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'List',
|
baseName: 'List',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
typeArguments: <TypeDeclaration>[
|
typeArguments: <TypeDeclaration>[
|
||||||
@ -1188,10 +1261,10 @@ void main() {
|
|||||||
Api(name: 'Api', location: ApiLocation.host, methods: <Method>[
|
Api(name: 'Api', location: ApiLocation.host, methods: <Method>[
|
||||||
Method(
|
Method(
|
||||||
name: 'doit',
|
name: 'doit',
|
||||||
returnType: TypeDeclaration.voidDeclaration(),
|
returnType: const TypeDeclaration.voidDeclaration(),
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(
|
type: const TypeDeclaration(
|
||||||
baseName: 'List',
|
baseName: 'List',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
typeArguments: <TypeDeclaration>[
|
typeArguments: <TypeDeclaration>[
|
||||||
@ -1226,7 +1299,7 @@ void main() {
|
|||||||
Api(name: 'Api', location: ApiLocation.host, methods: <Method>[
|
Api(name: 'Api', location: ApiLocation.host, methods: <Method>[
|
||||||
Method(
|
Method(
|
||||||
name: 'doit',
|
name: 'doit',
|
||||||
returnType: TypeDeclaration(
|
returnType: const TypeDeclaration(
|
||||||
baseName: 'List',
|
baseName: 'List',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
typeArguments: <TypeDeclaration>[
|
typeArguments: <TypeDeclaration>[
|
||||||
@ -1261,7 +1334,7 @@ void main() {
|
|||||||
Api(name: 'Api', location: ApiLocation.flutter, methods: <Method>[
|
Api(name: 'Api', location: ApiLocation.flutter, methods: <Method>[
|
||||||
Method(
|
Method(
|
||||||
name: 'doit',
|
name: 'doit',
|
||||||
returnType: TypeDeclaration(
|
returnType: const TypeDeclaration(
|
||||||
baseName: 'List',
|
baseName: 'List',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
typeArguments: <TypeDeclaration>[
|
typeArguments: <TypeDeclaration>[
|
||||||
@ -1299,12 +1372,14 @@ void main() {
|
|||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
name: 'x',
|
name: 'x',
|
||||||
type: TypeDeclaration(isNullable: false, baseName: 'int')),
|
type:
|
||||||
|
const TypeDeclaration(isNullable: false, baseName: 'int')),
|
||||||
NamedType(
|
NamedType(
|
||||||
name: 'y',
|
name: 'y',
|
||||||
type: TypeDeclaration(isNullable: false, baseName: 'int')),
|
type:
|
||||||
|
const TypeDeclaration(isNullable: false, baseName: 'int')),
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration(baseName: 'int', isNullable: false),
|
returnType: const TypeDeclaration(baseName: 'int', isNullable: false),
|
||||||
isAsynchronous: false,
|
isAsynchronous: false,
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
@ -1340,12 +1415,14 @@ void main() {
|
|||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
name: 'x',
|
name: 'x',
|
||||||
type: TypeDeclaration(isNullable: false, baseName: 'int')),
|
type:
|
||||||
|
const TypeDeclaration(isNullable: false, baseName: 'int')),
|
||||||
NamedType(
|
NamedType(
|
||||||
name: 'y',
|
name: 'y',
|
||||||
type: TypeDeclaration(isNullable: false, baseName: 'int')),
|
type:
|
||||||
|
const TypeDeclaration(isNullable: false, baseName: 'int')),
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration(baseName: 'int', isNullable: false),
|
returnType: const TypeDeclaration(baseName: 'int', isNullable: false),
|
||||||
isAsynchronous: true,
|
isAsynchronous: true,
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
@ -1380,12 +1457,14 @@ void main() {
|
|||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
name: 'x',
|
name: 'x',
|
||||||
type: TypeDeclaration(isNullable: false, baseName: 'int')),
|
type:
|
||||||
|
const TypeDeclaration(isNullable: false, baseName: 'int')),
|
||||||
NamedType(
|
NamedType(
|
||||||
name: 'y',
|
name: 'y',
|
||||||
type: TypeDeclaration(isNullable: false, baseName: 'int')),
|
type:
|
||||||
|
const TypeDeclaration(isNullable: false, baseName: 'int')),
|
||||||
],
|
],
|
||||||
returnType: TypeDeclaration(baseName: 'int', isNullable: false),
|
returnType: const TypeDeclaration(baseName: 'int', isNullable: false),
|
||||||
isAsynchronous: false,
|
isAsynchronous: false,
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
@ -1421,16 +1500,18 @@ void main() {
|
|||||||
objcSelector: 'divideValue:by:',
|
objcSelector: 'divideValue:by:',
|
||||||
arguments: <NamedType>[
|
arguments: <NamedType>[
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'int', isNullable: false),
|
type: const TypeDeclaration(
|
||||||
|
baseName: 'int', isNullable: false),
|
||||||
name: 'x',
|
name: 'x',
|
||||||
),
|
),
|
||||||
NamedType(
|
NamedType(
|
||||||
type: TypeDeclaration(baseName: 'int', isNullable: false),
|
type: const TypeDeclaration(
|
||||||
|
baseName: 'int', isNullable: false),
|
||||||
name: 'y',
|
name: 'y',
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
returnType:
|
returnType: const TypeDeclaration(
|
||||||
TypeDeclaration(baseName: 'double', isNullable: false))
|
baseName: 'double', isNullable: false))
|
||||||
])
|
])
|
||||||
],
|
],
|
||||||
classes: <Class>[],
|
classes: <Class>[],
|
||||||
|
@ -890,4 +890,15 @@ abstract class Api {
|
|||||||
expect(results.errors[0].lineNumber, 3);
|
expect(results.errors[0].lineNumber, 3);
|
||||||
expect(results.errors[0].message, contains('Unknown type: Foo'));
|
expect(results.errors[0].message, contains('Unknown type: Foo'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Object type argument', () {
|
||||||
|
const String code = '''
|
||||||
|
@HostApi()
|
||||||
|
abstract class Api {
|
||||||
|
void storeAll(List<Object?> foos);
|
||||||
|
}
|
||||||
|
''';
|
||||||
|
final ParseResults results = _parseSource(code);
|
||||||
|
expect(results.errors.length, 0);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user