Theme.deserialize constructor

Theme.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

factory Theme.deserialize(BinaryReader reader) {
  // Read [Theme] fields.
  final flags = reader.readInt32();
  final creator = (flags & 1) != 0;
  final ddefault = (flags & 2) != 0;
  final forChat = (flags & 32) != 0;
  final id = reader.readInt64();
  final accessHash = reader.readInt64();
  final slug = reader.readString();
  final title = reader.readString();
  final hasDocumentField = (flags & 4) != 0;
  final document =
      hasDocumentField ? reader.readObject() as DocumentBase : null;
  final hasSettingsField = (flags & 8) != 0;
  final settings =
      hasSettingsField ? reader.readVectorObject<ThemeSettingsBase>() : null;
  final hasEmoticonField = (flags & 64) != 0;
  final emoticon = hasEmoticonField ? reader.readString() : null;
  final hasInstallsCountField = (flags & 16) != 0;
  final installsCount = hasInstallsCountField ? reader.readInt32() : null;

  // Construct [Theme] object.
  final returnValue = Theme(
    creator: creator,
    ddefault: ddefault,
    forChat: forChat,
    id: id,
    accessHash: accessHash,
    slug: slug,
    title: title,
    document: document,
    settings: settings,
    emoticon: emoticon,
    installsCount: installsCount,
  );

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