getcommentsfetch method
Future<void>
getcommentsfetch(
})
Implementation
Future<void> getcommentsfetch(Rxn<List<APIPostComments>> comments, int postID,
{bool fetchRestart = false}) async {
if (!fetchRestart && comments.value != null) {
return;
}
if (fetchCommentStatus.value) {
return;
}
fetchCommentStatus.value = true;
if (fetchRestart) {
comments.value = null;
}
PostCommentsFetchResponse response =
await service.postsServices.commentsfetch(postID: postID);
if (!response.result.status) {
log(response.result.description);
fetchCommentStatus.value = false;
return;
}
//Eğer veri null ise nullu boz Yorumları başlatma dizisi eşitle
comments.value ??= [];
//Veriler çek
for (APIPostComments element in response.response!) {
//Post yorumlarına ekler
comments.value!.add(element);
}
comments.refresh();
fetchCommentStatus.value = false;
}