invalidatePrefix method

void invalidatePrefix(
  1. Object prefix
)

Invalidate every query whose key starts with prefix.

prefix accepts the same forms as a query key (QoraKey or List). Elements are compared with the same deep equality as query keys, so maps and nested lists match structurally. An empty prefix matches every query. Active watchers refetch, exactly as with invalidate.

// Matches ['posts'], ['posts', 1], ['posts', 1, 'comments'], ...
client.invalidatePrefix(['posts']);

// Matches every query for user 42, whatever comes next.
client.invalidatePrefix(['users', 42]);

Implementation

void invalidatePrefix(Object prefix) {
  _assertNotDisposed();
  final normalizedPrefix = normalizeKey(prefix);
  invalidateWhere((key) => _startsWith(key, normalizedPrefix));
}