evaluate<U> method
Evaluates function on the isolated object and returns the result.
Implementation
Future<U> evaluate<U>(FutureOr<U> Function(T) function) async {
if (_isClosed) {
throw StateError('IsolatedObject<$T> is closed');
}
final (toChild, _, inflight) = await _connected;
final id = _nextId++;
final completer = Completer<U>();
inflight[id] = completer;
toChild.send((id: id, function: function));
return completer.future;
}