imei15Validator static method

String? imei15Validator(
  1. String? value, [
  2. String? errorMessage
])

imei15Validator to validate IMEI 15 digits

validator: (value) => SimpleValidations.imei15Validator(value, [errorMessage]),

Implementation

static String? imei15Validator(String? value, [String? errorMessage]) {
  RegExp regex = CustomRegEx.imei15Regex;
  if (value == null || value.isEmpty) {
    return errorMessage ?? 'Required';
  } else if (!regex.hasMatch(value)) {
    return errorMessage ?? 'Please enter a valid IMEI number (15 digits)';
  }
  return null;
}