isNumbersOnly static method

bool isNumbersOnly(
  1. String text
)

Check if string contains only numbers

text - The text to validate Returns true if text contains only numbers

Implementation

static bool isNumbersOnly(String text) {
  return RegExp(r'^[0-9]+$').hasMatch(text);
}