circular_buffer
0.13.0, released 7 months ago by an unverified publisher
A fixed‑capacity circular buffer that behaves like a List with overwrite semantics.
WASM-ready
What it does
Provides a List‑like container with a preset maximum size. When full, adding new items discards the oldest ones. Supports reading via index and methods like add, addHead, clear, and first/last accessors.
AI-written summary of version 0.13.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need a bounded in‑memory queue or buffer with O(1) insert and read operations.
- You want List‑like API without managing manual overflow logic.
Skip it when
- You require persistent storage or disk‑backed queues.
- You need advanced stream or reactive features for buffer updates.
Strengths
- Simple, zero dependencies, and fast due to pre‑allocated storage.
- Supports both tail and head insertion with clear semantics.
Weaknesses
- No built‑in reactive or stream notifications when the buffer changes.
- Limited to in‑memory use; cannot be persisted automatically.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
final buffer = CircularBuffer<int>(3)..add(1)..add(2);
print(buffer.length); // 2
buffer.add(3);
buffer.add(4);
print(buffer.first); // 2