getInt function

int getInt(
  1. String message, {
  2. int? defaultsTo,
  3. int radix = 10,
  4. bool color = true,
  5. bool chevron = true,
  6. bool conceal = false,
  7. @deprecated bool colon = true,
  8. AnsiCode inputColor = cyan,
})

Prompts the user to enter an integer.

An optional radix may be provided.

color, defaultsTo, inputColor, conceal, and chevron are forwarded to get.

Implementation

int getInt(String message,
    {int? defaultsTo,
    int radix = 10,
    bool color = true,
    bool chevron = true,
    bool conceal = false,
    @deprecated bool colon = true,
    AnsiCode inputColor = cyan}) {
  return int.parse(get(
    message,
    defaultsTo: defaultsTo?.toString(),
    chevron: chevron && colon,
    inputColor: inputColor,
    color: color,
    conceal: conceal,
    validate: (s) => int.tryParse(s, radix: radix) != null,
  ));
}