fromJson static method

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

Implementation

static DirectMessagesChatTopic? fromJson(Map<String, dynamic>? json) {
  if (json == null) {
    return null;
  }

  return DirectMessagesChatTopic(
    chatId: (json['chat_id'] as int?) ?? 0,
    id: (json['id'] as int?) ?? 0,
    senderId: MessageSender.fromJson(tdMapFromJson(json['sender_id'])),
    order: int.tryParse((json['order'] as dynamic)?.toString() ?? '') ?? 0,
    canSendUnpaidMessages:
        (json['can_send_unpaid_messages'] as bool?) ?? false,
    isMarkedAsUnread: (json['is_marked_as_unread'] as bool?) ?? false,
    unreadCount: (json['unread_count'] as int?) ?? 0,
    lastReadInboxMessageId: (json['last_read_inbox_message_id'] as int?) ?? 0,
    lastReadOutboxMessageId:
        (json['last_read_outbox_message_id'] as int?) ?? 0,
    unreadReactionCount: (json['unread_reaction_count'] as int?) ?? 0,
    lastMessage: Message.fromJson(tdMapFromJson(json['last_message'])),
    draftMessage: DraftMessage.fromJson(tdMapFromJson(json['draft_message'])),
  );
}