FormErrors class

Collection of validation messages keyed by form field name.

Constructors

FormErrors([Map<String, List<String>> messages = const {}])
Creates a validation error collection from normalized messages.
const
FormErrors.from(Object? value)
Creates validation errors from common error response shapes.
factory
FormErrors.fromJson(Map<String, Object?> json)
Creates validation errors from a JSON-like map.
factory

Properties

firstMessages → Map<String, String>
First validation message for each field.
no setter
hashCode → int
The hash code for this object.
no setterinherited
isEmpty → bool
Whether there are no validation messages.
no setter
isNotEmpty → bool
Whether there is at least one validation message.
no setter
messages → Map<String, List<String>>
Immutable validation messages keyed by field name.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

field(String? name) → String?
Returns the first validation message for name, if any.
fieldMessages(String? name) → List<String>
Returns all validation messages for name.
has(String? name) → bool
Whether name has at least one validation message.
merge(FormErrors other) → FormErrors
Combines this error collection with other.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, Object?>
Converts validation messages to a JSON-like map.
toString() → String
A string representation of this object.
inherited
without([List<String> keys = const []]) → FormErrors
Returns a copy without errors for keys.

Operators

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