prompt_sync method

String? prompt_sync({
  1. bool checker(
    1. String response
    )?,
})

Implementation

String? prompt_sync({
  final bool Function(String response)? checker,
}) {
  for (;;) {
    console.raw_console.write(message);
    if (secret) {
      console.raw_console.echo_mode = false;
    }
    final response = console.raw_console.read();
    if (secret) {
      console.raw_console.echo_mode = true;
      print('');
    }
    if (checker != null && response != null) {
      if (checker(response)) {
        return response;
      }
    } else {
      return response;
    }
  }
}