writeString method

void writeString(
  1. String? string, {
  2. Encoding encoding = utf8,
})

Implementation

void writeString(String? string, {Encoding encoding = utf8}) {
  if (string == null) {
    writeNil();
    return;
  }

  Uint8List encodedString = encoding.encode(string) as Uint8List;
  writeStringHeader(encodedString.length);
  _bytesBuilder.add(encodedString);
}