validateOCN static method
Ensures that a user provides an OCN that is 4 characters
Implementation
static String? validateOCN(String? value) {
if (value == null || value.isEmpty) {
return 'Value can not be empty';
}
final regex = RegExp(r'^[:alnum]{4}$', caseSensitive: false, multiLine: false);
if (!regex.hasMatch(value)) {
return 'Value should be a 4 character ID';
}
return null;
}