toJson method
Implementation
Map<String, dynamic> toJson() {
return {
'id': id,
'title': title,
'content': content,
'image': image,
'is_pinned': isPinned,
'is_approved': isApproved,
'likes_count': likesCount,
'comments_count': commentsCount,
'user': user.toJson(),
'community': community.toJson(),
'is_liked_by_user': isLikedByUser,
'created_at': createdAt.toIso8601String(),
'updated_at': updatedAt.toIso8601String(),
};
}