fromMap static method

BotInfo? fromMap(
  1. Map<String, dynamic>? _map
)
override

Construct from Map.

Implementation

static BotInfo? fromMap(Map<String, dynamic>? _map) {
  if (_map == null) return null;
  var _ = _map["@type"];
  if (_ != CONSTRUCTOR) return null;
  var extra = _map['@extra'];
  var clientId = _map['@clientId'];
  var short_description = _map['short_description']! as String;
  var description = _map['description']! as String;
  var photo = Photo.fromMap(_map['photo']);
  var animation = Animation.fromMap(_map['animation']);
  var menu_button = BotMenuButton.fromMap(_map['menu_button']);
  var commands = List<BotCommand>.from(
    (_map["commands"] ?? []).map(
      (e) => BotCommand.fromMap(e),
    ),
  );
  var default_group_administrator_rights = ChatAdministratorRights.fromMap(
      _map['default_group_administrator_rights']);
  var default_channel_administrator_rights = ChatAdministratorRights.fromMap(
      _map['default_channel_administrator_rights']);
  var edit_commands_link =
      InternalLinkType.fromMap(_map['edit_commands_link']);
  var edit_description_link =
      InternalLinkType.fromMap(_map['edit_description_link']);
  var edit_description_media_link =
      InternalLinkType.fromMap(_map['edit_description_media_link']);
  var edit_settings_link =
      InternalLinkType.fromMap(_map['edit_settings_link']);
  return BotInfo(
    extra: extra,
    clientId: clientId,
    short_description: short_description,
    description: description,
    photo: photo,
    animation: animation,
    menu_button: menu_button,
    commands: commands,
    default_group_administrator_rights: default_group_administrator_rights,
    default_channel_administrator_rights:
        default_channel_administrator_rights,
    edit_commands_link: edit_commands_link,
    edit_description_link: edit_description_link,
    edit_description_media_link: edit_description_media_link,
    edit_settings_link: edit_settings_link,
  );
}