HttpRetryPolicy.fromJson constructor

HttpRetryPolicy.fromJson(
  1. Object? j
)

Implementation

factory HttpRetryPolicy.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return HttpRetryPolicy(
    numRetries: switch (json['numRetries']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    perTryTimeout: switch (json['perTryTimeout']) {
      null => null,
      Object $1 => Duration.fromJson($1),
    },
    retryConditions: switch (json['retryConditions']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"retryConditions" is not a list'),
    },
  );
}