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
trueifstrcontainsseed. -
containsIgnoreCase(
String str, String seed) → bool -
Returns
trueifstrcontainsseed, ignoring case. -
endsWithIgnoreCase(
String str, String suffix) → bool -
Returns
trueifstrends withsuffix, ignoring case. -
equals(
String? str, String comparison) → bool -
Returns
trueifstrequalscomparison. -
hasWhitespace(
String str) → bool -
Returns
trueifstrcontains at least one whitespace character. -
isAfter(
String str, [String? reference]) → bool -
Returns
trueifstrrepresents a date afterreference. -
isAgeAtLeast(
String str, int years) → bool -
Returns
trueif a birth date ofstrmeans an age of at leastyearsas of today (UTC). -
isAlpha(
String str) → bool -
Returns
trueifstrcontains only ASCII alphabetic characters (a–z, A–Z). -
isAlphaNumeric(
String str) → bool -
Returns
trueifstrcontains only ASCII alphanumeric characters (a–z, A–Z, 0–9). -
isAnagram(
String str, String other, {bool ignoreCase = true, bool ignoreNonAlphanumeric = true}) → bool -
Returns
trueifstrandotherare anagrams of one another. -
isAscii(
String str) → bool -
Returns
trueifstrcontains only printable ASCII characters (U+0000–U+007F). -
isBase32(
String str) → bool -
Returns
trueifstris a valid Base32-encoded string (RFC 4648). -
isBase64(
String str) → bool -
Returns
trueifstris a valid Base64-encoded string. -
isBefore(
String str, [String? reference]) → bool -
Returns
trueifstrrepresents a date beforereference. -
isBetween(
String str, String from, String to) → bool -
Returns
trueifstrrepresents a date strictly betweenfromandto. -
isBetweenInclusive(
String str, String from, String to) → bool -
Returns
trueifstrfalls betweenfromandto, bounds included. -
isBic(
String str) → bool -
Returns
trueifstris a valid BIC/SWIFT code (ISO 9362). -
isBinary(
String str) → bool -
Returns
trueifstrcontains only binary digits (0and1). -
isBlank(
String? str) → bool -
Returns
trueifstrisnull, empty, or consists only of whitespace. -
isByteLength(
String str, int min, [int? max]) → bool -
Returns
trueifstrbyte-length is within`min`, `max`. -
isCamelCase(
String str) → bool -
Returns
trueifstris in camelCase format (e.g.fooBar). -
isCapitalized(
String str) → bool -
Returns
trueifstrstarts with an uppercase letter. -
isCidr(
String str, [int? version]) → bool -
Returns
trueifstris a valid CIDR notation. -
isCreditCard(
String str) → bool -
Returns
trueifstris a valid credit card number (Luhn check). -
isDataURI(
String str) → bool -
Returns
trueifstris a valid Data URI scheme (RFC 2397). -
isDate(
String str) → bool -
Returns
trueifstris a parseable date string. -
isDecimal(
String str, {int? places}) → bool -
Returns
trueifstris a decimal number, optionally with exactlyplacesdigits after the point. -
isDivisibleBy(
String str, String n) → bool -
Returns
trueif the numeric value ofstris divisible byn. -
isEAN(
String str, [String? version]) → bool -
Returns
trueifstris a valid EAN-8 or EAN-13 barcode number with valid checksum. -
isEmail(
String str) → bool -
Returns
trueifstrmatches the RFC 5322 email format heuristic. -
isEndOfMonth(
String str) → bool -
Returns
trueifstris the last day of its month. -
isEven(
String str) → bool -
Returns
trueifstrrepresents an even integer. -
isFloat(
String str) → bool -
Returns
trueifstrrepresents a floating-point number. -
isFQDN(
String str, {bool requireTld = true, bool allowUnderscores = false}) → bool -
Returns
trueifstris a valid fully-qualified domain name. -
isFullWidth(
String str) → bool -
Returns
trueifstrcontains full-width Unicode characters. -
isFuture(
String str) → bool -
Returns
trueifstrrepresents a date in the future. -
isHalfWidth(
String str) → bool -
Returns
trueifstrcontains half-width Unicode characters. -
isHash(
String str, String algorithm) → bool -
Returns
trueifstris a valid hash string foralgorithm(e.g.'md5','sha1','sha256','sha512'). -
isHexadecimal(
String str) → bool -
Returns
trueifstris a valid hexadecimal string. -
isHexColor(
String str) → bool -
Returns
trueifstris a valid hex color (e.g.#FFFor#FFFFFF). -
isHostname(
String str) → bool -
Returns
trueifstris a valid hostname label sequence (RFC 1123). -
isHslColor(
String str) → bool -
Returns
trueifstris a CSShsl()orhsla()color with saturation and lightness in 0–100%. -
isIban(
String str) → bool -
Returns
trueifstris a valid IBAN, by ISO 13616 mod-97 checksum. -
isIMEI(
String str) → bool -
Returns
trueifstris a valid 15-digit International Mobile Equipment Identity (IMEI) number. -
isInRange(
String str, num min, num max) → bool -
Returns
trueif the numeric value ofstris within`min`, `max`(inclusive). -
isInt(
String str) → bool -
Returns
trueifstrrepresents an integer. -
isIP(
String str, [int? version]) → bool -
Returns
trueifstris a valid IP address. -
isIpv4(
String str) → bool -
Returns
trueifstris a valid IPv4 address. -
isIpv6(
String str) → bool -
Returns
trueifstris a valid IPv6 address. -
isISBN(
String? str, [String? version]) → bool -
Returns
trueifstris a valid ISBN-10 or ISBN-13. -
isIso8601(
String str) → bool -
Returns
trueifstris a full ISO 8601 date or date-time. -
isJson(
String str) → bool -
Returns
trueifstris valid JSON. -
isJwt(
String str) → bool -
Returns
trueifstrmatches JSON Web Token (JWT) format structure. -
isKebabCase(
String str) → bool -
Returns
trueifstris in kebab-case format (e.g.foo-bar). -
isLatitude(
String str) → bool -
Returns
trueifstris a latitude in the range -90 to 90. -
isLatLong(
String str) → bool -
Returns
trueifstris alatitude,longitudepair (e.g.11.55,104.91). -
isLeapYear(
String str) → bool -
Returns
trueifstrrepresents a date in a leap year. -
isLength(
String str, int min, [int? max]) → bool -
Returns
trueif the display-length ofstris within`min`, `max`, counting surrogate pairs as single characters. -
isLongitude(
String str) → bool -
Returns
trueifstris a longitude in the range -180 to 180. -
isLoopbackIpv4(
String str) → bool -
Returns
trueifstris an IPv4 loopback address (127.0.0.0/8). -
isLowerCase(
String str) → bool -
Returns
trueifstris entirely lowercase (or has no cased characters). -
isLuhnValid(
String str) → bool -
Returns
trueifstrpasses the Luhn checksum algorithm. -
isMacAddress(
String str) → bool -
Returns
trueifstris a valid MAC address (e.g.00:1A:2B:3C:4D:5E,00-1A-2B-3C-4D-5E, or001A.2B3C.4D5E). -
isMagnetURI(
String str) → bool -
Returns
trueifstris a valid BitTorrent Magnet URI. -
isMimeType(
String str) → bool -
Returns
trueifstris a valid MIME type format (e.g.application/json). -
isMongoId(
String str) → bool -
Returns
trueifstris a valid 24-character MongoDB ObjectId (hex). -
isMultiByte(
String str) → bool -
Returns
trueifstrcontains multi-byte (non-ASCII) characters. -
isNanoId(
String str, [int expectedLength = 21]) → bool -
Returns
trueifstrmatches a Nano ID format of lengthexpectedLength(default: 21). -
isNegative(
String str) → bool -
Returns
trueif the numeric value ofstris less than zero. -
isNotBlank(
String? str) → bool -
Returns
trueifstris notnulland contains non-whitespace characters. -
isNullOrEmpty(
String? str) → bool -
Returns
trueifstrisnullor empty. -
isNumeric(
String str) → bool -
Returns
trueifstrcontains only numeric digits (optionally negative). -
isOctal(
String str) → bool -
Returns
trueifstrcontains only octal digits (0–7). -
isOdd(
String str) → bool -
Returns
trueifstrrepresents an odd integer. -
isPalindrome(
String str, {bool ignoreCase = true, bool ignoreNonAlphanumeric = true}) → bool -
Returns
trueifstrreads the same forwards and backwards. -
isPascalCase(
String str) → bool -
Returns
trueifstris in PascalCase format (e.g.FooBar). -
isPast(
String str) → bool -
Returns
trueifstrrepresents a date in the past. -
isPhoneNumber(
String str, {bool requirePlusPrefix = false}) → bool -
Returns
trueifstris a valid phone number. -
isPort(
String str) → bool -
Returns
trueifstris a valid network port number (1–65535). -
isPositive(
String str) → bool -
Returns
trueif the numeric value ofstris greater than zero. -
isPostalCode(
String? text, String locale, {bool orElse()?}) → bool -
Returns
trueiftextis a valid postal code forlocale. -
isPrime(
int n) → bool -
Returns
trueifnis a prime integer. -
isPrimeString(
String str) → bool -
Returns
trueifstrrepresents a prime integer. -
isPrintable(
String str) → bool -
Returns
trueifstrcontains only printable ASCII, tab, newline or carriage return. -
isPrivateIpv4(
String str) → bool -
Returns
trueifstris an IPv4 address in a private range (RFC 1918). -
isPublicIpv4(
String str) → bool -
Returns
trueifstris an IPv4 address that is routable on the public internet. -
isRgbColor(
String str) → bool -
Returns
trueifstris a CSSrgb()orrgba()color with every channel in 0–255. -
isSameDay(
String date1, String date2) → bool -
Returns
trueifdate1anddate2represent the same UTC calendar day. -
isSameMonth(
String date1, String date2) → bool -
Returns
trueifdate1anddate2represent the same UTC year and month. -
isSameWeek(
String date1, String date2) → bool -
Returns
trueifdate1anddate2fall in the same Monday-start week. -
isSameYear(
String date1, String date2) → bool -
Returns
trueifdate1anddate2represent the same UTC year. -
isScreamingSnakeCase(
String str) → bool -
Returns
trueifstris in SCREAMING_SNAKE_CASE (e.g.FOO_BAR). -
isSemVer(
String str) → bool -
Returns
trueifstris 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
trueifstris a valid URL slug (lowercase alphanumeric words separated by hyphens). -
isSnakeCase(
String str) → bool -
Returns
trueifstris in snake_case format (e.g.foo_bar). -
isStartOfMonth(
String str) → bool -
Returns
trueifstris 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
trueifstrmeets every enabled password-strength requirement. -
isSurrogatePair(
String str) → bool -
Returns
trueifstrcontains surrogate pairs. -
isTime(
String str) → bool -
Returns
trueifstrmatches 24-hour time format (HH:mmorHH:mm:ss). -
isTitleCase(
String str) → bool -
Returns
trueifstris in Title Case (e.g.Foo Bar Baz). -
isToday(
String str) → bool -
Returns
trueifstrrepresents today's UTC date. -
isTomorrow(
String str) → bool -
Returns
trueifstrrepresents tomorrow's UTC date. -
isULID(
String str) → bool -
Returns
trueifstris a valid 26-character Universally Unique Lexicographically Sortable Identifier (ULID). -
isUpperCase(
String str) → bool -
Returns
trueifstris entirely uppercase (or has no cased characters). -
isUrl(
String str, {Set< String> ? allowedSchemes, bool requireHost = true}) → bool -
Returns
trueifstris a valid URL. -
isUuid(
String? str, [String? version]) → bool -
Returns
trueifstris a valid UUID (any version by default). -
isVariableWidth(
String str) → bool -
Returns
trueifstrcontains both full-width and half-width characters. -
isWeekday(
String str) → bool -
Returns
trueifstrrepresents a Monday–Friday. -
isWeekend(
String str) → bool -
Returns
trueifstrrepresents a Saturday or Sunday. -
isWithinLast(
String str, Duration duration) → bool -
Returns
trueifstris in the past and no older thanduration. -
isWithinNext(
String str, Duration duration) → bool -
Returns
trueifstris in the future and no further off thanduration. -
isYesterday(
String str) → bool -
Returns
trueifstrrepresents yesterday's UTC date. -
isZero(
String str) → bool -
Returns
trueif the numeric value ofstris exactly zero. -
matches(
String str, String pattern) → bool -
Returns
trueifstrmatches the regexpattern. -
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
trueifstrstarts withprefix, ignoring case. -
tryParseDate(
String str) → DateTime? -
Parses
stras a UTC DateTime, returningnullon 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.