deserialize function

dynamic deserialize(
  1. Uint8List buffer, {
  2. DecodeExt? decodeExt,
})

Deserializes a single value from a MessagePack buffer.

The function reads the first complete MessagePack object from the buffer.

decodeExt can be provided to handle custom extension types.

Throws a MessagePackException if the buffer contains invalid MessagePack data or is empty. Throws a RangeError if the buffer is exhausted prematurely mid-value.

Implementation

@pragma('vm:prefer-inline')
dynamic deserialize(Uint8List buffer, {DecodeExt? decodeExt}) {
  final unpacker = Unpacker(buffer: buffer, decodeExt: decodeExt);
  final result = unpacker.unpack();

  return result;
}