isCharDigitOrDecimalPoint function

bool isCharDigitOrDecimalPoint(
  1. String char
)

Returns true if char represents a digit or a decimal point, false otherwise.

This function checks whether the input string is not empty and whether its first character is a digit (i.e., has a Unicode code point between the code points of '0' and '9') or a decimal point ('.').

If the input string satisfies either of these conditions, the function returns true. Otherwise, it returns false.

Implementation

bool isCharDigitOrDecimalPoint(String char) {
  if (char.isEmpty) return false;

  final isDecimalPoint = char == '.';

  return isCharDigit(char) || isDecimalPoint;
}