validators library

Functions

contains(String str, dynamic seed) bool
check if the string contains the seed
equals(String str, dynamic comparison) bool
check if the string matches the comparison
isAfter(String str, [dynamic date]) bool
check if the string is a date that's after the specified date [...]
isAlpha(String str) bool
check if the string str contains only letters (a-zA-Z).
isAlphanumeric(String str) bool
check if the string str contains only letters and numbers
isAscii(String str) bool
check if the string contains ASCII chars only
isBase64(String str) bool
check if a string str is base64 encoded
isBefore(String str, [dynamic date]) bool
check if the string is a date that's before the specified date [...]
isByteLength(String str, int min, [int max]) bool
check if the string's length (in bytes) falls in a range.
isCreditCard(String str) bool
check if the string is a credit card
isDate(String str) bool
check if the string is a date
isDivisibleBy(String str, dynamic n) bool
check if the string str is a number that's divisible by another [...]
isEmail(String str) bool
check if the string str is an email
isFloat(String str) bool
check if the string str is a float
isFQDN(String str, {bool requireTld: true, bool allowUnderscores: false}) bool
check if the string str is a fully qualified domain name (e.g. domain.com). [...]
isFullWidth(String str) bool
check if the string contains any full-width chars
isHalfWidth(String str) bool
check if the string contains any half-width chars
isHexadecimal(String str) bool
check if the string stris a hexadecimal number
isHexColor(String str) bool
check if the string str is a hexadecimal color
isIn(String str, dynamic values) bool
check if the string is in a array of allowed values
isInt(String str) bool
check if the string str is an integer
isIP(String str, [dynamic version]) bool
check if the string str is IP version 4 or 6 [...]
isISBN(String str, [dynamic version]) bool
check if the string is an ISBN (version 10 or 13)
isJSON(dynamic str) bool
check if the string is valid JSON
isLength(String str, int min, [int max]) bool
check if the length of the string str falls in a range
isLowercase(String str) bool
check if the string str is lowercase
isMongoId(String str) bool
check if the string is a valid hex-encoded representation of a MongoDB ObjectId
isMultibyte(String str) bool
check if the string contains one or more multibyte chars
isNull(String str) bool
check if the string str is null
isNumeric(String str) bool
check if the string str contains only numbers
isSurrogatePair(String str) bool
check if the string contains any surrogate pairs chars
isUppercase(String str) bool
check if the string str is uppercase
isURL(String str, {List<String> protocols: const ['http', 'https', 'ftp'], bool requireTld: true, bool requireProtocol: false, bool allowUnderscore: false, List<String> hostWhitelist: const [], List<String> hostBlacklist: const []}) bool
check if the string str is a URL [...]
isUUID(String str, [dynamic version]) bool
check if the string is a UUID (version 3, 4 or 5).
isVariableWidth(String str) bool
check if the string contains a mixture of full and half-width chars
matches(String str, dynamic pattern) bool
check if string str matches the pattern.