KeyboardButton class

This object represents one button of the reply keyboard. For simple text buttons String can be used instead of this object to specify text of the button. Optional fields are mutually exclusive.

Note: request_contact and request_location options will only work in Telegram versions released after 9 April, 2016.

Older clients will ignore them.

https://core.telegram.org/bots/api#keyboardbutton

Annotations
  • @JsonSerializable.new(includeIfNull: false)

Constructors

KeyboardButton({String? text, bool? requestContact, bool? requestLocation, KeyboardButtonPollType? requestPoll})
KeyboardButton.fromJson(Map<String, dynamic> json)
factory

Properties

hashCode → int
The hash code for this object.
no setterinherited
requestContact ↔ bool?
Optional. If True, the user's phone number will be sent as a contact when the button is pressed. Available in private chats only.
getter/setter pair
requestLocation ↔ bool?
Optional. If True, the user's current location will be sent when the button is pressed. Available in private chats only.
getter/setter pair
requestPoll ↔ KeyboardButtonPollType?
Optional. If specified, the user will be asked to create a poll and send it to the bot when the button is pressed. Available in private chats only.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
text ↔ String?
Text of the button. If none of the optional fields are used, it will be sent as a message when the button is pressed
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, dynamic>
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited