Skip to main content

createComments method

Future<void> createComments (String postId, String text)

This function is used to add comment on the post.

parameters:

  • postId - Post id where comment need to be added.
  • text - content of the comment.

Implementation

Future<void> createComments(String postId, String text) async {
print("comment service called");
final String createCommentQuery = CommentQueries().createComment();
final result = await _dbFunctions.gqlAuthMutation(
createCommentQuery,
variables: {
'postId': postId, //Add your variables here
'text': text
},
);
print("comment added");
print(result);
return result;
}