fromJson static method

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

Implementation

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

  return ForumTopic(
    info: ForumTopicInfo.fromJson(tdMapFromJson(json['info'])),
    lastMessage: Message.fromJson(tdMapFromJson(json['last_message'])),
    order: int.tryParse((json['order'] as dynamic)?.toString() ?? '') ?? 0,
    isPinned: (json['is_pinned'] 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,
    unreadMentionCount: (json['unread_mention_count'] as int?) ?? 0,
    unreadReactionCount: (json['unread_reaction_count'] as int?) ?? 0,
    unreadPollVoteCount: (json['unread_poll_vote_count'] as int?) ?? 0,
    notificationSettings: ChatNotificationSettings.fromJson(
      tdMapFromJson(json['notification_settings']),
    ),
    draftMessage: DraftMessage.fromJson(tdMapFromJson(json['draft_message'])),
  );
}