CircularBuffer<T>.of constructor

CircularBuffer<T>.of(
  1. List<T> list, [
  2. int? capacity
])

Creates a CircularBuffer based on another list

Implementation

CircularBuffer.of(List<T> list, [int? capacity])
    : assert(
        capacity == null || capacity >= list.length,
        'The capacity must be at least as long as the existing list',
      ),
      capacity = capacity ?? list.length,
      _buf = [...list];