onString method
override
A string field announcing length UTF-8 bytes. Return the destination
to decode it into — its capacity at least length — or null to skip
it.
The codec sets the destination's length to length, copies the payload
into its storage, and validates it as UTF-8 once it is whole: invalid
bytes are INVALID (CORELIB_PLAN §6.4). A skipped string is never
inspected.
Implementation
@override
InlineString? onString(int id, int length) {
if (_overCapacity(this, id, cap, rcap)) return null;
if (_overLength(this, length, emax, relemMax)) return null;
while (out.length <= id) {
out.add(InlineString(0));
}
final e = out[id];
if (e.storage.length < length) e.storage = Uint8List(length);
return e;
}