HelpTermsOfService.deserialize constructor

HelpTermsOfService.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

factory HelpTermsOfService.deserialize(BinaryReader reader) {
  // Read [HelpTermsOfService] fields.
  final flags = reader.readInt32();
  final popup = (flags & 1) != 0;
  final id = reader.readObject() as DataJSONBase;
  final text = reader.readString();
  final entities = reader.readVectorObject<MessageEntityBase>();
  final hasMinAgeConfirmField = (flags & 2) != 0;
  final minAgeConfirm = hasMinAgeConfirmField ? reader.readInt32() : null;

  // Construct [HelpTermsOfService] object.
  final returnValue = HelpTermsOfService(
    popup: popup,
    id: id,
    text: text,
    entities: entities.items,
    minAgeConfirm: minAgeConfirm,
  );

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