nostr
A Flutter library for Nostr implemented in Dart.
Dispute is a basic nostr client written in flutter with this library that will show you an implementation.
Getting started
flutter pub add nostr
NIPS
xNIP-01 Basic protocol flowxNIP-02 Follow List and PetnamesxNIP-05 DNS-based Internet IdentifiersxNIP-09 Event Deletion RequestxNIP-10 Text Note ThreadingxNIP-11 Relay Information DocumentxNIP-13 Proof of WorkxNIP-17 Private Direct MessagesxNIP-18 RepostsxNIP-19 Bech32-encoded EntitiesxNIP-20 Command ResultsxNIP-21 nostr: URI SchemexNIP-22 CommentsxNIP-23 Long-form ContentxNIP-25 ReactionsxNIP-27 Text Note ReferencesxNIP-28 Public ChatxNIP-29 Relay-based GroupsxNIP-32 LabelingxNIP-38 User StatusesxNIP-40 Expiration TimestampxNIP-42 AuthenticationxNIP-44 Encrypted Payloads (Versioned)~NIP-46 Nostr Connect — kind 24133 event envelope only. Nobunker:///nostrconnect://URI parsing, no JSON-RPC method encoders. Bring your own.~NIP-47 Wallet Connect — kind 13194/2319x event envelopes only. Nonostr+walletconnect://URI parsing, no JSON-RPC method encoders.xNIP-50 Search Capability~NIP-51 Lists — create helpers for kinds 10000/10001/30000/30001 only. Other list kinds (10003-10102, 30002-30030, etc.) need to be built by hand usingEvent.from.xNIP-53 Live ActivitiesxNIP-57 Lightning ZapsxNIP-58 BadgesxNIP-59 Gift WrapxNIP-65 Relay List MetadataxNIP-72 Moderated CommunitiesxNIP-89 Application HandlersxNIP-94 File MetadataxNIP-98 HTTP Auth
Usage
import 'package:nostr/nostr.dart';
// Generate or import keys
final keys = Keys.generate();
print('Public key: ${keys.public}');
print('npub: ${keys.npub}');
// Create and sign an event
final event = Event.from(
kind: 1,
tags: [],
content: 'Hello Nostr!',
secretKey: keys.secret,
);
// Serialize for relay
print(event.serialize());
// Subscribe to events
final request = Request(
subscriptionId: generateRandomHex(),
filters: [const Filter(kinds: [1], limit: 10)],
);
print(request.serialize());
For more examples, see the example/ directory.
Libraries
- nostr
- A Dart library for the Nostr protocol.