isValidDecimal method

bool isValidDecimal(
  1. String input
)

Checks if the provided input is a valid decimal.

Parameters:

  • input: The input string to be checked.

Returns: A bool indicating whether the input is a valid decimal.

Implementation

bool isValidDecimal(String input) {
  RegExp decimalRegExp = RegExp(r'^\d*\.?\d+$');
  return decimalRegExp.hasMatch(input);
}