encodeGroupField function

List<int> encodeGroupField(
  1. List<int> buffer,
  2. int fieldNumber,
  3. List<int> body
)

Encodes a message field using DELIMITED (group) wire format: a START_GROUP tag (wire type 3), the submessage body, then a matching END_GROUP tag (wire type 4). This is the editions message_encoding = DELIMITED representation (and the proto2 group encoding). Unlike length-prefixed (wire type 2) the body is NOT length-prefixed — it is terminated by the END_GROUP tag.

Implementation

List<int> encodeGroupField(List<int> buffer, int fieldNumber, List<int> body) {
  encodeTag(buffer, fieldNumber, _wtSGroup);
  // Per-item append: addAll -> non-mutating list_concat drops the body on the
  // C++/TS targets when the caller discards the return (see wire_bytes.dart).
  for (final b in body) {
    buffer.add(b);
  }
  encodeTag(buffer, fieldNumber, _wtEGroup);
  return buffer;
}