flutter_validators
library
Classes
-
Validator
-
A utility class for Flutter Form validation.
Provides methods that return a validator function suitable for
TextFormField.
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.