CacheKeyPolicy.fromJson constructor

CacheKeyPolicy.fromJson(
  1. Object? j
)

Implementation

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