loadEvents method

  1. @override
Future<List<Nip01Event>> loadEvents({
  1. List<String>? pubKeys,
  2. List<int>? kinds,
  3. String? pTag,
  4. int? since,
  5. int? until,
})
override

Implementation

@override
Future<List<Nip01Event>> loadEvents({
  List<String>? pubKeys,
  List<int>? kinds,
  String? pTag,
  int? since,
  int? until,
}) async {
  List<Nip01Event> result = [];
  for (var event in events.values) {
    if (pubKeys != null && !pubKeys.contains(event.pubKey)) {
      continue;
    }
    if (kinds != null && !kinds.contains(event.kind)) {
      continue;
    }
    if (pTag != null && !event.pTags.contains(pTag)) {
      continue;
    }

    if (since != null && event.createdAt < since) {
      continue;
    }

    if (until != null && event.createdAt > until) {
      continue;
    }

    result.add(event);
  }
  return result;
}