request<T> method
Sends one command and completes with its typed result.
Implementation
Future<T> request<T>(Object? command) {
if (_disposed) throw StateError('NativeTaskIsolate is disposed.');
final int requestId = _nextRequestId;
_nextRequestId += 1;
final Completer<Object?> completer = Completer<Object?>();
_pending[requestId] = completer;
_commands.send(_NativeTaskRequest(requestId, command));
return completer.future.then((Object? value) => value as T);
}