Chat.fromJson constructor
Parse from a json
Implementation
factory Chat.fromJson(Map<String, dynamic> json) => Chat(
id: json['id'],
type: ChatType.fromJson(json['type']),
title: json['title'],
photo: json['photo'] == null
? null
: ChatPhotoInfo.fromJson(json['photo']),
permissions: ChatPermissions.fromJson(json['permissions']),
lastMessage: json['last_message'] == null
? null
: Message.fromJson(json['last_message']),
positions: List<ChatPosition>.from((json['positions'] ?? [])
.map((item) => ChatPosition.fromJson(item))
.toList()),
messageSenderId: json['message_sender_id'] == null
? null
: MessageSender.fromJson(json['message_sender_id']),
hasProtectedContent: json['has_protected_content'],
isTranslatable: json['is_translatable'],
isMarkedAsUnread: json['is_marked_as_unread'],
isBlocked: json['is_blocked'],
hasScheduledMessages: json['has_scheduled_messages'],
canBeDeletedOnlyForSelf: json['can_be_deleted_only_for_self'],
canBeDeletedForAllUsers: json['can_be_deleted_for_all_users'],
canBeReported: json['can_be_reported'],
defaultDisableNotification: json['default_disable_notification'],
unreadCount: json['unread_count'],
lastReadInboxMessageId: json['last_read_inbox_message_id'],
lastReadOutboxMessageId: json['last_read_outbox_message_id'],
unreadMentionCount: json['unread_mention_count'],
unreadReactionCount: json['unread_reaction_count'],
notificationSettings:
ChatNotificationSettings.fromJson(json['notification_settings']),
availableReactions:
ChatAvailableReactions.fromJson(json['available_reactions']),
messageAutoDeleteTime: json['message_auto_delete_time'],
background: json['background'] == null
? null
: ChatBackground.fromJson(json['background']),
themeName: json['theme_name'],
actionBar: json['action_bar'] == null
? null
: ChatActionBar.fromJson(json['action_bar']),
videoChat: VideoChat.fromJson(json['video_chat']),
pendingJoinRequests: json['pending_join_requests'] == null
? null
: ChatJoinRequestsInfo.fromJson(json['pending_join_requests']),
replyMarkupMessageId: json['reply_markup_message_id'],
draftMessage: json['draft_message'] == null
? null
: DraftMessage.fromJson(json['draft_message']),
clientData: json['client_data'],
extra: json['@extra'],
clientId: json['@client_id'],
);