bankIfscValidator static method

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

bankIfscValidator to validate bank IFSC number

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

Implementation

static String? bankIfscValidator(String? value, [String? errorMessage]) {
  RegExp ifscPattern = CustomRegEx.bankifscRegex;

  if (value == null || value.isEmpty) {
    return errorMessage ?? 'Required';
  } else if (!ifscPattern.hasMatch(value)) {
    return errorMessage ?? 'Invalid IFSC code format';
  }
  return null;
}