ValueAt method
Returns the P for the keyed slot key, optionally writing
text into it.
Allocates the slot on first use. If text is null the existing string
is returned; asserts that the slot has been initialised at least once.
Implementation
P ValueAt(String key, [String? text, int? bufferSize]) {
final slot = stringSlotsKeyed.putIfAbsent(
key, () => stringSlots.length
);
_ensureSlotExists(slot);
if (text != null) {
return writeToSlot(slot, text, bufferSize);
}
assert(
!isPointerNull(stringSlots[slot]),
'[TEMP] String.ValueAt("$key") used before initialization'
);
return stringSlots[slot];
}