CorextraValidatable mixin
Adds a validation result to a class, using the checks you write once in validate.
Example:
class SignUpForm with CorextraValidatable {
SignUpForm(this.name, this.email);
final String? name;
final String? email;
@override
Map<String, String?> validate() => {
'name': FormValidators.required(name),
'email': FormValidators.email(email),
};
}
final result = form.validation;
if (!result.isValid) showError(result.firstError);
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- validation → CorextraValidationResult
-
Runs validate and returns which fields failed and why.
no setter
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(
) → Map< String, String?> -
Each field's error message, or null when it's valid;
FormValidatorsfit here directly.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited