promptConfirm function Null safety

Future<bool> promptConfirm(
  1. String? text,
  2. {Stream<List<int>>? stdin}
)

Confirm action

Implementation

Future<bool> promptConfirm(String? text, {Stream<List<int>>? stdin}) async {
  stdout.write('${(text?.isNotEmpty ?? false) ? '$text. ' : ''}Continue Y/N? ');
  await stdout.safeFlush();
  final input = await _promptGetText(stdin: stdin);
  if (input.toLowerCase() != 'y') {
    return false;
  }
  return true;
}