#
Requests
low level
#
Usage Example
final response = ndk.requests.query(
filters: [
// Define a filter for the query
Filter(
// Query for fiatjaf npub180cvv07tjdrrgpa0j7j7tmnyl2yr6yr7l8j4s3evf6u64th6gkwsyjh6w6
authors: [
'3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d'
],
// Query for text note events (kind 1)
kinds: [Nip01Event.kTextNodeKind],
// Limit the results to 10 events
limit: 10,
),
],
);
int eventCount = 0;
// Process the events as they arrive
await for (final event in response.stream) {
print(event);
eventCount++;
}
#
When to use
Requests should be used when no other use case fits your needs.
There is .query
and .subscription
representing the nostr equivalent, .subscription
should only be used when absolutely necessary. Many relays limit the amount of simultaneous subscriptions.