validated
library
Functions
blacklist (String str , String chars )
→ String
remove characters that appear in the blacklist.
contains (String string , String find )
→ bool
Check if find
is contained in string
escape (String str )
→ String
replace <
, >
, &
, '
and "
with HTML entities
isAlpha (String input )
→ bool
check if the string input
contains only letters (a-zA-Z).
isAlphanumeric (String input )
→ bool
check if the string input
contains only letters and numbers
isAscii (String input )
→ bool
check if the string contains ASCII chars only
isBase32 (String input )
→ bool
check if a string input
is base32 encoded
isBase64 (String input )
→ bool
check if a string input
is base64 encoded
isBoolean (dynamic input )
→ bool
check if a string input
represents boolean value like true , false , 0 , 1
isByteLength (String str , {dynamic min = 0 , dynamic max })
→ bool
check if the string's length (in bytes) falls in a range.
isCapitalized (String input )
→ bool
Check if string input
is capitalized
isCreditCard (String input )
→ bool
Check if string input
is a credit card or not
isCurrency (String input , {dynamic symbol = '\$' , dynamic require_symbol = false , dynamic allow_space_after_symbol = false , dynamic symbol_after_digits = false , dynamic allow_negatives = true , dynamic parens_for_negatives = false , dynamic negative_sign_before_digits = false , dynamic negative_sign_after_digits = false , dynamic allow_negative_sign_placeholder = false , dynamic thousands_separator = ',' , dynamic decimal_separator = '.' , dynamic allow_decimal = true , dynamic require_decimal = false , dynamic digits_after_decimal = const [2] , dynamic allow_space_after_digits = false })
→ bool
Check if string input
is a currency
optional params
symbol
= "$"
require_symbol
= false
allow_space_after_symbol
= false
symbol_after_digits
= false
allow_negatives
= true
parens_for_negatives
= false
negative_sign_before_digits
= false
negative_sign_after_digits
= fasle
allow_negative_sign_placeholder
= false
thousands_separator
= ','
decimal_separator
= '.'
allow_decimal
= true
require_decimal
= false
digits_after_decimal
= const 2
allow_space_after_digits
= false
isDataURI (String input )
→ bool
check if string input
is a data uri
isDivisibleBy (String str , dynamic n )
→ bool
check if the string str
is a number that's divisible by another
isEmail (String input )
→ bool
Check if string input
is an email
isEmoji (String input )
→ bool
Takes an input (an emoji) for validation
isFloat (String str )
→ bool
check if the string str
is a float
isFQDN (dynamic input , [dynamic options ])
→ bool
check if the string input
is a fully qualified domain name (e.g. domain.com).
isFullWidth (String input )
→ bool
check if the string contains any full-width chars
isHalfWidth (String input )
→ bool
check if the string contains any half-width chars
isHash (String input , String algorithmName )
→ bool
check if the string input
is a hash
available algoritms for string algorithmName
param
md5
md4
sha1
sha256
sha384
sha512
ripemd128
ripemd160
tiger128
tiger160
tiger192
crc32
crc32b
isHexadecimal (String input )
→ bool
check if the string input
is a hexadecimal number
isHexColor (String input )
→ bool
check if the string input
is a hexadecimal color
isIP (String str , [dynamic version ])
→ bool
check if the string str
is IP version
4 or 6
isIPRange (String input )
→ bool
check if the string str
falls in an IP range
isISBN (String input , [dynamic version ])
→ bool
check if the string input
is an ISBN (version 10 or 13)
isISIN (String input )
→ bool
check if the string input
is an ISIN
isJSON (String input )
→ bool
check if string input
is json (stringyfied)
isJWT (String input )
→ bool
check if string input
is a JWT token
isLatLong (String input )
→ bool
check if string input
is a latlong
isLength (String input , int min , [int ? max ])
→ bool
check if the length of the string input
falls in a range
isLowercase (String input )
→ bool
check if string input
is lowercased
isMACAddress (String input , {dynamic no_colons })
→ bool
Check if string input
is a MAC Adress
no_colons
is an optional param
isMagnetURI (String input )
→ bool
check if string input
is a magnet URI
isMD5 (String input )
→ bool
check if string input
is a md5 hash
also use isHash for more algorithms
isMongoID (String input )
→ bool
check if string input
is a mongo ID
isMultibyte (String input )
→ bool
check if the string contains one or more multibyte chars
isNull (String input )
→ bool
check if the string input
is null
isNumeric (String input , {bool no_symbols = false })
→ bool
check if the string input
contains only numbers
isSameType (dynamic obj1 , dynamic obj2 )
→ bool
Check if Object1 obj1
is same as Object2 obj2
it might return false in many cases
isUpperCase (String input )
→ bool
check if string input
is uppercased
isURL (String input , [Map ? options ])
→ bool
check if the string input
is a URL
isUUID (String input , [String version = 'all' ])
→ bool
check if string input
is an UUID (version 3, 4 or 5
version is an optional positioned param
pass String value for version
version
expected values -> '3', '4', '5', 'all'
by default 'all' is used
isVariableWidth (String input )
→ bool
check if the string contains a mixture of full and half-width chars
isWhitelisted (String string , dynamic chars )
→ bool
check if string string
is whitelisted
pass down chars
@required
ltrim (String str , [String ? chars ])
→ String
trim characters from the left-side of the input
normalizeEmail (String email , [Map ? options ])
→ String
canonicalize an email address.
rtrim (String str , [String ? chars ])
→ String
trim characters from the right-side of the input
stripLow (String str , [bool keep_new_lines = false ])
→ String
remove characters with a numerical value < 32 and 127.
toBoolean (String str , [bool strict = false ])
→ bool
convert the input to a boolean.
toDate (String str )
→ DateTime ?
convert the input to a date, or null if the input is not a date
toDouble (String str )
→ double
convert the input to a float, or NAN if the input is not a float
toFloat (String str )
→ double
convert the input to a float, or NAN if the input is not a float
toInt (String str , {int radix = 10 })
→ num
convert the input to an integer, or NAN if the input is not an integer
toString (dynamic input )
→ String
convert the input to a string
trim (String str , [String ? chars ])
→ String
trim characters (whitespace by default) from both sides of the input
whitelist (String str , String chars )
→ String
remove characters that do not appear in the whitelist.