create static method
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 (json['type']) {
'commands' => MenuButtonCommands.fromJson(json),
'web_app' => MenuButtonWebApp.fromJson(json),
_ => MenuButtonDefault.fromJson(json),
};
}