readLine method
Executes stdin.readLineSync
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.
Implementation
Future<String?> readLine({
Encoding encoding = systemEncoding,
bool retainNewlines = false,
}) async {
_checkIsNotDispose();
_checkIsIdle();
await _initialize();
_reqReadLineComp = Completer();
(await _requestPort).send(
_RequestReadLine(encoding: encoding, retainNewlines: retainNewlines),
);
final line = await _reqReadLineComp!.future;
_reqReadLineComp = null;
return line;
}