prompt function

String prompt(
  1. String message, {
  2. String? skipValue,
  3. bool? skip,
})

Displays a message to the user and waits for their input.

This function prints the message to the console and reads a line of input from stdin. If skip is true, it will use skipValue (or an empty string if skipValue is null) and log that it's skipping the prompt, without waiting for user input.

message The message to display to the user. skipValue An optional value to return if skip is true. skip A boolean indicating whether to skip the prompt and use skipValue.

Returns the user's input or skipValue if the prompt is skipped.

Implementation

String prompt(String message, {String? skipValue, bool? skip}) {
  logger.i('$message ');
  if (skip == true) {
    logger.i('>>| Skipping with (${skipValue ?? ''})...');
    return skipValue!;
  }
  return stdin.readLineSync() ?? '';
}