RateLimitedRequestAttemptConfig<T> constructor
RateLimitedRequestAttemptConfig<T> ({})
Creates a new RateLimitedRequestAttemptUtil instance.
At least one of maxAttempts or timeframe must be provided.
Throws ArgumentError if both maxAttempts and timeframe are null.
Implementation
RateLimitedRequestAttemptConfig({
required this.domain,
required this.source,
this.defaultExtraData,
this.maxAttempts,
this.timeframe,
this.onRateLimitExceeded,
final String Function(T nonce)? nonceToString,
final T Function(String nonce)? nonceFromString,
}) : assert(
maxAttempts != null || timeframe != null,
'At least one of maxAttempts or timeframe must be provided',
) {
this.nonceToString = nonceToString ?? _nonceToString;
this.nonceFromString = nonceFromString ?? _nonceFromString;
}