postComment method

Future<Comment?> postComment(
  1. String entityId,
  2. String content
)

Posts a new comment for an entity.

Creates a new comment with the current user's information. The comment ID will be generated by the service implementation.

entityId is the identifier of the entity to comment on. content is the text content of the comment.

Returns the created Comment if successful, or null if the operation failed.

Implementation

Future<Comment?> postComment(String entityId, String content) async {
  final comment = Comment(
    id: '',
    date: DateTime.now(),
    content: content,
    entityId: entityId,
    userId: user.uuid,
    username: user.name,
  );
  return await service.postComment(comment, config);
}