nextDelay method

Duration nextDelay()

Gets the next delay and increases the backoff

Implementation

Duration nextDelay() {
  final delay = _currentDelay;

  // Double the delay for next time, but don't exceed max
  _currentDelay = Duration(milliseconds: _currentDelay.inMilliseconds * 2);
  if (_currentDelay > _maxDelay) {
    _currentDelay = _maxDelay;
  }

  return delay;
}