isbn13Validator static method
isbn13Validator to validate ISBN-13
validator: (value) => SimpleValidations.isbn13Validator(value, [errorMessage]),
Implementation
static String? isbn13Validator(String? value, [String? errorMessage]) {
RegExp regex = CustomRegEx.isbn13Regex;
if (value == null || value.isEmpty) {
return errorMessage ?? 'Required';
} else if (!regex.hasMatch(value)) {
return errorMessage ?? 'Please enter a valid ISBN-13 number';
}
return null;
}