BotInlineMessageMediaGeo.deserialize constructor

BotInlineMessageMediaGeo.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

factory BotInlineMessageMediaGeo.deserialize(BinaryReader reader) {
  // Read [BotInlineMessageMediaGeo] fields.
  final flags = reader.readInt32();
  final geo = reader.readObject() as GeoPointBase;
  final hasHeadingField = (flags & 1) != 0;
  final heading = hasHeadingField ? reader.readInt32() : null;
  final hasPeriodField = (flags & 2) != 0;
  final period = hasPeriodField ? reader.readInt32() : null;
  final hasProximityNotificationRadiusField = (flags & 8) != 0;
  final proximityNotificationRadius =
      hasProximityNotificationRadiusField ? reader.readInt32() : null;
  final hasReplyMarkupField = (flags & 4) != 0;
  final replyMarkup =
      hasReplyMarkupField ? reader.readObject() as ReplyMarkupBase : null;

  // Construct [BotInlineMessageMediaGeo] object.
  final returnValue = BotInlineMessageMediaGeo(
    geo: geo,
    heading: heading,
    period: period,
    proximityNotificationRadius: proximityNotificationRadius,
    replyMarkup: replyMarkup,
  );

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