getPublicSets method

Stream<Iterable<Nip51Set>?> getPublicSets({
  1. required int kind,
  2. String? publicKey,
  3. bool forceRefresh = false,
})

Returns a stream of public sets for a given public key, default is pubkey of logged in user.

Queries relays for all sets of the specified kind belonging to the given public key. Only public (non-encrypted) sets are returned.

kind the kind of sets to retrieve
publicKey the public key of the user whose sets to retrieve, default logged in pubkey
forceRefresh if true, skip cache and query relays directly

Returns a stream that emits collections of sets as they are discovered.

Implementation

Stream<Iterable<Nip51Set>?> getPublicSets({
  required int kind,
  String? publicKey,
  bool forceRefresh = false,
}) {
  final EventSigner mySigner;
  if (publicKey == null) {
    if (_eventSigner == null) {
      throw Exception("getPublicSets() no account");
    }
    mySigner = _eventSigner!;
  } else {
    mySigner = Bip340EventSigner(privateKey: null, publicKey: publicKey);
  }

  return _getSets(kind, mySigner, forceRefresh: forceRefresh);
}