putString method
Implementation
void putString(String text) {
Uint8List encoded = utf8.encode(text);
int count = encoded.length;
// We reserve 2 bytes for the length prefix (Uint16)
_expand(2 + count);
_buffer.setUint16(offset, count, Endian.host);
offset = offset + 2;
for (int i = 0; i < count; i = i + 1) {
_buffer.setUint8(offset, encoded[i]);
offset = offset + 1;
}
}