BlocxFieldValidator<T> class
abstract
Base class for field validators used in form validation.
Subclasses should implement validate to provide custom validation logic
for a specific field type T. The validate method returns a list of
error messages for the given value. An empty list indicates the value is valid.
The optional duration getter can be overridden to specify a duration for timed errors when used with TimedErrorMessage.
Example usage:
class NonEmptyValidator extends BlocxFieldValidator<String> {
@override
List<String> validate(String value) {
return value.isEmpty ? ['Field cannot be empty'] : [];
}
@override
Duration get duration => Duration(seconds: 3);
}
- Implementers
Constructors
- BlocxFieldValidator({Duration? duration})
Properties
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
validate(
T value) → List< String> -
Validates the given
valueand returns a list of error messages.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited