updateWith method
- BaseResponse response
Update this bucket with the values from response
.
Call this method for every response in this bucket.
Implementation
void updateWith(BaseResponse response) {
assert(contains(response), 'Response was not in bucket');
final remaining = response.headers[xRateLimitRemaining];
final resetAfter = response.headers[xRateLimitResetAfter];
if (remaining != null) {
_remaining = int.parse(remaining);
}
if (resetAfter != null) {
final resetAfterDuration = Duration(milliseconds: (double.parse(resetAfter) * 1000).ceil());
_resetAt = DateTime.now().add(resetAfterDuration);
}
}