validation library

Re-exports predicates and typed validators.

NOTE: asFormValidator has moved to package:gmana_form/gmana_form.dart.

Classes

EmailBlockedDomainIssue
Email domain appears in the configured block list.
EmailDisposableDomainIssue
Email domain appears in the configured disposable-domain list.
EmailDomainTooLongIssue
Email domain exceeds the configured maximum length.
EmailEmptyIssue
Email input is empty after trimming.
EmailInvalidFormatIssue
Email input does not match the supported address format.
EmailLocalPartTooLongIssue
Email local part exceeds the configured maximum length.
EmailTooLongIssue
Email address exceeds the configured maximum total length.
EmailValidationConfig
Configuration rules for email validation.
EmailValidationIssue
Base type for email validation failures.
EmailValidator
Validates and normalizes email addresses.
Experimental
Annotation for predicates not yet stable enough for production use.
NumberDecimalPlacesExceededIssue
Number has too many decimal places.
NumberEmptyIssue
Number input is empty.
NumberInvalidFormatIssue
Number input is malformed.
NumberNegativeNotAllowedIssue
Negative values are not allowed.
NumberNotIntegerIssue
A whole number is required.
NumberTooLargeIssue
Number is larger than the allowed maximum.
NumberTooSmallIssue
Number is smaller than the allowed minimum.
NumberValidationConfig
Configuration for number validation.
NumberValidationIssue
Base type for number validation failures.
NumberValidator
Canonical validator for number inputs.
PasswordEmptyIssue
Password input is empty.
PasswordMissingDigitIssue
Password is missing a digit.
PasswordMissingLowercaseIssue
Password is missing a lowercase letter.
PasswordMissingSpecialCharacterIssue
Password is missing a special character.
PasswordMissingUppercaseIssue
Password is missing an uppercase letter.
PasswordRepeatedCharacterIssue
Password uses a repeated-character pattern.
PasswordSequentialPatternIssue
Password uses a sequential pattern.
PasswordStrength
Represents the strength grading of a given password.
PasswordTooCommonIssue
Password is too common.
PasswordTooLongIssue
Password is longer than allowed.
PasswordTooShortIssue
Password is shorter than allowed.
PasswordValidationConfig
Configuration for password validation.
PasswordValidationIssue
Base type for password validation failures.
PasswordValidator
Canonical validator for password inputs.
TextContainsBlacklistedIssue
Text contains one or more blacklisted words.
TextEmptyIssue
Text input is empty.
TextInvalidCharactersIssue
Text contains characters outside the allowed set.
TextInvalidPatternIssue
Text does not match the configured pattern.
TextOnlyWhitespaceIssue
Text contains only whitespace.
TextTooLongIssue
Text is longer than allowed.
TextTooShortIssue
Text is shorter than allowed.
TextValidationConfig
Configuration for text validation.
TextValidationIssue
Base type for text validation failures.
TextValidator
Canonical validator for text inputs.
ValidationIssue
Base contract for typed validation failures.

Constants

experimental → const Experimental
Marks a predicate as experimental — subject to change or removal.
kDefaultDisposableDomains → const Set<String>
Disposable domain list - extend this or inject your own. Consider loading from a remote source in production.

Functions

contains(String str, String seed) bool
Returns true if str contains seed.
containsIgnoreCase(String str, String seed) bool
Returns true if str contains seed, ignoring case.
equals(String? str, String comparison) bool
Returns true if str equals comparison.
isAfter(String str, [String? reference]) bool
Returns true if str represents a date after reference.
isAlpha(String str) bool
Returns true if str contains only ASCII alphabetic characters (a–z, A–Z).
isAlphaNumeric(String str) bool
Returns true if str contains only ASCII alphanumeric characters (a–z, A–Z, 0–9).
isAscii(String str) bool
Returns true if str contains only printable ASCII characters (U+0000–U+007F).
isBase64(String str) bool
Returns true if str is a valid Base64-encoded string.
isBefore(String str, [String? reference]) bool
Returns true if str represents a date before reference.
isBetween(String str, String from, String to) bool
Returns true if str represents a date strictly between from and to.
isByteLength(String str, int min, [int? max]) bool
Returns true if str byte-length is within `min`, `max`.
isCreditCard(String str) bool
Returns true if str is a valid credit card number (Luhn check).
isDate(String str) bool
Returns true if str is a parseable date string.
isDivisibleBy(String str, String n) bool
Returns true if the numeric value of str is divisible by n.
isEmail(String str) bool
Returns true if str matches the RFC 5322 email format heuristic.
isFloat(String str) bool
Returns true if str represents a floating-point number.
isFQDN(String str, {bool requireTld = true, bool allowUnderscores = false}) bool
Returns true if str is a valid fully-qualified domain name.
isFullWidth(String str) bool
Returns true if str contains full-width Unicode characters.
isFuture(String str) bool
Returns true if str represents a date in the future.
isHalfWidth(String str) bool
Returns true if str contains half-width Unicode characters.
isHexadecimal(String str) bool
Returns true if str is a valid hexadecimal string.
isHexColor(String str) bool
Returns true if str is a valid hex color (e.g. #FFF or #FFFFFF).
isInt(String str) bool
Returns true if str represents an integer.
isIpv4(String str) bool
Returns true if str is a valid IPv4 address.
isIpv6(String str) bool
Returns true if str is a valid IPv6 address.
isISBN(String? str, [String? version]) bool
Returns true if str is a valid ISBN-10 or ISBN-13.
isJson(String str) bool
Returns true if str is valid JSON.
isLeapYear(String str) bool
Returns true if str represents a date in a leap year.
isLength(String str, int min, [int? max]) bool
Returns true if the display-length of str is within `min`, `max`, counting surrogate pairs as single characters.
isLowerCase(String str) bool
Returns true if str is entirely lowercase (or has no cased characters).
isMongoId(String str) bool
Returns true if str is a valid 24-character MongoDB ObjectId (hex).
isMultiByte(String str) bool
Returns true if str contains multi-byte (non-ASCII) characters.
isNull(String? str) bool
Returns true if str is null or empty.
isNullOrEmpty(String? str) bool
Returns true if str is null or empty.
isNumeric(String str) bool
Returns true if str contains only numeric digits (optionally negative).
isPast(String str) bool
Returns true if str represents a date in the past.
isPostalCode(String? text, String locale, {bool orElse()?}) bool
Returns true if text is a valid postal code for locale.
isSurrogatePair(String str) bool
Returns true if str contains surrogate pairs.
isToday(String str) bool
Returns true if str represents today's UTC date.
isUpperCase(String str) bool
Returns true if str is entirely uppercase (or has no cased characters).
isUuid(String? str, [String? version]) bool
Returns true if str is a valid UUID (any version by default).
isVariableWidth(String str) bool
Returns true if str contains both full-width and half-width characters.
isWeekday(String str) bool
Returns true if str represents a Monday–Friday.
isWeekend(String str) bool
Returns true if str represents a Saturday or Sunday.
matches(String str, String pattern) bool
Returns true if str matches the regex pattern.
resolveEmailValidationIssue(EmailValidationIssue issue) String
Default English messages for email validation issues.
resolveNumberValidationIssue(NumberValidationIssue issue) String
Default English messages for number validation issues.
resolvePasswordValidationIssue(PasswordValidationIssue issue) String
Default English messages for password validation issues.
resolveTextValidationIssue(TextValidationIssue issue) String
Default English messages for text validation issues.
tryParseDate(String str) DateTime?
Parses str as a UTC DateTime, returning null on failure.

Typedefs

ValidationMessageResolver<TIssue extends ValidationIssue> = String Function(TIssue issue)
Maps a typed validation issue into a user-facing message.
ValidationResult<TIssue extends ValidationIssue, TValue> = Either<TIssue, TValue>
Canonical result shape for validators.