PeerSettings.deserialize constructor
PeerSettings.deserialize(
- BinaryReader reader
Deserialize.
Implementation
factory PeerSettings.deserialize(BinaryReader reader) {
// Read [PeerSettings] fields.
final flags = reader.readInt32();
final reportSpam = (flags & 1) != 0;
final addContact = (flags & 2) != 0;
final blockContact = (flags & 4) != 0;
final shareContact = (flags & 8) != 0;
final needContactsException = (flags & 16) != 0;
final reportGeo = (flags & 32) != 0;
final autoarchived = (flags & 128) != 0;
final inviteMembers = (flags & 256) != 0;
final requestChatBroadcast = (flags & 1024) != 0;
final businessBotPaused = (flags & 2048) != 0;
final businessBotCanReply = (flags & 4096) != 0;
final hasGeoDistanceField = (flags & 64) != 0;
final geoDistance = hasGeoDistanceField ? reader.readInt32() : null;
final hasRequestChatTitleField = (flags & 512) != 0;
final requestChatTitle =
hasRequestChatTitleField ? reader.readString() : null;
final hasRequestChatDateField = (flags & 512) != 0;
final requestChatDate =
hasRequestChatDateField ? reader.readDateTime() : null;
final hasBusinessBotIdField = (flags & 8192) != 0;
final businessBotId = hasBusinessBotIdField ? reader.readInt64() : null;
final hasBusinessBotManageUrlField = (flags & 8192) != 0;
final businessBotManageUrl =
hasBusinessBotManageUrlField ? reader.readString() : null;
final hasChargePaidMessageStarsField = (flags & 16384) != 0;
final chargePaidMessageStars =
hasChargePaidMessageStarsField ? reader.readInt64() : null;
final hasRegistrationMonthField = (flags & 32768) != 0;
final registrationMonth =
hasRegistrationMonthField ? reader.readString() : null;
final hasPhoneCountryField = (flags & 65536) != 0;
final phoneCountry = hasPhoneCountryField ? reader.readString() : null;
final hasNameChangeDateField = (flags & 131072) != 0;
final nameChangeDate =
hasNameChangeDateField ? reader.readDateTime() : null;
final hasPhotoChangeDateField = (flags & 262144) != 0;
final photoChangeDate =
hasPhotoChangeDateField ? reader.readDateTime() : null;
// Construct [PeerSettings] object.
final returnValue = PeerSettings(
reportSpam: reportSpam,
addContact: addContact,
blockContact: blockContact,
shareContact: shareContact,
needContactsException: needContactsException,
reportGeo: reportGeo,
autoarchived: autoarchived,
inviteMembers: inviteMembers,
requestChatBroadcast: requestChatBroadcast,
businessBotPaused: businessBotPaused,
businessBotCanReply: businessBotCanReply,
geoDistance: geoDistance,
requestChatTitle: requestChatTitle,
requestChatDate: requestChatDate,
businessBotId: businessBotId,
businessBotManageUrl: businessBotManageUrl,
chargePaidMessageStars: chargePaidMessageStars,
registrationMonth: registrationMonth,
phoneCountry: phoneCountry,
nameChangeDate: nameChangeDate,
photoChangeDate: photoChangeDate,
);
// Now return the deserialized [PeerSettings].
return returnValue;
}