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) {
  List<_PolicyPair?> policyPairsList = _policyPairs;
  for (int i = 0; i < policyPairsList.length; i++) {
    _PolicyPair? pair = policyPairsList[i];
    if (pair != null) {
      if(pair.shouldApplyToPath(path)) {
        return pair.policy;
      }
    }
  }
  return null;
}