Validator class

A utility class for validating form input fields using predefined rules.

Constructors

Validator()

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

combine(List<String? Function(String?)> validators) → String? Function(String?)
Combines multiple validators into a single validator.
email([String message = 'Enter a valid email']) → String? Function(String?)
Returns a validator that checks whether a field is a valid email.
match(String valueToMatch, [String? message]) → String? Function(String?)
Returns a validator that checks whether a field matches another field's value.
maxLength(int max, [String? message]) → String? Function(String?)
Returns a validator that checks whether a field has a maximum length.
minLength(int min, [String? message]) → String? Function(String?)
Returns a validator that checks whether a field has a minimum length.
required([String message = 'This field is required']) → String? Function(String?)
Returns a validator that checks whether a field is not empty.