Comments

Social SDK now supports and facilities with comments option in the flutter version create, update, delete and view comments.

Initialize a Repository Instance

An instance/object of AmitySocialClient will be created.

Comment Query

AmityCommentRepository provides getComments() method to query for comments. The query returns a LiveCollection of all the matching comments available.

To query for replies to a specific comment. You can pass the commentId as the parentIdparentId = commentId . To get parent level, you don't need to define parentId .

To query for comments and replies that are deleted. You can pass true or false in includeDeleted(...) method.

The objects that return when you call the getComments() method are List<AmityComment> in PagingController. If you want to know which comments are deleted, you can check from isDeleted attribute in AmityComment.

Note: If you use the includeDeleted(...) method, you don't need to check isDeleted() method in the AmityComment for deleted comments.

Create Comment

AmityCommentRepository provides createComment() method to create comment. You can provide contentId, parentId and text while creating a comment. parentId is an optional parameter, useful for replying to a comment where you can reply to a message object with a parentId.

A comment should not exceed 20,000 characters in length. For now, only text data is supported in the creation method.

View Comment

Currently, AmityComment has one data type TEXT. Other types are coming soon.

In order to get live update from any changes or bind with StreamBuilder widget, you can alternatively use AmityComment.listen

Edit Comment

The any of the create comment can be edited by the user any time. For editing the comment updateComment function is called by the system.

Delete Comment

User can only delete the comment that was added by that user. To delete the comment deleteomment function works.

Create Reply Comment

Create Reply Query

Last updated