ValidationResult class

Represents the result of a validation operation.

Contains validation status, error messages, warnings, and suggestions for resolving any issues found during validation.

Constructors

ValidationResult({required bool isValid, List<ValidationError> errors = const [], List<ValidationWarning> warnings = const [], List<String> suggestions = const []})
Creates a new ValidationResult instance.
const
ValidationResult.failure({required List<ValidationError> errors, List<ValidationWarning> warnings = const [], List<String> suggestions = const []})
Creates a failed validation result.
factory
ValidationResult.singleError({required String message, String? field, ValidationErrorType? type, List<String> suggestions = const []})
Creates a validation result with a single error.
factory
ValidationResult.success({List<ValidationWarning> warnings = const [], List<String> suggestions = const []})
Creates a successful validation result.
factory

Properties

errorMessages → List<String>
Gets all error messages as a list of strings.
no setter
errors → List<ValidationError>
List of validation errors that prevent operation from proceeding.
final
hasErrors → bool
Checks if there are any validation errors.
no setter
hashCode → int
The hash code for this object.
no setteroverride
hasSuggestions → bool
Checks if there are any suggestions.
no setter
hasWarnings → bool
Checks if there are any validation warnings.
no setter
isValid → bool
Whether the validation passed successfully.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
suggestions → List<String>
List of suggestions for resolving validation issues.
final
totalIssues → int
Gets the total number of issues (errors + warnings).
no setter
warningMessages → List<String>
Gets all warning messages as a list of strings.
no setter
warnings → List<ValidationWarning>
List of validation warnings that don't prevent operation but should be noted.
final

Methods

combine(ValidationResult other) → ValidationResult
Combines this validation result with another one.
getFormattedErrors() → String
Gets a formatted string representation of all validation issues.
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