isDigits method

bool isDigits()

Check if a string contains only digits.

Implementation

bool isDigits() {
  if (this == null) {
    throw ArgumentError('string: $this');
  }
  if (this!.isEmpty) {
    return false;
  }
  return RegExp(r'^[0-9]+$').hasMatch(this!);
}