cachePolicyForPath method Null safety

CachePolicy? cachePolicyForPath(
  1. String path
)

Returns the CachePolicy for path.

Evaluates each policy added by addCachePolicy against the path and returns it if exists.

Implementation

CachePolicy? cachePolicyForPath(String path) {
  return _policyPairs
      .firstWhere(
        (pair) => pair?.shouldApplyToPath(path) ?? false,
        orElse: () => null,
      )
      ?.policy;
}