isOnlyDigits property

bool get isOnlyDigits

Whether a string contains only digits.

Implementation

bool get isOnlyDigits =>
    isNotEmpty &&
        characters.every((character) => const {
          '0',
          '1',
          '2',
          '3',
          '4',
          '5',
          '6',
          '7',
          '8',
          '9',
        }.contains(character));