getSingleNip51List method
Future<Nip51List?>
getSingleNip51List(
- int kind,
- EventSigner signer, {
- bool forceRefresh = false,
- int timeout = 5,
return nip51 list by given kind
Implementation
Future<Nip51List?> getSingleNip51List(int kind, EventSigner signer,
{bool forceRefresh = false, int timeout = 5}) async {
Nip51List? list =
!forceRefresh ? await _getCachedNip51List(kind, signer) : null;
if (list == null) {
Nip51List? refreshedList;
await for (final event in _requests.query(
filters: [
Filter(
authors: [signer.getPublicKey()],
kinds: [kind],
)
],
).stream) {
if (refreshedList == null ||
refreshedList.createdAt <= event.createdAt) {
refreshedList = await Nip51List.fromEvent(event, signer);
// if (Helpers.isNotBlank(event.content)) {
// Nip51List? decryptedList = await Nip51List.fromEvent(event, signer);
// refreshedList = decryptedList;
// }
await _cacheManager.saveEvent(event);
}
}
return refreshedList;
}
return list;
}