isDigit function

bool isDigit(
  1. String? character, {
  2. bool positiveOnly = false,
})

character a character to check if it's a digit against positiveOnly if true it will not allow a minus (dash) character to be accepted as a part of a digit

Implementation

bool isDigit(
  String? character, {
  bool positiveOnly = false,
}) {
  if (character == null || character.isEmpty || character.length > 1) {
    return false;
  }
  if (positiveOnly) {
    return _positiveDigitRegExp.stringMatch(character) != null;
  }
  return _digitRegExp.stringMatch(character) != null;
}