Skip to main content

getCommentsForPost method

Future getCommentsForPost (String postId)

This function is used to fetch all comments on the post.

parameters:

  • postId - Post id for which comments need to be fetched.

Implementation

Future getCommentsForPost(String postId) async {
final String getCommmentQuery = CommentQueries().getPostsComments(postId);
final result = await _dbFunctions.gqlAuthMutation(getCommmentQuery);
if (result.data != null) {
return result.data["commentsByPost"] as List;
}
return [];
}