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
trueifstrcontainsseed. -
containsIgnoreCase(
String str, String seed) → bool -
Returns
trueifstrcontainsseed, ignoring case. -
equals(
String? str, String comparison) → bool -
Returns
trueifstrequalscomparison. -
isAfter(
String str, [String? reference]) → bool -
Returns
trueifstrrepresents a date afterreference. -
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). -
isAscii(
String str) → bool -
Returns
trueifstrcontains only printable ASCII characters (U+0000–U+007F). -
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. -
isByteLength(
String str, int min, [int? max]) → bool -
Returns
trueifstrbyte-length is within`min`, `max`. -
isCreditCard(
String str) → bool -
Returns
trueifstris a valid credit card number (Luhn check). -
isDate(
String str) → bool -
Returns
trueifstris a parseable date string. -
isDivisibleBy(
String str, String n) → bool -
Returns
trueif the numeric value ofstris divisible byn. -
isEmail(
String str) → bool -
Returns
trueifstrmatches the RFC 5322 email format heuristic. -
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. -
isHexadecimal(
String str) → bool -
Returns
trueifstris a valid hexadecimal string. -
isHexColor(
String str) → bool -
Returns
trueifstris a valid hex color (e.g.#FFFor#FFFFFF). -
isInt(
String str) → bool -
Returns
trueifstrrepresents an integer. -
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. -
isJson(
String str) → bool -
Returns
trueifstris valid JSON. -
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. -
isLowerCase(
String str) → bool -
Returns
trueifstris entirely lowercase (or has no cased characters). -
isMongoId(
String str) → bool -
Returns
trueifstris a valid 24-character MongoDB ObjectId (hex). -
isMultiByte(
String str) → bool -
Returns
trueifstrcontains multi-byte (non-ASCII) characters. -
isNull(
String? str) → bool -
Returns
trueifstrisnullor empty. -
isNullOrEmpty(
String? str) → bool -
Returns
trueifstrisnullor empty. -
isNumeric(
String str) → bool -
Returns
trueifstrcontains only numeric digits (optionally negative). -
isPast(
String str) → bool -
Returns
trueifstrrepresents a date in the past. -
isPostalCode(
String? text, String locale, {bool orElse()?}) → bool -
Returns
trueiftextis a valid postal code forlocale. -
isSurrogatePair(
String str) → bool -
Returns
trueifstrcontains surrogate pairs. -
isToday(
String str) → bool -
Returns
trueifstrrepresents today's UTC date. -
isUpperCase(
String str) → bool -
Returns
trueifstris entirely uppercase (or has no cased characters). -
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. -
matches(
String str, String pattern) → bool -
Returns
trueifstrmatches the regexpattern. -
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
stras a UTC DateTime, returningnullon 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.