close method
dynamic
close()
Free Runtime and close isolate thread that can be recreate when evaluate again.
Implementation
close() {
final sendPort = _sendPort;
_sendPort = null;
if (sendPort == null) return;
final ret = sendPort.then((sendPort) async {
final closePort = ReceivePort();
sendPort.send({
#type: #close,
#port: closePort.sendPort,
});
final result = await closePort.first;
closePort.close();
if (result is Map && result.containsKey(#error))
throw _decodeData(result[#error]);
return _decodeData(result);
});
return ret;
}