add method

bool add(
  1. String entry
)

Records entry unless it is blank or a consecutive duplicate of the most recent entry, capping to maxEntries. Returns whether the buffer changed, so callers can skip persisting on a no-op.

Implementation

bool add(String entry) {
  if (entry.trim().isEmpty) return false;
  if (_entries.isNotEmpty && _entries.last == entry) return false;
  _entries.add(entry);
  _cap();
  return true;
}