Value method

P Value(
  1. String text, [
  2. String? key
])

Returns a P for text using the next anonymous ring-buffer slot.

Anonymous slots cycle modulo slotCount, so older anonymous strings may be overwritten.

If key is provided, delegates to ValueAt instead.

Implementation

P Value(String text, [String? key]) {
  if (key != null) return ValueAt(key, text);
  final slot = stringAnonIndex;
  stringAnonIndex = (stringAnonIndex + 1) % slotCount;
  _ensureSlotExists(slot);
  return writeToSlot(slot, text);
}