Value method

Pointer<Char> Value(
  1. String text, [
  2. String? key
])

Returns a Pointer<Char> 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

Pointer<Char> Value(String text, [String? key]) {
  if (key != null) return ValueAt(key, text);
  final slot = _StringAnonIndex;
  _StringAnonIndex = (_StringAnonIndex + 1) % slotCount;
  _ensureStringSlotExists(slot);
  return _writeStringToSlot(slot, text);
}