populate method

Future<Comment> populate()

Promotes this CommentRef into a populated Comment.

Implementation

Future<Comment> populate() async {
  final params = {
    'id': reddit.config.commentKind + '_' + _id,
  };
  // Gets some general info about the comment.
  final result = await reddit.get(apiPath['info'], params: params);
  final List listing = result['listing'];
  if (listing.isEmpty) {
    throw DRAWInvalidCommentException(_id);
  }
  final comment = listing[0];

  // The returned comment isn't fully populated, so refresh it here to
  // grab replies, etc.
  await comment.refresh();
  return comment;
}