pro_validator library

pro_validator is a dart package that provides a set of validators, composable groups, and low-level string checkers.

Classes

AfterValidator
Ensures the value is strictly after dateTime.
BeforeValidator
Ensures the value is strictly before dateTime.
ConditionalValidator
Runs validator only when condition returns true for the current value.
CreditCardValidator
Ensures the value is a plausible credit card number.
DateRangeValidator
Ensures the value falls within the inclusive range [start, end].
EmailValidator
Ensures the value is a validly formatted email address.
EvenValidator
Ensures the number is even (its remainder modulo 2 is zero).
FileExtensionValidator
Ensures the value (a file name or path) ends with one of the allowedExtensions.
FutureValidator
Ensures the value is in the future relative to clock.
HasANumberValidator
Ensures the value contains at least one numeric character.
HasLowercaseValidator
Ensures the value contains at least one lowercase character.
HasUppercaseValidator
Ensures the value contains at least one uppercase character.
LengthRangeValidator
Ensures the trimmed value's length (in Unicode code points) is contained in the range min, max.
MatchValidator
A special validator that checks whether two values are equal.
MaxLengthValidator
Ensures the value contains no more than max Unicode code points (runes).
MaxValidator
Ensures the number is less than or equal to max.
MinLengthValidator
Ensures the value contains no fewer than min Unicode code points (runes).
MinValidator
Ensures the number is greater than or equal to min.
ModelValidator<T>
Validates a whole model T: field checks, cross-field rules, conditions and rule-sets, reusing the package's value validators.
MultipleOfValidator
Ensures the number is a multiple of factor.
NegativeValidator
Ensures the number is strictly less than zero.
NumRangeValidator
Ensures the numeric value of the input is contained in the range min, max.
OddValidator
Ensures the number is odd (its remainder modulo 2 is one).
OneOfValidator
Ensures the value is one of the allowed values.
PastValidator
Ensures the value is in the past relative to clock.
PatternTextValidator
Base class for validators backed by a regular expression.
PatternValidator
Ensures the value matches a custom regular expression.
PhoneValidator
Ensures the value is a validly formatted phone number.
PositiveValidator
Ensures the number is strictly greater than zero.
PredicateValidator<T extends Object>
Builds a validator from a plain predicate — a one-off check without declaring a new class.
RangeValidator
Ensures the number is within the inclusive range [min, max].
RequiredValidator
Ensures the value is not empty and not whitespace only.
RuleBuilder<T>
Fluent builder for a single field's rule (see ModelValidator.ruleFor).
TextValidator
Base class for validators that operate on optional text (String?).
UrlValidator
Ensures the value is a validly formatted URL.
ValidationResult
The outcome of validating a model: which field failed with which messages.
Validator<T extends Object>
Base class for every validator in the package.
ValidatorGroup<T extends Object>
Groups several validators of the same type T and runs them in order.

Enums

Patterns

Extensions

PatternsValidation on Patterns
Builds a ready-made validator from any Patterns entry, so all 40+ formats are available as validators — not only the few with a named class.
StringCheck on String
ValidatorComposition on Validator<T>
Composition sugar for building a ValidatorGroup with the & operator.

Functions

isAlphabetic(String s) bool
Checks if the string contains only alphabetic characters (letters).
isAlphaNumeric(String s) bool
Checks if the string contains only alphanumeric characters (letters and numbers).
isAnyNonAscii(String s) bool
Checks if the string contains any non-ASCII Unicode characters.
isBase64(String s) bool
Checks if the string is a valid Base64-encoded string.
isCreditCard(String s) bool
Checks if the string is a valid credit card number.
isDate(String s) bool
Checks if the string is a valid date.
isDateTime(String s) bool
Checks if the string is a valid datetime (e.g., YYYY-MM-DD HH:mm:ss).
isDecimal(String s) bool
Checks if the string is a valid decimal number, with optional exponential notation.
isEmail(String s) bool
Checks if the string is a valid email address.
isEmailRFC5322(String s) bool
Checks if the string is a valid email address according to the RFC 5322
isGeoCoordinates(String s) bool
Checks if the string is a valid geo-coordinates.
isHashtag(String s) bool
Checks if the string is a valid hashtag (e.g., #example).
isHexadecimal(String s) bool
Checks if the string is a valid hexadecimal number.
isHexColor(String s) bool
Checks if the string is a valid hex color (e.g., #FFF, #FFFFFF).
isHexUuid(String s) bool
Checks if the string is a valid compact UUID (without hyphens).
isHtmlTag(String s) bool
Checks if the string contains a valid HTML tag.
isIban(String s) bool
Checks if the string is a valid IBAN (International Bank Account Number).
isInteger(String s) bool
Checks if the string is a valid integer (positive, negative, or zero).
isIpv4(String s) bool
Checks if the string is a valid IPv4 address.
isIpv4WithMask(String s) bool
Checks if the string is a valid IPv4 address with a subnet mask.
isIpv6(String s) bool
Checks if the string is a valid IPv6 address.
isIso8601DateTime(String s) bool
Checks if the string is a valid ISO 8601 datetime.
isJwt(String s) bool
Checks if the string is a valid JSON Web Token (JWT).
isLatitude(String s) bool
Checks if the string is a valid latitude.
isLongitude(String s) bool
Checks if the string is a valid longitude.
isLuhn(String s) bool
Checks if a string of digits satisfies the Luhn checksum.
isMacAddress(String s) bool
Checks if the string is a valid MAC address.
isNumeric(String s) bool
Checks if the string contains only numeric characters (positive or negative integers).
isOnlyAscii(String s) bool
Checks if the string contains only ASCII characters.
isPhoneNumber(String s) bool
Checks if the string is a valid phone number in local format.
isPostalCode(String s) bool
Checks if the string is a valid postal code.
isSlug(String s) bool
Checks if the string is a valid URL slug.
isSurrogatePairs(String s) bool
Checks if the string contains surrogate pairs used for encoding characters outside the BMP in Unicode.
isSwiftOrBic(String s) bool
Checks if the string is a valid SWIFT/BIC code.
isTime(String s) bool
Checks if the string is a valid time (HH:mm:ss or HH:mm).
isTime12Hour(String s) bool
Checks if the string is a valid time in 12-hour format (HH:mm AM/PM).
isUrl(String s) bool
Checks if the string is a valid URL.
isUuid(String s) bool
Checks if the string is a valid UUID of any version.
isUuidV3(String s) bool
Checks if the string is a valid UUID version 3.
isUuidV4(String s) bool
Checks if the string is a valid UUID version 4.
isUuidV5(String s) bool
Checks if the string is a valid UUID version 5.
isVat(String s) bool
Checks if the string is a valid VAT (Value Added Tax) number.
isWhitespace(String s) bool
Checks if the string consists only of whitespace characters (or is empty).