KeyboardButton.fromJson constructor

KeyboardButton.fromJson(
  1. Map<String, dynamic> json
)

Creates a new KeyboardButton from a JSON object.

Implementation

factory KeyboardButton.fromJson(Map<String, dynamic> json) {
  return KeyboardButton(
    text: json['text'],
    requestContact: json['request_contact'] ?? false,
    requestLocation: json['request_location'] ?? false,
    requestPoll: json['request_poll'] != null
        ? KeyboardButtonPollType.fromJson(json['request_poll'])
        : null,
    webApp:
        json['web_app'] != null ? WebAppInfo.fromJson(json['web_app']) : null,
    requestUsers: json['request_users'] != null
        ? KeyboardButtonRequestUsers.fromJson(json['request_users'])
        : null,
    requestChat: json['request_chat'] != null
        ? KeyboardButtonRequestChat.fromJson(json['request_chat'])
        : null,
  );
}