unmarshal library
Descriptor-driven protobuf binary unmarshaling (decoding).
Decodes raw protobuf binary bytes into a message represented as
Map<String, Object?>, using a list of field descriptors that map field
numbers to names and types.
Field descriptor format (same as marshal):
{
'number': int, // protobuf field number
'name': String, // field name in the output map
'type': String, // protobuf type: int32, uint32, sint32, int64,
// uint64, sint64, bool, enum, fixed32, sfixed32,
// fixed64, sfixed64, float, double, string,
// bytes, message
'repeated': bool?, // true if the field is repeated (optional)
'mapEntry': bool?, // true if this is a map field (optional)
'keyType': String?, // map key type (required if mapEntry is true)
'valueType': String?, // map value type (required if mapEntry is true)
'messageDescriptor': // sub-message descriptor (for type == 'message')
List<Map<String, Object?>>?,
}
References:
Functions
-
findFieldByNumber(
List< Map< descriptor, int fieldNumber) → Map<String, Object?> >String, Object?> ? - Find a field descriptor by field number.
-
skipField(
List< int> bytes, int offset, int wireType) → int - Skip an unknown field (field number not in descriptor).
-
unmarshal(
List< int> bytes, List<Map< descriptor) → Map<String, Object?> >String, Object?> -
Unmarshal protobuf binary bytes to a message (
Map<String, Object?>). -
unmarshalFieldValue(
List< int> bytes, int offset, int wireType, String fieldType) → Map<String, Object?> - Decode a single field value given its wire type and field type.
-
unmarshalMapField(
List< int> entryBytes, String keyType, String valueType) → Map<String, Object?> - Decode a map field entry from its raw bytes.
-
unmarshalRepeated(
List< int> bytes, int offset, int wireType, String fieldType) → Map<String, Object?> - Decode a repeated field. Handles both packed (wire type 2) and unpacked (each element has its own tag) encoding.