PageBlockEmbed.deserialize constructor

PageBlockEmbed.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

factory PageBlockEmbed.deserialize(BinaryReader reader) {
  // Read [PageBlockEmbed] fields.
  final flags = reader.readInt32();
  final fullWidth = (flags & 1) != 0;
  final allowScrolling = (flags & 8) != 0;
  final hasUrlField = (flags & 2) != 0;
  final url = hasUrlField ? reader.readString() : null;
  final hasHtmlField = (flags & 4) != 0;
  final html = hasHtmlField ? reader.readString() : null;
  final hasPosterPhotoIdField = (flags & 16) != 0;
  final posterPhotoId = hasPosterPhotoIdField ? reader.readInt64() : null;
  final hasWField = (flags & 32) != 0;
  final w = hasWField ? reader.readInt32() : null;
  final hasHField = (flags & 32) != 0;
  final h = hasHField ? reader.readInt32() : null;
  final caption = reader.readObject() as PageCaptionBase;

  // Construct [PageBlockEmbed] object.
  final returnValue = PageBlockEmbed(
    fullWidth: fullWidth,
    allowScrolling: allowScrolling,
    url: url,
    html: html,
    posterPhotoId: posterPhotoId,
    w: w,
    h: h,
    caption: caption,
  );

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