tools/validation/validator library

Functions

contains(String str, dynamic substring) bool
check if the string contains the substring
convertFormatDate({String? formatToSave, String? formatToDisplay, String? valueDate}) String
equals(String str, dynamic comparison) bool
check if the string matches the comparison
hasValidUrl(String value) bool
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 contains only letters (a-zA-Z).
isAlphanumeric(String str) bool
check if the string contains only letters and numbers
isAscii(String str) bool
check if the string contains ASCII chars only
isAssetFileExists(String filePath) Future<bool>
isBase64(String str) bool
check if a string 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 is a number that's divisible by another
isEmail(String str) bool
check if the string is an email
isFloat(String str) bool
check if the string is a float
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 is a hexadecimal number
isHexColor(String str) bool
check if the string is a hexadecimal color
isIn(String str, dynamic values) bool
check if the string is in an array of allowed values
isInt(String str) bool
check if the string is an integer
isIP(String str, [dynamic version]) bool
check if the string is an 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 string's length falls in a range If no max is given then any length above min is ok.
isLowercase(String str) bool
check if the string 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
isNumeric(String str) bool
check if the string contains only numbers
isSurrogatePair(String str) bool
check if the string contains any surrogate pairs chars
isUppercase(String str) bool
check if the string is uppercase
isUrl(String url) bool
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 matches the pattern.