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

duration Duration?
Optional duration associated with the error messages.
final
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
validate(T value) List<String>
Validates the given value and returns a list of error messages.

Operators

operator ==(Object other) bool
The equality operator.
inherited