uuidV4Validator static method
uuidV4Validator to validate UUID v4
validator: (value) => SimpleValidations.uuidV4Validator(value, [errorMessage]),
Implementation
static String? uuidV4Validator(String? value, [String? errorMessage]) {
RegExp regex = CustomRegEx.uuidV4Regex;
if (value == null || value.isEmpty) {
return errorMessage ?? 'Required';
} else if (!regex.hasMatch(value)) {
return errorMessage ?? 'Please enter a valid UUID version 4';
}
return null;
}