readLineDefault 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.
This method is the same as readLine, but it returns defaultValue
instead of null.
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> readLineDefault({
String defaultValue = "",
Encoding encoding = systemEncoding,
bool retainNewlines = false,
}) {
return readLine(
encoding: encoding,
retainNewlines: retainNewlines,
).then((v) => v ?? defaultValue);
}