nostr_dart 0.1.0 copy "nostr_dart: ^0.1.0" to clipboard
nostr_dart: ^0.1.0 copied to clipboard

A Nostr client library written in Dart

A Nostr client library written in Dart.

Features #

Use this library in your Dart/Flutter app to:

  • Connect to Nostr relays.
  • Publish set_metadata, text_note and recommend_server events to connected relays.
  • Request events and subscribe to updates.

Currently implements NIP-01, NIP-13, NIP-15 and NIP-20

Getting started #

Add the following to your pubspec.yaml:

dependencies:
  nostr_dart: ^[version]

Usage #

Initialise nostr_dart:

import 'package:nostr/nostr.dart';

final nostr = Nostr.init(privateKey: [private key], powDifficulty: [difficulty]);

Add a relay:

await nostr.addRelay([relay url]);

Retrieve events from connected relays and subscribe to updates:

final subId = await nostr.subscribe([filters], [subscription id])

Read retrieved events:

for (Event event in nostr.events) {
    print('ID: ${event.id}. Content: ${event.content}');
}

Publish a text note:

final result = await nostr.sendTextNote([content], [tags]);

Publish metadata:

final result = await nostr.setMetaData(name: [name], about: [about], picture: [picture url]);

Publish server recommendation:

final result = await nostr.recommendServer([relay url]);

Remove an existing subscription:

nostr.unsubscribe([subscription id]);

Remove a connected relay:

nostr.removeRelay([relay url]);
1
likes
0
pub points
12%
popularity

Publisher

unverified uploader

A Nostr client library written in Dart

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

bip340, clock, crypto, hex, string_validator, web_socket_channel

More

Packages that depend on nostr_dart