getInt function
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,
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,
),
);
}