InputMediaGeoLive.deserialize constructor

InputMediaGeoLive.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

factory InputMediaGeoLive.deserialize(BinaryReader reader) {
  // Read [InputMediaGeoLive] fields.
  final flags = reader.readInt32();
  final stopped = (flags & 1) != 0;
  final geoPoint = reader.readObject() as InputGeoPointBase;
  final hasHeadingField = (flags & 4) != 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;

  // Construct [InputMediaGeoLive] object.
  final returnValue = InputMediaGeoLive(
    stopped: stopped,
    geoPoint: geoPoint,
    heading: heading,
    period: period,
    proximityNotificationRadius: proximityNotificationRadius,
  );

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