DeduplicationExecution<T> class
mixin
A mixin that prevents concurrent execution of the same asynchronous operation.
It ensures that if multiple calls to deduplicationExecution happen while a previous one is still in progress, they will all await the same result, avoiding duplicated effort (e.g., repeated API calls).
Usage:
final result = await deduplicationFunction(() async => await fetchData());
This mixin stores a single internal Completer, so it assumes only one deduplicated call is active at a time. If multiple different operations need deduplication simultaneously, consider using a keyed deduplication strategy. Show DeduplicationManagement for more information about keyed deduplication strategy.
Constructors
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
-
deduplicationExecution(
Future< T> deduplicationFunction()) → Future<T> -
Executes
deduplicationFunctiononly if no identical call is already running. -
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