push method

void push(
  1. FrameEntry entry
)

Pushes a new frame into the buffer, discarding the oldest if full.

Implementation

void push(FrameEntry entry) {
  final idx = (_head + _size) % capacity;
  _buffer[idx] = entry;

  if (_size >= capacity) {
    _head = (_head + 1) % capacity; // Overwrite oldest
  } else {
    _size++;
  }
}