RateLimiter constructor
RateLimiter({})
Implementation
RateLimiter({
this.maxTokens = 10,
this.refillRate = 1,
this.refillInterval = const Duration(seconds: 1),
this.enabled = true,
this.debugMode = false,
this.name,
this.onMetrics,
}) : assert(maxTokens > 0, 'maxTokens must be positive'),
assert(refillRate > 0, 'refillRate must be positive'),
_tokens = maxTokens.toDouble(),
_stopwatch = Stopwatch()..start(),
_lastRefillMicroseconds = 0;