Validator<T, U> class
abstract
A validator has rules which a value will be validated against
T
being the type of the value you are validating against.
U
being the type of your negative feedback.
class NameValidator extends Validator<String, String> {
@override
List<ValidationRule<String, String>> get rules => [
ValidationRule(
ruler: (value) => value.isNotEmpty,
negativeFeedback: "Name can't be empty."),
ValidationRule(
ruler: (value) => value.length <= 20,
negativeFeedback: "Name can't be more than 20 characters.")
];
}
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
rules
→ List<
ValidationRule< T, U> > -
no setter
- 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) → ValidationResult< U>
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited