createComment method

Future<void> createComment(
  1. String postId,
  2. String text
)

Implementation

Future<void> createComment(String postId, String text) async {
  await AmitySocialClient.newCommentRepository()
      .createComment()
      .post(postId)
      .create()
      .text(text)
      .send()
      .then((comment) async {
    _controller.add(comment);
    amityComments.clear();
    amityComments.addAll(_controller.loadedItems);
    Future.delayed(const Duration(milliseconds: 300)).then((value) {
      scrollcontroller.jumpTo(scrollcontroller.position.maxScrollExtent);
    });
  }).onError((error, stackTrace) async {
    log(error.toString());
    await AmityDialog()
        .showAlertErrorDialog(title: "Error!", message: error.toString());
  });
}