WebPage.deserialize constructor
WebPage.deserialize(
- BinaryReader reader
Deserialize.
Implementation
factory WebPage.deserialize(BinaryReader reader) {
// Read [WebPage] fields.
final flags = reader.readInt32();
final hasLargeMedia = (flags & 8192) != 0;
final id = reader.readInt64();
final url = reader.readString();
final displayUrl = reader.readString();
final hash = reader.readInt32();
final hasTypeField = (flags & 1) != 0;
final type = hasTypeField ? reader.readString() : null;
final hasSiteNameField = (flags & 2) != 0;
final siteName = hasSiteNameField ? reader.readString() : null;
final hasTitleField = (flags & 4) != 0;
final title = hasTitleField ? reader.readString() : null;
final hasDescriptionField = (flags & 8) != 0;
final description = hasDescriptionField ? reader.readString() : null;
final hasPhotoField = (flags & 16) != 0;
final photo = hasPhotoField ? reader.readObject() as PhotoBase : null;
final hasEmbedUrlField = (flags & 32) != 0;
final embedUrl = hasEmbedUrlField ? reader.readString() : null;
final hasEmbedTypeField = (flags & 32) != 0;
final embedType = hasEmbedTypeField ? reader.readString() : null;
final hasEmbedWidthField = (flags & 64) != 0;
final embedWidth = hasEmbedWidthField ? reader.readInt32() : null;
final hasEmbedHeightField = (flags & 64) != 0;
final embedHeight = hasEmbedHeightField ? reader.readInt32() : null;
final hasDurationField = (flags & 128) != 0;
final duration = hasDurationField ? reader.readInt32() : null;
final hasAuthorField = (flags & 256) != 0;
final author = hasAuthorField ? reader.readString() : null;
final hasDocumentField = (flags & 512) != 0;
final document =
hasDocumentField ? reader.readObject() as DocumentBase : null;
final hasCachedPageField = (flags & 1024) != 0;
final cachedPage =
hasCachedPageField ? reader.readObject() as PageBase : null;
final hasAttributesField = (flags & 4096) != 0;
final attributes = hasAttributesField
? reader.readVectorObject<WebPageAttributeBase>()
: null;
// Construct [WebPage] object.
final returnValue = WebPage(
hasLargeMedia: hasLargeMedia,
id: id,
url: url,
displayUrl: displayUrl,
hash: hash,
type: type,
siteName: siteName,
title: title,
description: description,
photo: photo,
embedUrl: embedUrl,
embedType: embedType,
embedWidth: embedWidth,
embedHeight: embedHeight,
duration: duration,
author: author,
document: document,
cachedPage: cachedPage,
attributes: attributes,
);
// Now return the deserialized [WebPage].
return returnValue;
}