clearSlots method

void clearSlots(
  1. Iterable<AsyncSlotHandle> slots
)

Clear several derived roots in one frontier walk.

Queue-family mutations use this to make a transition atomic: downstream observers cannot run between len and is_full becoming dirty.

Implementation

void clearSlots(Iterable<AsyncSlotHandle<dynamic>> slots) {
  if (_disposed) return;
  final live = slots.where((slot) => !slot._nodeDisposed).toList();
  if (live.isEmpty) return;
  if (_batching) {
    _batchClearSlots.addAll(live);
    return;
  }
  for (final slot in live) {
    slot._onInvalidate();
  }
  _invalidateFrontier(
    live,
    alreadyInvalidated: Set<AsyncSlotHandle<dynamic>>.of(live),
  );
}