getBytes method

Bytes? getBytes(
  1. int fieldId
)

Returns a zero-copy slice of a bytes/string field.

Strings are returned as their raw UTF-8 bytes; use getString to decode.

Implementation

Bytes? getBytes(int fieldId) {
  final cursor = this.cursor();
  while (cursor.next()) {
    if (cursor.fieldId != fieldId) continue;
    _requireWire(cursor, fieldId, VxsWire.lengthDelimited);
    return Bytes.view(buffer, cursor.valueOffset, cursor.valueLength);
  }
  return null;
}