protoToDelimitedBuffer function

List<int> protoToDelimitedBuffer(
  1. GeneratedMessage message
)

Implementation

List<int> protoToDelimitedBuffer(GeneratedMessage message) {
  var messageBuffer = CodedBufferWriter();
  message.writeToCodedBufferWriter(messageBuffer);

  var delimiterBuffer = CodedBufferWriter();
  delimiterBuffer.writeInt32NoTag(messageBuffer.lengthInBytes);

  var result =
      Uint8List(messageBuffer.lengthInBytes + delimiterBuffer.lengthInBytes);

  delimiterBuffer.writeTo(result);
  messageBuffer.writeTo(result, delimiterBuffer.lengthInBytes);

  return result;
}