memberGet method
Fetch a member by the varName
, in the form of
object.varName
varName
must be of String type.
Implementation
@override
dynamic memberGet(String varName, {String? from}) {
switch (varName) {
case 'Future':
return (HTEntity entity,
{List<dynamic> positionalArgs = const [],
Map<String, dynamic> namedArgs = const {},
List<HTType> typeArgs = const []}) {
final HTFunction func = positionalArgs.first;
return Future(() => func.call());
};
case 'Future.wait':
return (HTEntity entity,
{List<dynamic> positionalArgs = const [],
Map<String, dynamic> namedArgs = const {},
List<HTType> typeArgs = const []}) {
final futures = List<Future<dynamic>>.from(positionalArgs.first);
// final HTFunction? func = namedArgs['cleanUp'];
return Future.wait(futures);
// , cleanUp: (value) {
// if (func != null) func.call(positionalArgs: [value]);
// });
};
case 'Future.value':
return (HTEntity entity,
{List<dynamic> positionalArgs = const [],
Map<String, dynamic> namedArgs = const {},
List<HTType> typeArgs = const []}) {
return Future.value(positionalArgs.first);
};
default:
throw HTError.undefined(varName);
}
}