DialogFilter.deserialize constructor

DialogFilter.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

factory DialogFilter.deserialize(BinaryReader reader) {
  // Read [DialogFilter] fields.
  final flags = reader.readInt32();
  final contacts = (flags & 1) != 0;
  final nonContacts = (flags & 2) != 0;
  final groups = (flags & 4) != 0;
  final broadcasts = (flags & 8) != 0;
  final bots = (flags & 16) != 0;
  final excludeMuted = (flags & 2048) != 0;
  final excludeRead = (flags & 4096) != 0;
  final excludeArchived = (flags & 8192) != 0;
  final titleNoanimate = (flags & 268435456) != 0;
  final id = reader.readInt32();
  final title = reader.readObject() as TextWithEntitiesBase;
  final hasEmoticonField = (flags & 33554432) != 0;
  final emoticon = hasEmoticonField ? reader.readString() : null;
  final hasColorField = (flags & 134217728) != 0;
  final color = hasColorField ? reader.readInt32() : null;
  final pinnedPeers = reader.readVectorObject<InputPeerBase>();
  final includePeers = reader.readVectorObject<InputPeerBase>();
  final excludePeers = reader.readVectorObject<InputPeerBase>();

  // Construct [DialogFilter] object.
  final returnValue = DialogFilter(
    contacts: contacts,
    nonContacts: nonContacts,
    groups: groups,
    broadcasts: broadcasts,
    bots: bots,
    excludeMuted: excludeMuted,
    excludeRead: excludeRead,
    excludeArchived: excludeArchived,
    titleNoanimate: titleNoanimate,
    id: id,
    title: title,
    emoticon: emoticon,
    color: color,
    pinnedPeers: pinnedPeers.items,
    includePeers: includePeers.items,
    excludePeers: excludePeers.items,
  );

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