dispose method
void
dispose()
Dispose resources and cancel timers
Implementation
void dispose() {
if (_isDisposed) return; // Prevent double disposal
_isDisposed = true;
_bucketResetTimer?.cancel();
_rateLimitTimer?.cancel();
_bucketResetTimer = null;
_rateLimitTimer = null;
// Release all queued calls back to the pool before clearing
while (_queue.isNotEmpty) {
_objectPool.release(_queue.removeFirst());
}
// Release pending trailing call if exists
if (_pendingTrailingCall != null) {
_objectPool.release(_pendingTrailingCall!);
_pendingTrailingCall = null;
}
// Clear the object pool
_objectPool.clear();
}