Msg.deserialize constructor

Msg.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

factory Msg.deserialize(BinaryReader reader) {
  // Read [Msg] fields.
  final msgId = reader.readInt64();
  final seqno = reader.readInt32();
  final bytes = reader.readInt32();
  final body = reader.readObject();

  // Construct [Msg] object.
  final returnValue = Msg(
    msgId: msgId,
    seqno: seqno,
    bytes: bytes,
    body: body,
  );

  // Now return the deserialized [Msg].
  return returnValue;
}