Map constructor
Map()
Implementation
Map()
: super(
methodName: "map",
targetType: .list,
arity: 1,
function: (target, vm, arguments) async {
if (arguments[0] is! ObjClosure) {
throw RuntimeError(
"Map function must be a function. ${arguments[0].runtimeType}",
);
}
var result = [];
for (var element in target) {
result.add(await invokeScriptClosure(vm, arguments[0], [element]));
}
return result;
},
);