ValidationError class final

Inheritance
Available extensions

Constructors

ValidationError({required Map<String, List<String>> fields, String? message})
const

Properties

allMessages List<String>
Flat list of all validation messages across all fields
no setter
fields Map<String, List<String>>
Field-level validation messages, e.g. {'email': 'Invalid format'}
final
hashCode int
The hash code for this object.
no setterinherited
isAuthError bool

Available on ApiError, provided by the ApiErrorX extension

True for auth errors (401 / 403)
no setter
isClientError bool

Available on ApiError, provided by the ApiErrorX extension

True for any 4xx client error
no setter
isNetworkRelated bool

Available on ApiError, provided by the ApiErrorX extension

True for any connectivity-related error (NetworkError, TimeoutError, BadCertificateError, CancelledError)
no setter
isServerError bool

Available on ApiError, provided by the ApiErrorX extension

True for any 5xx server error
no setter
message String
Human-readable description of the error
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

fieldMessage(String field) String?
First message for a specific field, or null
maybeWhen<R>({R network(NetworkError e)?, R timeout(TimeoutError e)?, R badCertificate(BadCertificateError e)?, R cancelled(CancelledError e)?, R unauthorized(UnauthorizedError e)?, R forbidden(ForbiddenError e)?, R badRequest(BadRequestError e)?, R notFound(NotFoundError e)?, R methodNotAllowed(MethodNotAllowedError e)?, R conflict(ConflictError e)?, R validation(ValidationError e)?, R server(ServerError e)?, R app(AppError e)?, R unknown(UnknownError e)?, required R orElse(ApiError e)}) → R

Available on ApiError, provided by the ApiErrorX extension

Partial match — handle what you care about, delegate the rest
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override
when<R>({required R network(NetworkError e), required R timeout(TimeoutError e), required R badCertificate(BadCertificateError e), required R cancelled(CancelledError e), required R unauthorized(UnauthorizedError e), required R forbidden(ForbiddenError e), required R badRequest(BadRequestError e), required R notFound(NotFoundError e), required R methodNotAllowed(MethodNotAllowedError e), required R conflict(ConflictError e), required R validation(ValidationError e), required R server(ServerError e), required R app(AppError e), required R unknown(UnknownError e)}) → R

Available on ApiError, provided by the ApiErrorX extension

Exhaustive pattern-match helper

Operators

operator ==(Object other) bool
The equality operator.
inherited