exactLength static method
Validates that the value has exact length
Example:
Validators.exactLength(value, 10);
Implementation
static String? exactLength(String? value, int length, {String? message}) {
if (value == null || value.isEmpty) return null;
if (value.length != length) {
return message ?? 'Must be exactly $length characters';
}
return null;
}