isPostLiked method
Implementation
Future<bool> isPostLiked(String postId) async {
OrderedPagedCollection likes = await getLikes(postId);
String url = likes.first!;
do {
http.Response response = await http.get(
Uri.parse(url),
);
OrderedCollectionPage collection = OrderedCollectionPage.fromJson(
jsonDecode(utf8.decode(response.bodyBytes)));
if (collection.orderedItems.isEmpty) {
return false;
}
if (collection.orderedItems
.where((element) => element.actor == "https://${Config.domainName}/actor/${Config.ownActorId}")
.isNotEmpty) {
return true;
}
url = collection.next!;
} while (true);
}