KeyboardButtonUserProfile.deserialize constructor

KeyboardButtonUserProfile.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

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

  // Construct [KeyboardButtonUserProfile] object.
  final returnValue = KeyboardButtonUserProfile(
    style: style,
    text: text,
    userId: userId,
  );

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