Nip01Event constructor

Nip01Event({
  1. required String pubKey,
  2. required int kind,
  3. required List tags,
  4. required String content,
  5. int? publishAt,
})

Creates a new Nostr event.

pubKey is the author's public key. kind is the event kind. tags is a JSON object of event tags. content is an arbitrary string.

Nostr event id and created_at fields are calculated automatically.

Implementation

Nip01Event({
  required this.pubKey,
  required this.kind,
  required this.tags,
  required this.content,
  int? publishAt,
}) {
  if (publishAt != null) {
    createdAt = publishAt;
  } else {
    createdAt = _secondsSinceEpoch();
  }
  id = _calculateId(pubKey, createdAt, kind, tags, content);
}