defaultPrompt static method

String defaultPrompt(
  1. String prompt,
  2. String? defaultValue,
  3. bool hidden
)

Implementation

static String defaultPrompt(
    String prompt,
    String? defaultValue,
    // ignore: avoid_positional_boolean_parameters
    bool hidden) {
  var result = prompt;

  /// completely suppress the default value and the prompt if
  /// the prompt is empty.
  if (defaultValue != null && prompt.isNotEmpty) {
    /// don't display the default value if hidden is true.
    result = '$prompt [${hidden ? '******' : defaultValue}]';
  }
  return result;
}