ValidationException class
An exception that is thrown when validation fails.
Contains a map of validation errors, where each key is the field name and the value is a list of error messages for that field.
Example:
try {
await Validator.validate(data, {
"email": "required|email",
});
} on ValidationException catch (e) {
Log.debug(e.errors); // { "email": ["The email field is required."] }
}
- Inheritance
-
- Object
- BaseException
- ValidationException
- Implementers
Constructors
-
ValidationException(Map<
String, List< errors, {dynamic message, int code = HttpStatus.unprocessableEntity})String> > -
Creates a ValidationException with the given
errors.
Properties
- code → int
-
finalinherited
-
errors
→ Map<
String, List< String> > -
The map of validation errors.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- message → dynamic
-
finalinherited
- responseType → RespondType
-
finalinherited
- 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.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited