KeyboardButtonSwitchInline.deserialize constructor

KeyboardButtonSwitchInline.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

factory KeyboardButtonSwitchInline.deserialize(BinaryReader reader) {
  // Read [KeyboardButtonSwitchInline] fields.
  final flags = reader.readInt32();
  final samePeer = (flags & 1) != 0;
  final text = reader.readString();
  final query = reader.readString();
  final hasPeerTypesField = (flags & 2) != 0;
  final peerTypes = hasPeerTypesField
      ? reader.readVectorObject<InlineQueryPeerTypeBase>()
      : null;

  // Construct [KeyboardButtonSwitchInline] object.
  final returnValue = KeyboardButtonSwitchInline(
    samePeer: samePeer,
    text: text,
    query: query,
    peerTypes: peerTypes,
  );

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