add method

void add(
  1. int timestampMs,
  2. num value
)

Adds a point at timestampMs with value; evicts and folds the oldest raw point if the raw window is now over capacity.

Example:

final TimeSeriesBuffer b = TimeSeriesBuffer(rawCapacity: 2, bucketSizeMs: 1000)
  ..add(0, 10)
  ..add(500, 20)
  ..add(1500, 30); // (0,10) evicted into the [0,1000) bucket
b.aggregates.first.mean; // 10

Audited: 2026-06-12 11:26 EDT

Implementation

void add(int timestampMs, num value) {
  _raw.add((t: timestampMs, v: value));
  if (_raw.length > _rawCapacity) _evictOldest();
}