PostalCodeValidator<T> class

Validates that a string is a valid postal code for 129 countries worldwide

Supports postal codes from:

  • América del Norte: US, CA, MX, CR, PA, GT, SV, HN, NI, CU, DO, PR
  • América del Sur: BR, AR, CL, CO, PE, VE, EC, BO, PY, UY
  • Europa Occidental: GB, FR, DE, ES, IT, NL, BE, CH, AT, PT, IE, LU, MC, AD, SM, LI, VA, GI
  • Europa Nórdica: SE, NO, DK, FI, IS, FO, GL
  • Europa Oriental: PL, CZ, SK, HU, RO, BG, HR, SI, EE, LV, LT, UA, BY, MD, RS, BA, MK, AL, GR, CY, MT, ME, XK
  • Rusia y Asia Central: RU, KZ, AM, AZ, GE
  • Asia Oriental: JP, CN, KR, TW, HK, MO
  • Sudeste Asiático: TH, VN, MY, SG, ID, PH, MM, KH, LA, BN
  • Asia del Sur: IN, PK, BD, LK, NP, BT, MV
  • Oriente Medio: TR, IL, SA, AE, QA, KW, BH, OM, JO, LB, IQ, IR, PS
  • África: ZA, EG, MA, DZ, TN, LY, KE, NG, ET, GH, MR, MU, LC
  • Oceanía: AU, NZ, PG, FJ, VG
Inheritance

Constructors

PostalCodeValidator({String? countryCode})

Properties

countryCode String?
final
customErrorMessage String?
Custom error message override.
getter/setter pairinherited
defaultErrorMessage String
The default error message for this validator.
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

getErrorMessage(ValidationContext<T> context, String? value) String
Gets the error message for this validator.
inherited
isValid(ValidationContext<T> context, String? value) bool
Determines if the value is valid.
override
isValidAsync(ValidationContext<T> context, String? value) Future<bool>
Determines if the value is valid asynchronously.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
validate(ValidationContext<T> context, String? value, String propertyName) List<ValidationFailure>
Validates the property value.
inherited
validateAsync(ValidationContext<T> context, String? value, String propertyName) Future<List<ValidationFailure>>
Validates the property value asynchronously.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited