validate method

bool validate(
  1. String strNumbers
)

Validate a 13-digit Thai ID (digits only).

Implementation

bool validate(String strNumbers) {
  final s = strNumbers.trim();
  if (!_thaiId13Digits.hasMatch(s)) return false;
  final expected = checksum(s.substring(0, 12));
  return expected == int.parse(s[12]);
}