Event class

Represents an event, which is the only object type in the system.

An event has the following properties:

  • id: A 32-byte hex-encoded sha256 hash of the serialized event data.
  • pubkey: A 32-byte hex-encoded public key of the event creator.
  • created_at: A unix timestamp in seconds indicating when the event was created.
  • kind: An integer representing the kind of the event.
  • tags: A list of lists representing tags of the event. Each tag list has three elements:
    1. The type of the tag (either "e" or "p").
    2. A 32-byte hex-encoded ID of another event (for type "e") or a 32-byte hex-encoded key (for type "p").
    3. A recommended relay URL.
  • content: An arbitrary string representing the content of the event.
  • sig: A 64-byte signature of the sha256 hash of the serialized event data, which is the same as the id field.

Additionally, an event may have a subscriptionId property, which is a random string used to represent a subscription.

Constructors

Event({required int kind, required List<List<String>> tags, required String content, required int created_at, String id = '', String sig = '', String pubkey = '', String? subscriptionId, bool verify = true})
Creates a new instance of the Event class.
Event.deserialize(List input, {bool verify = true})
Deserializes an event from a wire-format representation.
factory

Properties

content String
An arbitrary string representing the content of the event.
final
created_at int
A unix timestamp in seconds indicating when the event was created.
final
hashCode int
The hash code for this object.
no setterinherited
id String
A 32-byte hex-encoded sha256 hash of the serialized event data (hex).
getter/setter pair
kind int
An integer representing the kind of the event.
final
pubkey String
A 32-byte hex-encoded public key of the event creator (hex).
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sig String
A 64-byte signature of the sha256 hash of the serialized event data, which is the same as the id field.
getter/setter pair
subscriptionId String?
A random string used to represent a subscription.
getter/setter pair
tags List<List<String>>
A list of lists representing tags of the event.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Converts this instance of the Event class to a JSON object.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited