void getCommunityFeed() {
_myCommunityFeedController = PagingController(
pageFuture: (token) => AmitySocialClient.newPostRepository()
.getPosts()
.targetCommunity(communityId)
.includeDeleted(false)
.getPagingData(token: token, limit: 20),
pageSize: 20,
)..addListener(() {
if (_myCommunityFeedController.error == null) {
communityAmityPosts.clear();
communityAmityPosts.addAll(_myCommunityFeedController.loadedItems);
print('Fetched Community Posts');
print(communityAmityPosts);
} else {}
});
notifyListeners();
_myCommunityFeedController.fetchNextPage();
}
void createTextPost(String text) {
AmitySocialClient.newPostRepository()
.createPost()
.targetCommunity(communityId)
.text(text)
.post()
.then((AmityPost amityPost) {
print("Text Post added successfully");
}).onError((error, stackTrace) {
print("Error while creating a text post");
print(error);
print(stackTrace);
});
The post is created happens successfully but am unable to get the data from the targetCommunity.