ValidationResult class
The outcome of validating a value against a FieldValidator.
A result is considered isValid when errors is empty. When one or more rules fail, errors contains every message that was produced (useful when aggregation is enabled) while firstError always exposes the first one.
Constructors
-
ValidationResult(Iterable<
String> errors) -
Creates a result from a list of
errors. - ValidationResult.valid()
-
Creates a valid result with no errors.
const
Properties
- error → String?
-
Alias for firstError, for readability at call sites.
no setter
- errorCount → int
-
The number of failed rules.
no setter
-
errors
→ List<
String> -
The error messages produced by the failed rules, in evaluation order.
final
- firstError → String?
-
The first error message, or
nullwhen the value is valid.no setter - hashCode → int
-
The hash code for this object.
no setteroverride
- isInvalid → bool
-
Whether the validated value failed at least one rule.
no setter
- isValid → bool
-
Whether the validated value passed every rule.
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.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override