ThaiIdCardNumbers class

Constructors

ThaiIdCardNumbers()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

checksum(String first12) int
Compute the checksum digit (0-9) for the first 12 digits. Throws ArgumentError if first12 is not exactly 12 digits.
extractInfo(String input) ThaiIdInfo
Parse the ID to get metadata (Type, Office, Group, etc).
format(String number, {String pattern = 'x-xxxx-xxxxx-xx-x', String delimiter = '-'}) String
Format a digits-only number according to pattern and delimiter. Pattern placeholders should be 'x' characters.
formatStrict(String number, {String pattern = 'x-xxxx-xxxxx-xx-x', String delimiter = '-'}) String
Strict formatter that validates input length against the pattern. Throws ArgumentError if number length does not match pattern slots.
generate({int? firstDigit, bool formatted = false, String pattern = 'x-xxxx-xxxxx-xx-x', String delimiter = '-'}) String
Generate a valid Thai ID.
normalize(String input) String
Normalize a string by removing all non-digit characters.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
random() String
Generate 13 random digits (not guaranteed valid).
toString() String
A string representation of this object.
inherited
validate(String strNumbers) bool
Validate a 13-digit Thai ID (digits only).
validateFormatted(String input) bool
Validate a formatted Thai ID. Accepts any delimiters; digits are normalized.

Operators

operator ==(Object other) bool
The equality operator.
inherited