update method
Send a closure func
that will be executed in the Agent's Isolate.
The result of func
is assigned to the value of the Agent.
Implementation
Future<void> update(T Function(T) func) async {
if (_isolate == null) {
throw StateError('Agent has been killed.');
}
ReceivePort receivePort = ReceivePort();
_sendPort.send(
_Command(_Commands.exec, sendPort: receivePort.sendPort, arg0: func));
return receivePort.first;
}