nostr_client 0.2.0
A nostr client for dart and flutter.
Features
x
NIP-01: Basic protocol flow descriptionx
NIP-11: Relay Information Document
Getting Started
Add this package to the pubspec.yaml
of your flutter project:
dependencies:
nostr_client: ^0.2.0
Usage
import 'package:nostr_client/nostr_client.dart'
// Create a new relay instance and connect to the relay
final relay = Relay('wss://relay.nostr.info');
relay.connect();
// Print events sent by the relay
relay.stream.whereIsEvent().listen(print);
// Request text events from the relay and subscribe to updates
final filter = Filter(
kinds: [EventKind.text],
limit: 10,
);
final subscriptionId = relay.subscribe(filter);
// Cancel the subscription
relay.unsubscribe(subscriptionId);
// Disconnect from the relay
relay.disconnect();