StringValidation extension

A vast collection of validation utilities mapped as getters on String.

on

Properties

isValidCreditCard → bool

Available on String, provided by the StringValidation extension

Checks if the string is a valid credit card number using the Luhn algorithm.
no setter
isValidE164Phone → bool

Available on String, provided by the StringValidation extension

Validates against E.164 format: + followed by 7–15 digits, no spaces.
no setter
isValidEmail → bool

Available on String, provided by the StringValidation extension

RFC-5321-aligned. Handles subdomains, hyphens, multi-part TLDs. Still a heuristic — true validation requires sending a mail.
no setter
isValidHexColor → bool

Available on String, provided by the StringValidation extension

Checks if the string is a valid hexadecimal color (e.g. #FFF or #FFFFFF).
no setter
isValidIpv4 → bool

Available on String, provided by the StringValidation extension

Checks if the string is a valid IPv4 address.
no setter
isValidIsoDate → bool

Available on String, provided by the StringValidation extension

ISO 8601 date only: 2024-01-31
no setter
isValidName → bool

Available on String, provided by the StringValidation extension

Accepts Unicode letters, spaces, hyphens, apostrophes, periods. Single names (mononyms) are valid. Max 100 chars guards against abuse.
no setter
isValidPassword → bool

Available on String, provided by the StringValidation extension

At least 8 chars, one uppercase, one lowercase, one digit, one non-alphanumeric character (any — not a fixed whitelist).
no setter
isValidPhone → bool

Available on String, provided by the StringValidation extension

Strips formatting then checks for 7–15 digits (ITU-T E.164 range). Does NOT enforce country-specific formats — use a package like phone_numbers_parser when you need locale validation.
no setter
isValidUrl → bool

Available on String, provided by the StringValidation extension

Valid URL (http/https). Intentionally simple — use Uri.tryParse for structural checks; this validates the common displayed format.
no setter
isValidUuid → bool

Available on String, provided by the StringValidation extension

Checks if the string is a valid UUID (v4).
no setter
passwordStrength → PasswordStrength

Available on String, provided by the StringValidation extension

Returns which password requirements are unmet — useful for live UI feedback.
no setter

Methods

isWithinLength({required int min, required int max}) → bool

Available on String, provided by the StringValidation extension

Length bounded — prevents silent acceptance of huge inputs.