RingBuffer<T> constructor

RingBuffer<T>(
  1. int capacity
)

Creates a RingBuffer with the specified capacity.

Implementation

RingBuffer(int capacity)
  : _capacity = capacity,
    _buffer = List<T?>.filled(capacity, null) {
  if (capacity <= 0) {
    throw ArgumentError('Capacity must be greater than 0');
  }
}