AccountCreateTheme.deserialize constructor

AccountCreateTheme.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

factory AccountCreateTheme.deserialize(BinaryReader reader) {
  // Read [AccountCreateTheme] fields.
  final flags = reader.readInt32();
  final slug = reader.readString();
  final title = reader.readString();
  final hasDocumentField = (flags & 4) != 0;
  final document =
      hasDocumentField ? reader.readObject() as InputDocumentBase : null;
  final hasSettingsField = (flags & 8) != 0;
  final settings = hasSettingsField
      ? reader.readVectorObject<InputThemeSettingsBase>()
      : null;

  // Construct [AccountCreateTheme] object.
  final returnValue = AccountCreateTheme(
    slug: slug,
    title: title,
    document: document,
    settings: settings,
  );

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