flutter_validators library

Classes

Validator
A utility class for Flutter Form validation. Provides methods that return a validator function suitable for TextFormField.

Extensions

AlphaX on String
Extension providing alpha and alphanumeric validation methods on String.
AsciiX on String
Extension providing ASCII validation methods on String.
Base32X on String
Extension providing base32 validation methods on String.
Base58X on String
Extension providing base58 validation methods on String.
Base64X on String
Extension providing Base64 validation methods on String.
BlacklistX on String
Extension providing character filtering sanitizers on String.
BooleanX on String
Extension providing boolean validation methods on String.
ByteLengthX on String
Extension providing byte-length validation methods on String.
CreditCardX on String
Extension providing credit card validation methods on String.
DateX on String
Extension providing date validation methods on String.
DecimalX on String
Extension providing decimal validation methods on String.
EmailX on String
Extension providing email validation methods on String.
EqualX on String
Extension providing string equality methods on String.
EscapeX on String
Extension providing HTML escape sanitizers on String.
FloatX on String
Extension providing float validation methods on String.
FQDNX on String
Extension providing FQDN validation methods on String.
HexadecimalX on String
Extension providing hexadecimal validation methods on String.
HexColorX on String
Extension providing hexadecimal color validation methods on String.
IntX on String
Extension providing integer validation methods on String.
InX on String
Extension providing membership validation methods on String.
IpX on String
Extension providing IP validation methods on String.
JsonX on String
Extension providing JSON validation methods on String.
JWTX on String
Extension providing JWT validation methods on String.
LatLongX on String
Extension providing latitude/longitude validation methods on String.
LengthX on String
Extension providing length validation methods on String.
LowercaseX on String
Extension providing lowercase validation methods on String.
MACAddressX on String
Extension providing MAC address validation methods on String.
MatchesX on String
Extension providing pattern matching methods on String.
MD5X on String
Extension providing MD5 hash validation methods on String.
MongoIdX on String
Extension providing MongoDB ObjectId validation methods on String.
NormalizeEmailX on String
Extension providing email normalization on String.
NumericX on String
Extension providing numeric validation methods on String.
OctalX on String
Extension providing octal validation methods on String.
PhoneX on String
Extension providing phone number validation methods on String.
PortX on String
Extension providing port validation methods on String.
SemVerX on String
Extension providing SemVer validation methods on String.
SlugX on String
Extension providing slug validation methods on String.
StripLowX on String
Extension providing control-character stripping on String.
StrongPasswordX on String
Extension providing strong-password validation methods on String.
ToBooleanX on String
Extension providing boolean conversion on String.
ToNumberX on String
Extension providing numeric and date conversions on String.
TrimX on String
Extension providing trimming sanitizers on String.
UppercaseX on String
Extension providing uppercase validation methods on String.
UrlX on String
Extension providing URL validation methods on String.
UuidX on String
Extension providing UUID validation methods on String.

Functions

blacklist(String str, String chars) → String
Removes all characters that appear in chars from the string.
contains(String str, String seed, {bool ignoreCase = false, int minOccurrences = 1}) → bool
Checks if the string contains the seed substring.
equals(String str, String comparison) → bool
Checks if two strings are exactly equal.
escape(String str) → String
Replaces HTML-unsafe characters with their entity equivalents.
isAlpha(String str) → bool
Checks if the string contains only letters (a-z, A-Z).
isAlphanumeric(String str) → bool
Checks if the string contains only letters and numbers.
isAscii(String str) → bool
Checks if the string contains only ASCII characters.
isBase32(String str) → bool
Checks if the string is base32 encoded.
isBase58(String str) → bool
Checks if the string is base58 encoded.
isBase64(String str, {bool urlSafe = false}) → bool
Checks if the string is Base64 encoded.
isBoolean(String str) → bool
Checks if the string represents a boolean value.
isByteLength(String str, int min, [int? max]) → bool
Checks if the string's UTF-8 byte length falls in a range.
isCreditCard(String str) → bool
Checks if the string is a valid credit card number.
isDate(String str) → bool
Checks if the string represents a valid calendar date.
isDecimal(String str) → bool
Checks if the string represents a decimal number.
isEmail(String str) → bool
Checks if the string is a valid email address.
isFloat(String str, {double? min, double? max}) → bool
Checks if the string represents a finite floating-point number.
isFQDN(String str) → bool
Checks if the string is a fully qualified domain name (FQDN).
isHexadecimal(String str) → bool
Checks if the string is a hexadecimal number.
isHexColor(String str) → bool
Checks if the string is a hexadecimal color.
isIn(String str, Iterable<String> values) → bool
Checks if the string is one of the values.
isInt(String str) → bool
Checks if the string represents a decimal integer.
isIP(String str, [int? version]) → bool
Checks if the string is a valid IP address (IPv4 or IPv6).
isJson(String str) → bool
Checks if the string is valid JSON.
isJWT(String str) → bool
Checks if the string is a valid JSON Web Token (JWT).
isLatLong(String str) → bool
Checks if the string is a valid latitude,longitude pair.
isLength(String str, int min, [int? max]) → bool
Checks if the string's length falls in a range.
isLowercase(String str) → bool
Checks if the string is entirely lowercase.
isMACAddress(String str) → bool
Checks if the string is a valid MAC address.
isMD5(String str) → bool
Checks if the string is a valid MD5 hash.
isMongoId(String str) → bool
Checks if the string is a valid MongoDB ObjectId.
isNumeric(String str) → bool
Checks if the string represents a valid number.
isOctal(String str) → bool
Checks if the string is an octal number.
isPhone(String str) → bool
Checks if the string is a valid phone number.
isPort(String str) → bool
Checks if the string is a valid port number.
isSemVer(String str) → bool
Checks if the string is a valid Semantic Version (SemVer).
isSlug(String str) → bool
Checks if the string is a valid URL slug.
isStrongPassword(String str, {int minLength = 8, int minLowercase = 1, int minUppercase = 1, int minNumbers = 1, int minSymbols = 1}) → bool
Checks if the string is a strong password.
isUppercase(String str) → bool
Checks if the string is entirely uppercase.
isURL(String str) → bool
Checks if the string is a valid HTTP or HTTPS URL.
isUUID(String str) → bool
Checks if the string is a valid UUID (versions 1, 3, 4, or 5).
ltrim(String str, [String? chars]) → String
Removes the given chars from the start of the string.
matches(String str, Pattern pattern) → bool
Checks if the string matches the given pattern.
normalizeEmail(String str) → String?
Canonicalizes an email address.
rtrim(String str, [String? chars]) → String
Removes the given chars from the end of the string.
stripLow(String str, {bool keepNewLines = false}) → String
Removes control characters from the string.
toBoolean(String str, {bool strict = false}) → bool
Converts the string to a boolean.
toDate(String str) → DateTime?
Converts the string to a DateTime.
toFloat(String str) → double?
Converts the string to a double.
toInt(String str, {int? radix}) → int?
Converts the string to an integer.
trim(String str, [String? chars]) → String
Removes the given chars from both ends of the string.
unescape(String str) → String
Converts HTML entities back into their unsafe character equivalents.
whitelist(String str, String chars) → String
Removes all characters that do not appear in chars from the string.