InputRichMessage.deserialize constructor

InputRichMessage.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

factory InputRichMessage.deserialize(BinaryReader reader) {
  // Read [InputRichMessage] fields.
  final flags = reader.readInt32();
  final rtl = (flags & 1) != 0;
  final noautolink = (flags & 2) != 0;
  final blocks = reader.readVectorObject<PageBlockBase>();
  final hasPhotosField = (flags & 4) != 0;
  final photos =
      hasPhotosField ? reader.readVectorObject<InputPhotoBase>() : null;
  final hasDocumentsField = (flags & 8) != 0;
  final documents =
      hasDocumentsField ? reader.readVectorObject<InputDocumentBase>() : null;
  final hasUsersField = (flags & 16) != 0;
  final users =
      hasUsersField ? reader.readVectorObject<InputUserBase>() : null;

  // Construct [InputRichMessage] object.
  final returnValue = InputRichMessage(
    rtl: rtl,
    noautolink: noautolink,
    blocks: blocks.items,
    photos: photos?.items,
    documents: documents?.items,
    users: users?.items,
  );

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