getDiscussionComments method

Future<List<Comment>> getDiscussionComments({
  1. required int topicId,
  2. String? orderBy,
  3. required int offset,
  4. required int pageSize,
})

Implementation

Future<List<Comment>> getDiscussionComments({
  required int topicId,
  String? orderBy,
  required int offset,
  required int pageSize,
}) async {
  final data = await makeGraphQLRequest(getGraphQLPayloadDiscussionComments(
    topicId: topicId,
    orderBy: orderBy,
    offset: offset,
    pageSize: pageSize,
  ));
  final list = data['data']['topicComments']['data'] as List;
  return list.cast<Map<String, dynamic>>().map(Comment.fromJson).toList();
}