readLine method
The next input line when the terminal is not interactive, or null at the end of input.
Implementation
Future<String?> readLine() async {
while (_lines.isEmpty) {
if (_inputClosed) {
if (_partialLine.isEmpty) {
return null;
}
final last = _partialLine.toString();
_partialLine.clear();
return last;
}
await (_lineWaiter = Completer<void>()).future;
}
return _lines.removeAt(0);
}