sendTextNote method

Event sendTextNote(
  1. String text, [
  2. List tags = const []
])

Publishes a text_note event.

text is the text that will form the content of the published event. tags is a JSON object of event tags to be included with the text note.

Note that the transmission of the event to connected relays occurs asynchronously. nostr_dart maintains a message queue for each relay so that messages will be sent one at a time only after the previous message has acknowledged by the relay or a timeout occurs. This requires relays used to support NIP-15 and NIP-20.

The Event returned is the Nostr event that was published.

An ArgumentError is thrown if the private key hasn't been set.

Example:

final event = nostr.sendTextNote("Hello Nostr!", [
  ["e", "91cf9..4e5ca"],["p", "612ae..e610f"]
]);

Implementation

Event sendTextNote(String text, [List<dynamic> tags = const []]) {
  Event event = Event(_publicKey, EventKind.textNote, tags, text);
  return sendEvent(event);
}