Comment constructor

Comment({
  1. required String id,
  2. required DateTime date,
  3. String? parentId,
  4. required String content,
  5. required String entityId,
  6. required String userId,
  7. required String username,
  8. int? likeCount,
  9. int? replyCount,
  10. bool? isLiked,
  11. bool isMine = false,
  12. List<Comment> replies = const [],
})

Creates a new Comment.

Required parameters:

  • id: Unique identifier
  • date: Creation date and time
  • content: Comment text
  • entityId: ID of the entity this comment belongs to
  • userId: ID of the comment author
  • username: Display name of the comment author

Optional parameters:

  • parentId: ID of parent comment (for replies)
  • likeCount: Number of likes (default: null)
  • replyCount: Number of replies (default: null)
  • isLiked: Whether current user liked it (default: null)
  • isMine: Whether current user created it (default: false)
  • replies: List of direct replies (default: empty list)

Implementation

Comment({
  required this.id,
  required this.date,
  this.parentId,
  required this.content,
  required this.entityId,
  required this.userId,
  required this.username,
  this.likeCount,
  this.replyCount,
  this.isLiked,
  this.isMine = false,
  this.replies = const [],
});