Throttle class

Constructors

Throttle()

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

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

Static Methods

async<T>({required String callId, required Future<T> operation, OnTimeout? onTimeout, OnError? onError, OnWaiting? onWaiting, OnNull? onNull, OnEmpty? onEmpty, OnThrottle? onThrottle, required void onSuccess(T data), Duration duration = const Duration(seconds: 1), Duration timeout = const Duration(milliseconds: 0)}) Future<void>
Throttles the execution of an asynchronous operation and handles its result or errors based on the given callback functions. The callId parameter is used to identify the operation and avoid concurrent executions. The operation parameter is the asynchronous operation to be throttled, and duration is the duration of the throttling period.
sync<T>({required String callId, required dynamic operation(), OnThrottle? onThrottle, OnError? onError, OnNull? onNull, OnEmpty? onEmpty, required void onSuccess(T data), Duration throttle = const Duration(seconds: 1)}) → void
Throttles a synchronous operation by preventing it from being executed more frequently than the specified throttle duration, and executes a success callback with the result of the operation.