prompt method

Future<String> prompt(
  1. String message, {
  2. bool nullable = false,
})

Implementation

Future<String> prompt(String message, {bool nullable = false}) async {
  stdout.write("$message${nullable ? " (Optional)" : ""}: ");
  final value = stdin.readLineSync();
  if ((value == null || value.isEmpty) && !nullable) {
    logger.logError("Input cannot be empty.");
    return prompt(message);
  }
  return value ?? "";
}