isNumeric method

bool isNumeric()

Returns true if the the target string contains only digits Note that spaces are not counted as numeric

For example:

  • '402'.isNumeric() -> true
  • '203k'.isNumeric() -> false
  • '201.6'.isNumeric() -> true

Implementation

bool isNumeric() {
  return numericRegex.hasMatch(this);
}