fromJson static method

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

Creates a object from a json

Implementation

static Chat fromJson(Map<String, dynamic> json) {
  return Chat(
    id: json['id']!,
    type: json['type']!,
    title: json['title'],
    username: json['username'],
    firstName: json['first_name'],
    lastName: json['last_name'],
    isForum: json['is_forum'],
    photo: callIfNotNull(ChatPhoto.fromJson, json['photo']),
    activeUsernames: List.from(json['active_usernames'] ?? []),
    emojiStatusCustomEmojiId: json['emoji_status_custom_emoji_id'],
    emojiStatusExpirationDate: json['emoji_status_expiration_date'],
    bio: json['bio'],
    hasPrivateForwards: json['has_private_forwards'],
    hasRestrictedVoiceAndVideoMessages:
        json['has_restricted_voice_and_video_messages'],
    joinToSendMessages: json['join_to_send_messages'],
    joinByRequest: json['join_by_request'],
    description: json['description'],
    inviteLink: json['invite_link'],
    pinnedMessage: callIfNotNull(Message.fromJson, json['pinned_message']),
    permissions: callIfNotNull(ChatPermissions.fromJson, json['permissions']),
    slowModeDelay: json['slow_mode_delay'],
    messageAutoDeleteTime: json['message_auto_delete_time'],
    hasAggressiveAntiSpamEnabled: json['has_aggressive_anti_spam_enabled'],
    hasHiddenMembers: json['has_hidden_members'],
    hasProtectedContent: json['has_protected_content'],
    stickerSetName: json['sticker_set_name'],
    canSetStickerSet: json['can_set_sticker_set'],
    linkedChatId: json['linked_chat_id'],
    location: callIfNotNull(
      ChatLocation.fromJson,
      json['location'],
    ),
  );
}