validation library

Re-exports predicates and typed validators.

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

Classes

ConfirmPasswordEmptyIssue
Confirmation input is empty.
ConfirmPasswordMismatchIssue
Confirmation input does not match the original password.
ConfirmPasswordValidationConfig
Configuration for confirm-password validation.
ConfirmPasswordValidationIssue
Base type for confirm-password validation failures.
ConfirmPasswordValidator
Validator for confirm-password values.
DateAfterMaxIssue
Date is after configured maxDate.
DateBeforeMinIssue
Date is before configured minDate.
DateEmptyIssue
Date input is empty.
DateInvalidFormatIssue
Input could not be parsed as a valid ISO 8601 date.
DateInvalidTimeIssue
Input does not match 24-hour time format.
DateNotFutureIssue
Date is not in the future.
DateNotLeapYearIssue
Date is not in a leap year.
DateNotPastIssue
Date is not in the past.
DateNotTodayIssue
Date does not match today's UTC date.
DateNotWeekdayIssue
Date is not a weekday.
DateNotWeekendIssue
Date is not a weekend.
DateValidationConfig
Configuration options for date and time validation.
DateValidationIssue
Base type for date validation failures.
DateValidator
Canonical validator for date and time inputs.
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.
IdentifierEmptyIssue
Identifier input is empty.
IdentifierInvalidCreditCardIssue
Identifier is not a valid credit card number.
IdentifierInvalidEanIssue
Identifier is not a valid EAN barcode number.
IdentifierInvalidImeiIssue
Identifier is not a valid IMEI number.
IdentifierInvalidMongoIdIssue
Identifier is not a valid MongoDB ObjectId.
IdentifierInvalidNanoIdIssue
Identifier is not a valid Nano ID.
IdentifierInvalidSemVerIssue
Identifier is not a valid Semantic Version.
IdentifierInvalidUlidIssue
Identifier is not a valid ULID.
IdentifierInvalidUuidIssue
Identifier is not a valid UUID.
IdentifierValidationConfig
Configuration options for identifier validation.
IdentifierValidationIssue
Base type for identifier validation failures.
IdentifierValidator
Canonical validator for identifier inputs.
NetworkEmptyIssue
Network input is empty.
NetworkInvalidCidrIssue
Invalid CIDR notation.
NetworkInvalidDataUriIssue
Invalid Data URI scheme.
NetworkInvalidIpIssue
Invalid IP address.
NetworkInvalidMacIssue
Invalid MAC address.
NetworkInvalidMagnetUriIssue
Invalid Magnet URI.
NetworkInvalidPortIssue
Invalid network port number.
NetworkValidationConfig
Configuration options for network address validation.
NetworkValidationIssue
Base type for network validation failures.
NetworkValidator
Canonical validator for network input formats.
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.
PhoneEmptyIssue
Phone input is empty.
PhoneInvalidFormatIssue
Phone input has invalid formatting or non-digit characters.
PhoneMissingPlusIssue
Phone input is missing required + prefix.
PhoneTooLongIssue
Phone number contains more than allowed maximum digits.
PhoneTooShortIssue
Phone number contains fewer than required minimum digits.
PhoneValidationConfig
Configuration rules for phone number validation.
PhoneValidationIssue
Base type for phone validation failures.
PhoneValidator
Validates and normalizes phone numbers.
Predicates
Combinators for building Predicates out of smaller ones.
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.
UrlDisallowedSchemeIssue
URL scheme is not allowed by configuration.
UrlEmptyIssue
URL input is empty.
UrlInvalidFormatIssue
URL string is malformed or cannot be parsed.
UrlMissingHostIssue
URL is missing a host address.
UrlValidationConfig
Configuration rules for URL validation.
UrlValidationIssue
Base type for URL validation failures.
UrlValidator
Validates and parses URL strings into Uri.
ValidationIssue
Base contract for typed validation failures.

Enums

IdentifierType
Supported identifier validation types.
NetworkAddressType
Required network address type.

Extensions

GmanaNullableStringPredicatesX on String?
Convenient extension methods on nullable String values.
GmanaStringPredicatesX on String
Convenient extension methods on non-null String values.
GmanaValidationResultX on ValidationResult<TIssue, TValue>
Validation-domain vocabulary for a ValidationResult.
GmanaValidationStringX on String
Typed validation shortcuts on String.
PredicateX on Predicate<T>
Fluent composition for Predicates.
StringValidation on String
A vast collection of validation utilities mapped as getters on String.

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.
endsWithIgnoreCase(String str, String suffix) → bool
Returns true if str ends with suffix, ignoring case.
equals(String? str, String comparison) → bool
Returns true if str equals comparison.
hasWhitespace(String str) → bool
Returns true if str contains at least one whitespace character.
isAfter(String str, [String? reference]) → bool
Returns true if str represents a date after reference.
isAgeAtLeast(String str, int years) → bool
Returns true if a birth date of str means an age of at least years as of today (UTC).
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).
isAnagram(String str, String other, {bool ignoreCase = true, bool ignoreNonAlphanumeric = true}) → bool
Returns true if str and other are anagrams of one another.
isAscii(String str) → bool
Returns true if str contains only printable ASCII characters (U+0000–U+007F).
isBase32(String str) → bool
Returns true if str is a valid Base32-encoded string (RFC 4648).
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.
isBetweenInclusive(String str, String from, String to) → bool
Returns true if str falls between from and to, bounds included.
isBic(String str) → bool
Returns true if str is a valid BIC/SWIFT code (ISO 9362).
isBinary(String str) → bool
Returns true if str contains only binary digits (0 and 1).
isBlank(String? str) → bool
Returns true if str is null, empty, or consists only of whitespace.
isByteLength(String str, int min, [int? max]) → bool
Returns true if str byte-length is within `min`, `max`.
isCamelCase(String str) → bool
Returns true if str is in camelCase format (e.g. fooBar).
isCapitalized(String str) → bool
Returns true if str starts with an uppercase letter.
isCidr(String str, [int? version]) → bool
Returns true if str is a valid CIDR notation.
isCreditCard(String str) → bool
Returns true if str is a valid credit card number (Luhn check).
isDataURI(String str) → bool
Returns true if str is a valid Data URI scheme (RFC 2397).
isDate(String str) → bool
Returns true if str is a parseable date string.
isDecimal(String str, {int? places}) → bool
Returns true if str is a decimal number, optionally with exactly places digits after the point.
isDivisibleBy(String str, String n) → bool
Returns true if the numeric value of str is divisible by n.
isEAN(String str, [String? version]) → bool
Returns true if str is a valid EAN-8 or EAN-13 barcode number with valid checksum.
isEmail(String str) → bool
Returns true if str matches the RFC 5322 email format heuristic.
isEndOfMonth(String str) → bool
Returns true if str is the last day of its month.
isEven(String str) → bool
Returns true if str represents an even integer.
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.
isHash(String str, String algorithm) → bool
Returns true if str is a valid hash string for algorithm (e.g. 'md5', 'sha1', 'sha256', 'sha512').
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).
isHostname(String str) → bool
Returns true if str is a valid hostname label sequence (RFC 1123).
isHslColor(String str) → bool
Returns true if str is a CSS hsl() or hsla() color with saturation and lightness in 0–100%.
isIban(String str) → bool
Returns true if str is a valid IBAN, by ISO 13616 mod-97 checksum.
isIMEI(String str) → bool
Returns true if str is a valid 15-digit International Mobile Equipment Identity (IMEI) number.
isInRange(String str, num min, num max) → bool
Returns true if the numeric value of str is within `min`, `max` (inclusive).
isInt(String str) → bool
Returns true if str represents an integer.
isIP(String str, [int? version]) → bool
Returns true if str is a valid IP address.
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.
isIso8601(String str) → bool
Returns true if str is a full ISO 8601 date or date-time.
isJson(String str) → bool
Returns true if str is valid JSON.
isJwt(String str) → bool
Returns true if str matches JSON Web Token (JWT) format structure.
isKebabCase(String str) → bool
Returns true if str is in kebab-case format (e.g. foo-bar).
isLatitude(String str) → bool
Returns true if str is a latitude in the range -90 to 90.
isLatLong(String str) → bool
Returns true if str is a latitude,longitude pair (e.g. 11.55,104.91).
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.
isLongitude(String str) → bool
Returns true if str is a longitude in the range -180 to 180.
isLoopbackIpv4(String str) → bool
Returns true if str is an IPv4 loopback address (127.0.0.0/8).
isLowerCase(String str) → bool
Returns true if str is entirely lowercase (or has no cased characters).
isLuhnValid(String str) → bool
Returns true if str passes the Luhn checksum algorithm.
isMacAddress(String str) → bool
Returns true if str is a valid MAC address (e.g. 00:1A:2B:3C:4D:5E, 00-1A-2B-3C-4D-5E, or 001A.2B3C.4D5E).
isMagnetURI(String str) → bool
Returns true if str is a valid BitTorrent Magnet URI.
isMimeType(String str) → bool
Returns true if str is a valid MIME type format (e.g. application/json).
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.
isNanoId(String str, [int expectedLength = 21]) → bool
Returns true if str matches a Nano ID format of length expectedLength (default: 21).
isNegative(String str) → bool
Returns true if the numeric value of str is less than zero.
isNotBlank(String? str) → bool
Returns true if str is not null and contains non-whitespace characters.
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).
isOctal(String str) → bool
Returns true if str contains only octal digits (0–7).
isOdd(String str) → bool
Returns true if str represents an odd integer.
isPalindrome(String str, {bool ignoreCase = true, bool ignoreNonAlphanumeric = true}) → bool
Returns true if str reads the same forwards and backwards.
isPascalCase(String str) → bool
Returns true if str is in PascalCase format (e.g. FooBar).
isPast(String str) → bool
Returns true if str represents a date in the past.
isPhoneNumber(String str, {bool requirePlusPrefix = false}) → bool
Returns true if str is a valid phone number.
isPort(String str) → bool
Returns true if str is a valid network port number (1–65535).
isPositive(String str) → bool
Returns true if the numeric value of str is greater than zero.
isPostalCode(String? text, String locale, {bool orElse()?}) → bool
Returns true if text is a valid postal code for locale.
isPrime(int n) → bool
Returns true if n is a prime integer.
isPrimeString(String str) → bool
Returns true if str represents a prime integer.
isPrintable(String str) → bool
Returns true if str contains only printable ASCII, tab, newline or carriage return.
isPrivateIpv4(String str) → bool
Returns true if str is an IPv4 address in a private range (RFC 1918).
isPublicIpv4(String str) → bool
Returns true if str is an IPv4 address that is routable on the public internet.
isRgbColor(String str) → bool
Returns true if str is a CSS rgb() or rgba() color with every channel in 0–255.
isSameDay(String date1, String date2) → bool
Returns true if date1 and date2 represent the same UTC calendar day.
isSameMonth(String date1, String date2) → bool
Returns true if date1 and date2 represent the same UTC year and month.
isSameWeek(String date1, String date2) → bool
Returns true if date1 and date2 fall in the same Monday-start week.
isSameYear(String date1, String date2) → bool
Returns true if date1 and date2 represent the same UTC year.
isScreamingSnakeCase(String str) → bool
Returns true if str is in SCREAMING_SNAKE_CASE (e.g. FOO_BAR).
isSemVer(String str) → bool
Returns true if str is a valid Semantic Versioning string (e.g. 1.0.0, 2.1.0-alpha.1, 3.0.0+build.1).
isSlug(String str) → bool
Returns true if str is a valid URL slug (lowercase alphanumeric words separated by hyphens).
isSnakeCase(String str) → bool
Returns true if str is in snake_case format (e.g. foo_bar).
isStartOfMonth(String str) → bool
Returns true if str is the first day of its month.
isStrongPassword(String str, {int minLength = 8, int? maxLength, bool requireUppercase = true, bool requireLowercase = true, bool requireDigit = true, bool requireSpecial = true, bool allowWhitespace = false}) → bool
Returns true if str meets every enabled password-strength requirement.
isSurrogatePair(String str) → bool
Returns true if str contains surrogate pairs.
isTime(String str) → bool
Returns true if str matches 24-hour time format (HH:mm or HH:mm:ss).
isTitleCase(String str) → bool
Returns true if str is in Title Case (e.g. Foo Bar Baz).
isToday(String str) → bool
Returns true if str represents today's UTC date.
isTomorrow(String str) → bool
Returns true if str represents tomorrow's UTC date.
isULID(String str) → bool
Returns true if str is a valid 26-character Universally Unique Lexicographically Sortable Identifier (ULID).
isUpperCase(String str) → bool
Returns true if str is entirely uppercase (or has no cased characters).
isUrl(String str, {Set<String>? allowedSchemes, bool requireHost = true}) → bool
Returns true if str is a valid URL.
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.
isWithinLast(String str, Duration duration) → bool
Returns true if str is in the past and no older than duration.
isWithinNext(String str, Duration duration) → bool
Returns true if str is in the future and no further off than duration.
isYesterday(String str) → bool
Returns true if str represents yesterday's UTC date.
isZero(String str) → bool
Returns true if the numeric value of str is exactly zero.
matches(String str, String pattern) → bool
Returns true if str matches the regex pattern.
resolveConfirmPasswordValidationIssue(ConfirmPasswordValidationIssue issue) → String
Default English messages for confirm-password validation issues.
resolveDateValidationIssue(DateValidationIssue issue) → String
Default English messages for date validation issues.
resolveEmailValidationIssue(EmailValidationIssue issue) → String
Default English messages for email validation issues.
resolveIdentifierValidationIssue(IdentifierValidationIssue issue) → String
Default English messages for identifier validation issues.
resolveNetworkValidationIssue(NetworkValidationIssue issue) → String
Default English messages for network validation issues.
resolveNumberValidationIssue(NumberValidationIssue issue) → String
Default English messages for number validation issues.
resolvePasswordValidationIssue(PasswordValidationIssue issue) → String
Default English messages for password validation issues.
resolvePhoneValidationIssue(PhoneValidationIssue issue) → String
Default English messages for phone validation issues.
resolveTextValidationIssue(TextValidationIssue issue) → String
Default English messages for text validation issues.
resolveUrlValidationIssue(UrlValidationIssue issue) → String
Default English messages for URL validation issues.
startsWithIgnoreCase(String str, String prefix) → bool
Returns true if str starts with prefix, ignoring case.
tryParseDate(String str) → DateTime?
Parses str as a UTC DateTime, returning null on failure.

Typedefs

Predicate<T> = bool Function(T value)
A boolean test over a value of type T.
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.