DedupPolicy class abstract

Task deduplication policy to prevent duplicate enqueues.

Useful for preventing duplicate work when the same task is enqueued multiple times with the same or similar input within a short time window.

Example:

// Don't enqueue syncUser:123 if already queued
final dedup = DedupPolicy.byInput(ttl: Duration(minutes: 5));

await TaskFlow.enqueue(
  'syncUser',
  input: {'userId': '123'},
  dedupPolicy: dedup,
);

Constructors

DedupPolicy({required Duration ttl})
DedupPolicy.byFields({required Duration ttl, required List<String> fields})
Deduplicate by specific input fields Only specified fields are considered for dedup
factory
DedupPolicy.byInput({required Duration ttl})
Deduplicate by input hash Same input = same dedup key
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
ttl Duration
TTL for dedup entry (how long to consider a task as "already enqueued")
final

Methods

generateKey(String taskName, Map<String, dynamic> input) String
Generate dedup key from task name and input
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toMap() Map<String, dynamic>
Convert to map
toString() String
A string representation of this object.
inherited

Operators

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