UrlAuthResultRequest.deserialize constructor

UrlAuthResultRequest.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

factory UrlAuthResultRequest.deserialize(BinaryReader reader) {
  // Read [UrlAuthResultRequest] fields.
  final flags = reader.readInt32();
  final requestWriteAccess = (flags & 1) != 0;
  final requestPhoneNumber = (flags & 2) != 0;
  final matchCodesFirst = (flags & 32) != 0;
  final isApp = (flags & 64) != 0;
  final bot = reader.readObject() as UserBase;
  final domain = reader.readString();
  final hasBrowserField = (flags & 4) != 0;
  final browser = hasBrowserField ? reader.readString() : null;
  final hasPlatformField = (flags & 4) != 0;
  final platform = hasPlatformField ? reader.readString() : null;
  final hasIpField = (flags & 4) != 0;
  final ip = hasIpField ? reader.readString() : null;
  final hasRegionField = (flags & 4) != 0;
  final region = hasRegionField ? reader.readString() : null;
  final hasMatchCodesField = (flags & 8) != 0;
  final matchCodes = hasMatchCodesField ? reader.readVectorString() : null;
  final hasUserIdHintField = (flags & 16) != 0;
  final userIdHint = hasUserIdHintField ? reader.readInt64() : null;
  final hasVerifiedAppNameField = (flags & 128) != 0;
  final verifiedAppName =
      hasVerifiedAppNameField ? reader.readString() : null;

  // Construct [UrlAuthResultRequest] object.
  final returnValue = UrlAuthResultRequest(
    requestWriteAccess: requestWriteAccess,
    requestPhoneNumber: requestPhoneNumber,
    matchCodesFirst: matchCodesFirst,
    isApp: isApp,
    bot: bot,
    domain: domain,
    browser: browser,
    platform: platform,
    ip: ip,
    region: region,
    matchCodes: matchCodes?.items,
    userIdHint: userIdHint,
    verifiedAppName: verifiedAppName,
  );

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