RequestDeduplicator class

Prevents accidental duplicate calls to the same logical operation — e.g. a user double-tapping "Submit" before the first tap's request has returned.

Deduplication is keyed by a caller-supplied key (e.g. 'create_order'); calls with no key are never deduplicated.

Constructors

RequestDeduplicator()

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

isInFlight(String key) bool
Whether a call with key is currently in flight.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset() → void
Clears all tracked in-flight entries without cancelling the underlying futures. Mainly useful for tests.
run<T>(String? key, Future<T> operation(), {DeduplicationPolicy policy = DeduplicationPolicy.reuseInFlight}) Future<T>
Runs operation under key according to policy.
toString() String
A string representation of this object.
inherited

Operators

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