writeString method

void writeString(
  1. String? value
)
inherited

Write a modified UTF-8 String. This includes writing its length as a single short integer.

Implementation

void writeString(String? value) {
  if (value == null || value == 'None') {
    writeShort(0, signed: false);
    return;
  }
  final string = utf8.encode(value);
  writeShort(string.length, signed: false);
  for (final val in string) {
    writeByte(val, signed: false);
  }
}