ABUSResult class

Result of an interaction execution.

Encapsulates all information about the outcome of an interaction, including success/failure status, any returned data or payload, error messages, and execution metadata.

Example usage:

// Success result
final success = ABUSResult.success(
  data: {'user_id': 123},
  payload: user,
);

// Error result
final error = ABUSResult.error('User not found');

// Check result
if (success.isSuccess) {
  final userId = success.data?['user_id'];
  final user = success.getPayload<User>();
}

Constructors

ABUSResult.error(String error, {String? interactionId, Map<String, dynamic>? metadata})
Creates an error result.
factory
ABUSResult.fromJson(Map<String, dynamic> json)
Creates an ABUSResult from JSON data.
factory
ABUSResult.rollback({String? interactionId, Map<String, dynamic>? metadata})
Creates a rollback result.
factory
ABUSResult.success({Map<String, dynamic>? data, Object? payload, String? interactionId, Map<String, dynamic>? metadata})
Creates a successful result.
factory

Properties

data → Map<String, dynamic>?
Generic data returned from the interaction.
final
error → String?
Error message if the interaction failed.
final
hashCode → int
The hash code for this object.
no setteroverride
interactionId → String?
ID of the interaction that generated this result.
final
isSuccess → bool
Whether the interaction completed successfully.
final
metadata → Map<String, dynamic>?
Additional metadata about the execution.
final
payload → Object?
Typed payload object returned from the interaction.
final
payloadType → Type?
Gets the runtime type of the payload.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
timestamp → DateTime
Timestamp when the result was created.
final

Methods

copyWith({bool? isSuccess, Map<String, dynamic>? data, Object? payload, String? error, DateTime? timestamp, String? interactionId, Map<String, dynamic>? metadata}) → ABUSResult
Creates a copy of this result with updated values.
getPayload<T>() → T?
Gets the payload cast to a specific type.
hasPayloadType<T>() → bool
Checks if the payload is of a specific type.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, dynamic>
Converts this result to JSON format.
toString() → String
A string representation of this object.
override

Operators

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