isNumeric property

bool get isNumeric

Checks whether the string contains only numbers.

Implementation

bool get isNumeric {
  if (this == null || this!.isEmpty) return false;
  return RegExp(r'^[0-9]+$').hasMatch(this!);
}