+
+

fromData static method +

+ +
+ + +FutureOr<EventMessage> +fromData({
  1. required EventSigner signer,
  2. +
  3. required int kind,
  4. +
  5. required String content,
  6. +
  7. List<List<String>> tags = const [],
  8. +
  9. DateTime? createdAt,
  10. +
}) + + + +
+ + + + +
+

Implementation

+
static FutureOr<EventMessage> fromData({
+  required EventSigner signer,
+  required int kind,
+  required String content,
+  List<List<String>> tags = const [],
+  DateTime? createdAt,
+}) async {
+  createdAt ??= DateTime.now();
+
+  final String eventId = calculateEventId(
+    publicKey: signer.publicKey,
+    createdAt: createdAt,
+    kind: kind,
+    tags: tags,
+    content: content,
+  );
+
+  return EventMessage(
+    id: eventId,
+    pubkey: signer.publicKey,
+    createdAt: createdAt,
+    kind: kind,
+    tags: tags,
+    content: content,
+    sig: await signer.sign(message: eventId),
+  );
+}
+
+ + +