Validators class
Comprehensive form validation utilities.
All methods are static and return String? where:
nullmeans validation passedStringmeans validation failed (error message)
The class cannot be instantiated.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
alphabetic(
String? value, {String? message}) → String? - Validates alphabetic characters only
-
alphanumeric(
String? value, {String? message}) → String? - Validates alphanumeric characters only
-
combine(
List< String? Function(String?)> validators) → String? Function(String?) - Combines multiple validators
-
creditCard(
String? value, {String? message}) → String? - Validates credit card number (Luhn algorithm)
-
date(
String? value, {String? message}) → String? - Validates date format
-
email(
String? value, {String? message}) → String? - Validates email format
-
exactLength(
String? value, int length, {String? message}) → String? - Validates that the value has exact length
-
futureDate(
String? value, {String? message}) → String? - Validates that date is in the future
-
integer(
String? value, {String? message}) → String? - Validates integer value
-
lengthBetween(
String? value, int min, int max, {String? message}) → String? - Validates that the value length is between min and max
-
match(
String? value, String? otherValue, {String? message}) → String? - Validates that two values match
-
maxLength(
String? value, int maxLength, {String? message}) → String? - Validates that the value has maximum length
-
maxValue(
String? value, num max, {String? message}) → String? - Validates that a numeric value is less than a maximum
-
minLength(
String? value, int minLength, {String? message}) → String? - Validates that the value has minimum length
-
minValue(
String? value, num min, {String? message}) → String? - Validates that a numeric value is greater than a minimum
-
notEqual(
String? value, String? otherValue, {String? message}) → String? - Validates that the value is not equal to another value
-
numeric(
String? value, {String? message}) → String? - Validates numeric value
-
numericOnly(
String? value, {String? message}) → String? - Validates numeric characters only
-
password(
String? value, {String? message}) → String? - Validates password strength
-
passwordWithRequirements(
String? value, {int minLength = 8, bool requireUppercase = false, bool requireLowercase = false, bool requireNumber = false, bool requireSpecial = false, String? message}) → String? - Validates password with custom requirements
-
pastDate(
String? value, {String? message}) → String? - Validates that date is in the past
-
pattern(
String? value, RegExp pattern, {String? message}) → String? - Validates that the value matches a pattern
-
phone(
String? value, {String? message}) → String? - Validates phone number format
-
range(
String? value, num min, num max, {String? message}) → String? - Validates that a numeric value is between min and max
-
required(
String? value, {String? message}) → String? - Validates that the value is not empty
-
url(
String? value, {String? message}) → String? - Validates URL format