ActionResult class

Result returned from a route form action handler.

Encapsulates success state, optional response data, and field-level validation errors.

Example:

Future<ActionResult> handleSave(BloomRouteContext ctx) async {
  if (name.isEmpty) {
    return ActionResult.error('Validation failed', fieldErrors: {'name': ['Name required']});
  }
  return ActionResult.success({'id': 123});
}

Constructors

ActionResult.error(String message, {Map<String, List<String>> fieldErrors = const {}})
Creates a failed ActionResult with an errorMessage and optional fieldErrors.
factory
ActionResult.success([dynamic data])
Creates a successful ActionResult with optional return data.
factory

Properties

data → dynamic
Optional payload returned from successful execution.
final
errorMessage String?
Top-level error message if the action failed.
final
fieldErrors Map<String, List<String>>
Per-field validation error messages mapping field names to lists of errors.
final
hashCode int
The hash code for this object.
no setterinherited
isSuccess bool
Whether the action executed successfully.
final
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.
inherited

Operators

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