isValidUKPostCode method

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

Checks the object is a String and is a valid UK post code

Implementation

AbstractRuleBuilder isValidUKPostCode({String? message}) {
  return must(
      (dynamic dyn) =>
          dyn is String && CommonRegex.postCodeValidator.hasMatch(dyn),
      message != null
          ? message
          : useKeyAsElementName
              ? "$key must be a valid UK post code"
              : "String must be a valid UK post code",
      code: "notWalidUKPostCode");
}