KeyboardButtonRequestPeer.deserialize constructor

KeyboardButtonRequestPeer.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

factory KeyboardButtonRequestPeer.deserialize(BinaryReader reader) {
  // Read [KeyboardButtonRequestPeer] fields.
  final flags = reader.readInt32();
  final hasStyleField = (flags & 1024) != 0;
  final style =
      hasStyleField ? reader.readObject() as KeyboardButtonStyleBase : null;
  final text = reader.readString();
  final buttonId = reader.readInt32();
  final peerType = reader.readObject() as RequestPeerTypeBase;
  final maxQuantity = reader.readInt32();

  // Construct [KeyboardButtonRequestPeer] object.
  final returnValue = KeyboardButtonRequestPeer(
    style: style,
    text: text,
    buttonId: buttonId,
    peerType: peerType,
    maxQuantity: maxQuantity,
  );

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