dropQuerySet method

void dropQuerySet(
  1. int querySetId, {
  2. Set? protectedKeys,
})

Implementation

void dropQuerySet(int querySetId, {Set<dynamic>? protectedKeys}) {
  final toEvict = <dynamic>[];
  for (final entry in _rowOwners.entries.toList()) {
    final pk = entry.key;
    final owners = entry.value;
    if (!owners.remove(querySetId)) continue;
    if (owners.isEmpty) {
      _rowOwners.remove(pk);
      if (protectedKeys == null || !protectedKeys.contains(pk)) {
        toEvict.add(pk);
      }
    }
  }
  for (final pk in toEvict) {
    _evictRow(pk);
  }
  if (toEvict.isNotEmpty) {
    _refreshRowsNotifier();
    _notifyRowListeners(toEvict);
  }
}