isValidNationalInsuranceNumber method

AbstractRuleBuilder isValidNationalInsuranceNumber({
  1. String? message,
})

Checks the object is a String and is a valid UK national insurance number

Implementation

AbstractRuleBuilder isValidNationalInsuranceNumber({String? message}) {
  return must(
      (dynamic dyn) =>
          dyn is String && CommonRegex.ninValidator.hasMatch(dyn),
      message != null
          ? message
          : useKeyAsElementName
              ? "$key must be a valid national insurance number"
              : "String must be a valid national insurance number",
      code: "notValidNationalInsuranceNumber");
}