InteractionBuilder<T> class

Builder for creating interactions with a fluent API.

Provides a convenient way to construct interactions step by step. Can create both GenericInteraction and ClassInteraction instances depending on whether you use withData or withPayload.

Example:

// Generic interaction
final genericInteraction = InteractionBuilder()
  .withId('update_user')
  .withData({'name': 'Jane'})
  .withTimeout(Duration(seconds: 5))
  .addTag('user')
  .build();

// Class interaction
final classInteraction = InteractionBuilder<User>()
  .withId('create_user')
  .withPayload(User('John', 'john@example.com'))
  .withPriority(1)
  .build();

Constructors

InteractionBuilder.new()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addData(String key, dynamic value) InteractionBuilder<T>
Adds a single key-value pair to the interaction data.
addTag(String tag) InteractionBuilder<T>
Adds a single tag.
addTags(Iterable<String> tags) InteractionBuilder<T>
Adds multiple tags.
build() InteractionDefinition
Builds the interaction.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset() InteractionBuilder
Resets the builder to its initial state for reuse.
toString() String
A string representation of this object.
inherited
withData(Map<String, dynamic> data) InteractionBuilder<T>
Sets the interaction data for generic interactions.
withId(String id) InteractionBuilder<T>
Sets the interaction ID.
withOptimistic(bool supports) InteractionBuilder<T>
Sets whether optimistic updates are supported.
withPayload(T payload, {Map<String, dynamic> converter(T)?}) InteractionBuilder<T>
Sets the typed payload for class-based interactions.
withPriority(int priority) InteractionBuilder<T>
Sets the execution priority.
withRollback(InteractionDefinition rollback) InteractionBuilder<T>
Sets the rollback interaction.
withTags(Set<String> tags) InteractionBuilder<T>
Sets the tags set, replacing any existing tags.
withTimeout(Duration timeout) InteractionBuilder<T>
Sets the timeout duration.

Operators

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