flush method
Flush: produce a Delta with one DeltaOpSlotValue per resolved slot. Slots still dirty at flush are emitted as DeltaOpInvalidate (the mirror-lazy path).
Implementation
Delta flush() {
final ops = <DeltaOp>[];
for (final node in _dirty.toList()..sort()) {
ops.add(DeltaOp.invalidate(node));
}
for (final entry in _values.entries.toList()
..sort((a, b) => a.key.compareTo(b.key))) {
ops.add(DeltaOp.slotValue(entry.key, entry.value));
}
_dirty.clear();
_values.clear();
final delta = Delta.next(_baseEpoch, ops);
_baseEpoch = delta.epoch;
return delta;
}