InlineKeyboardAttachment.fromJson constructor

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

Implementation

factory InlineKeyboardAttachment.fromJson(Map<String, dynamic> json) {
  final payload = json['payload'] as Map<String, dynamic>;
  final buttonsList = payload['buttons'] as List<dynamic>;
  return InlineKeyboardAttachment(
    buttons: buttonsList
        .map((row) => (row as List<dynamic>)
            .map((btn) => Button.fromJson(btn as Map<String, dynamic>))
            .toList())
        .toList(),
  );
}