isNumeric property

bool get isNumeric

Returns true if the string contains only digits.

Implementation

bool get isNumeric {
  if (isEmpty) return false;
  return RegExp(r'^-?\d+(\.\d+)?$').hasMatch(this);
}