loadEvents method
Implementation
@override
Future<List<Nip01Event>> loadEvents({
List<String>? pubKeys,
List<int>? kinds,
String? pTag,
int? since,
int? until,
}) async {
if (since != null || until != null) {
throw Exception("since | until not implemented");
}
List<Nip01Event> events = isar_ds.isar.dbEvents
.where()
.optional(kinds != null && kinds.isNotEmpty,
(q) => q.anyOf(kinds!, (q, kind) => q.kindEqualTo(kind)))
.and()
.optional(pubKeys != null && pubKeys.isNotEmpty,
(q) => q.anyOf(pubKeys!, (q, pubKey) => q.pubKeyEqualTo(pubKey)))
// .and()
// .optional(Helpers.isNotBlank(pTag), (q) => q.pTagsElementEqualTo(pTag!))
.findAll();
events = Helpers.isNotBlank(pTag)
? events.where((event) => event.pTags.contains(pTag)).toList()
: events;
return eventFilter != null
? events.where((event) => eventFilter!.filter(event)).toList()
: events;
}