Folder.deserialize constructor

Folder.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

factory Folder.deserialize(BinaryReader reader) {
  // Read [Folder] fields.
  final flags = reader.readInt32();
  final autofillNewBroadcasts = (flags & 1) != 0;
  final autofillPublicGroups = (flags & 2) != 0;
  final autofillNewCorrespondents = (flags & 4) != 0;
  final id = reader.readInt32();
  final title = reader.readString();
  final hasPhotoField = (flags & 8) != 0;
  final photo = hasPhotoField ? reader.readObject() as ChatPhotoBase : null;

  // Construct [Folder] object.
  final returnValue = Folder(
    autofillNewBroadcasts: autofillNewBroadcasts,
    autofillPublicGroups: autofillPublicGroups,
    autofillNewCorrespondents: autofillNewCorrespondents,
    id: id,
    title: title,
    photo: photo,
  );

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