fromMap static method

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

Construct from Map.

Implementation

static ChatPermissions? 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 can_send_basic_messages = _map['can_send_basic_messages']! as bool;
  var can_send_audios = _map['can_send_audios']! as bool;
  var can_send_documents = _map['can_send_documents']! as bool;
  var can_send_photos = _map['can_send_photos']! as bool;
  var can_send_videos = _map['can_send_videos']! as bool;
  var can_send_video_notes = _map['can_send_video_notes']! as bool;
  var can_send_voice_notes = _map['can_send_voice_notes']! as bool;
  var can_send_polls = _map['can_send_polls']! as bool;
  var can_send_other_messages = _map['can_send_other_messages']! as bool;
  var can_add_web_page_previews = _map['can_add_web_page_previews']! as bool;
  var can_change_info = _map['can_change_info']! as bool;
  var can_invite_users = _map['can_invite_users']! as bool;
  var can_pin_messages = _map['can_pin_messages']! as bool;
  var can_manage_topics = _map['can_manage_topics']! as bool;
  return ChatPermissions(
    extra: extra,
    clientId: clientId,
    can_send_basic_messages: can_send_basic_messages,
    can_send_audios: can_send_audios,
    can_send_documents: can_send_documents,
    can_send_photos: can_send_photos,
    can_send_videos: can_send_videos,
    can_send_video_notes: can_send_video_notes,
    can_send_voice_notes: can_send_voice_notes,
    can_send_polls: can_send_polls,
    can_send_other_messages: can_send_other_messages,
    can_add_web_page_previews: can_add_web_page_previews,
    can_change_info: can_change_info,
    can_invite_users: can_invite_users,
    can_pin_messages: can_pin_messages,
    can_manage_topics: can_manage_topics,
  );
}