CachePolicyCacheKeyPolicy.fromJson constructor

CachePolicyCacheKeyPolicy.fromJson(
  1. Object? j
)

Implementation

factory CachePolicyCacheKeyPolicy.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return CachePolicyCacheKeyPolicy(
    excludedQueryParameters: switch (json['excludedQueryParameters']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException(
        '"excludedQueryParameters" is not a list',
      ),
    },
    includeHost: switch (json['includeHost']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    includeProtocol: switch (json['includeProtocol']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    includeQueryString: switch (json['includeQueryString']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    includedCookieNames: switch (json['includedCookieNames']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"includedCookieNames" is not a list'),
    },
    includedHeaderNames: switch (json['includedHeaderNames']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"includedHeaderNames" is not a list'),
    },
    includedQueryParameters: switch (json['includedQueryParameters']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException(
        '"includedQueryParameters" is not a list',
      ),
    },
  );
}