cacheFeatureCollection method

AdFeatureCollection cacheFeatureCollection(
  1. AdFeatureCollection collection
)

Implementation

AdFeatureCollection cacheFeatureCollection(AdFeatureCollection collection) {
  List<AdFeature> newFeatures = [];
  final featureIDs = _cache.entries
      .expand<String>((e) => e.value.featureIDs)
      .where((e) => e.isNotEmpty)
      .toList();
  for (var feature in collection.features) {
    final id = feature.properties.id;
    if (!featureIDs.contains(id)) {
      newFeatures.add(feature);
    }
  }
  return AdFeatureCollection(collection.type, newFeatures);
}