create static method

MenuButton create(
  1. Map<String, dynamic> json
)

Creates a new MenuButton object. This method decides which MenuButton subclass to use based on the type field.

Implementation

static MenuButton create(Map<String, dynamic> json) {
  return switch (MenuButtonType.fromJson(json['type'])) {
    MenuButtonType.commands => MenuButtonCommands.fromJson(json),
    MenuButtonType.webApp => MenuButtonWebApp.fromJson(json),
    MenuButtonType.defaultButton => MenuButtonDefault.fromJson(json),
  };
}