getRetryAfter method Null safety

Duration getRetryAfter(
  1. Duration? retryAfter
)

Implementation

Duration getRetryAfter(Duration? retryAfter) {
  var usedDuration = retryAfter ?? Duration(milliseconds: 0);
  if (retryAfter == null) {
    switch (attempts) {
      case 0:
      case 1:
        usedDuration = Duration(milliseconds: 0);
        break;
      case 2:
        usedDuration = Duration(milliseconds: 100);
        break;
      case 3:
        usedDuration = Duration(seconds: 2);
        break;
      default:
        usedDuration = Duration(seconds: 10);
    }
  }
  return usedDuration;
}