readLine method
Reads one line as the terminal reads it, without its line break; null
at the end of input. hidden switches echo off while it reads, where
input is a terminal.
Implementation
@override
Future<String?> readLine({bool hidden = false}) async {
_reads++;
if (_lines.isEmpty || _closed) {
return null;
}
final line = _lines.removeAt(0);
if (capabilities.outputIsTerminal && !hidden) {
// the terminal echoes what is typed
_feed('$line\n');
} else if (capabilities.outputIsTerminal) {
_feed('\n');
}
return line;
}