evaluate method
Evaluate js script.
Implementation
Future<dynamic> evaluate(
String command, {
String? name,
int? evalFlags,
}) async {
_ensureEngine();
final evaluatePort = ReceivePort();
final sendPort = await _sendPort!;
sendPort.send({
#type: #evaluate,
#command: command,
#name: name,
#flag: evalFlags,
#port: evaluatePort.sendPort,
});
final result = await evaluatePort.first;
evaluatePort.close();
if (result is Map && result.containsKey(#error))
throw _decodeData(result[#error]);
return _decodeData(result);
}