readLineSync method

String? readLineSync({
  1. Encoding? encoding,
})

Use this to read a whole line, whether in mock mode or with real stdin.

Implementation

String? readLineSync({Encoding? encoding}) {
  if (mock) {
    dynamic ret = _mockBuffer[0];
    _mockBuffer.removeAt(0);
    if (informStdout != null && (_isTest || _getEchomode())) {
      informStdout!.write(ret);
    }
    return ret;
  }
  return stdin.readLineSync(encoding: encoding ?? systemEncoding);
}