RateLimiterConfig constructor
RateLimiterConfig({})
Creates the configuration for a RateLimiter.
Throws ArgumentError for non-positive limits or windows.
Implementation
RateLimiterConfig({
required this.domain,
required this.source,
required this.maxAttempts,
this.timeframe,
this.defaultExtraData,
this.onRateLimitExceeded,
}) {
if (maxAttempts <= 0) {
throw ArgumentError.value(maxAttempts, 'maxAttempts', 'Must be positive');
}
if (timeframe != null && timeframe! <= Duration.zero) {
throw ArgumentError.value(timeframe, 'timeframe', 'Must be positive');
}
}