readByte method

Future<int> readByte()

Executes stdin.readByteSync in a different Isolate then the calling one. Therefore this method does not block the event loop of the calling Isolate.

The returned Future completes with an error containing an IsolatedStdinDisposedException, if the Isolate is disposed (see dispose) before this request is finshed.

See Stdin.readByteSync

Implementation

Future<int> readByte() async {
  _checkIsNotDispose();
  _checkIsIdle();

  await _initialize();

  _reqReadByteComp = Completer();
  (await _requestPort).send(const _RequestReadByte());

  final byte = await _reqReadByteComp!.future;
  _reqReadByteComp = null;

  return byte;
}