ClassInteraction<T> class

Class-based interaction for typed payloads.

Use this when you want type safety and have a specific class representing your interaction data.

Example:

class User {
  final String name;
  final String email;

  User(this.name, this.email);

  Map<String, dynamic> toJson() => {'name': name, 'email': email};
}

final interaction = ClassInteraction<User>(
  id: 'create_user',
  payload: User('John', 'john@example.com'),
);
Inheritance

Constructors

ClassInteraction.new({required String id, required T payload, InteractionDefinition? rollback, Duration? timeout, bool supportsOptimistic = true, int priority = 0, Set<String> tags = const {}, Map<String, dynamic> toJsonConverter(T)?})
Creates a new class-based interaction.

Properties

hashCode int
The hash code for this object.
no setteroverride
id String
Unique identifier for this interaction type.
final
payload → T
Gets the payload object (if any) for class-based interactions.
no setteroverride
payloadType Type
Gets the payload type for type checking.
no setteroverride
priority int
Priority level for execution order (higher = more priority).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
supportsOptimistic bool
Whether this interaction supports optimistic updates.
final
tags Set<String>
Tags for categorizing interactions.
final
timeout Duration?
Timeout duration for the interaction (optional).
final

Methods

createRollback() InteractionDefinition?
Creates a rollback interaction (optional).
override
getValidationErrors() List<String>
Gets validation error messages.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Serializes the interaction data to JSON format.
override
toString() String
A string representation of this object.
inherited
validate() bool
Validates the interaction data.
override

Operators

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