CachePolicy.fromJson constructor

CachePolicy.fromJson(
  1. Map json_
)

Implementation

CachePolicy.fromJson(core.Map json_)
  : this(
      cacheBypassRequestHeaderNames:
          (json_['cacheBypassRequestHeaderNames'] as core.List?)
              ?.map((value) => value as core.String)
              .toList(),
      cacheKeyPolicy: json_.containsKey('cacheKeyPolicy')
          ? CachePolicyCacheKeyPolicy.fromJson(
              json_['cacheKeyPolicy'] as core.Map<core.String, core.dynamic>,
            )
          : null,
      cacheMode: json_['cacheMode'] as core.String?,
      clientTtl: json_.containsKey('clientTtl')
          ? Duration.fromJson(
              json_['clientTtl'] as core.Map<core.String, core.dynamic>,
            )
          : null,
      defaultTtl: json_.containsKey('defaultTtl')
          ? Duration.fromJson(
              json_['defaultTtl'] as core.Map<core.String, core.dynamic>,
            )
          : null,
      maxTtl: json_.containsKey('maxTtl')
          ? Duration.fromJson(
              json_['maxTtl'] as core.Map<core.String, core.dynamic>,
            )
          : null,
      negativeCaching: json_['negativeCaching'] as core.bool?,
      negativeCachingPolicy: (json_['negativeCachingPolicy'] as core.List?)
          ?.map(
            (value) => CachePolicyNegativeCachingPolicy.fromJson(
              value as core.Map<core.String, core.dynamic>,
            ),
          )
          .toList(),
      requestCoalescing: json_['requestCoalescing'] as core.bool?,
      serveWhileStale: json_.containsKey('serveWhileStale')
          ? Duration.fromJson(
              json_['serveWhileStale'] as core.Map<core.String, core.dynamic>,
            )
          : null,
    );