FormResult<T> class

Generic result wrapper for form operations.

The fromJson factory requires a converter function to deserialize the generic data field.

Constructors

FormResult({required bool success, T? data, FormError? error, List<FormError>? warnings})
const
FormResult.fail(FormError error)
Create a failed result.
const
FormResult.fromJson(Map<String, dynamic> json, T dataFromJson(Map<String, dynamic>))
Create from JSON with a converter for the generic data field.
factory
FormResult.ok(T data)
Create a successful result.
const

Properties

data → T?
Result data on success.
final
error → FormError?
Error details on failure.
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
success → bool
Whether the operation succeeded.
final
warnings → List<FormError>?
Optional warnings from the operation.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson([Map<String, dynamic> dataToJson(T)?]) → Map<String, dynamic>
Convert to JSON.
toString() → String
A string representation of this object.
inherited

Operators

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