removeStructuredData method

Future<void> removeStructuredData(
  1. String id
)

Removes structured data from the cache

id is the unique identifier for the data

Implementation

Future<void> removeStructuredData(String id) async {
  // Remove the data
  await _cache.delete(_structuredDataKeyPrefix + id);

  // Update the list of IDs
  final ids = _cache.get(_structuredDataIdsKey) as List<dynamic>? ?? [];
  if (ids.contains(id)) {
    ids.remove(id);
    await _cache.put(_structuredDataIdsKey, ids);
  }

  // We don't update the list of sources because other data might still use them
}