Event.fromJson constructor

Event.fromJson(
  1. Map<String, dynamic> json, {
  2. bool verify = true,
})

Deserialize an event from a JSON

verify: enable/disable events checks

This option adds event checks such as id, signature, non-futuristic event: default=True

Performances could be a reason to disable event checks

Implementation

factory Event.fromJson(Map<String, dynamic> json, {bool verify = true}) {
  var tags = (json['tags'] as List<dynamic>)
      .map((e) => (e as List<dynamic>).map((e) => e as String).toList())
      .toList();
  return Event(
    json['id'],
    json['pubkey'],
    json['created_at'],
    json['kind'],
    tags,
    json['content'],
    json['sig'],
    verify: verify,
  );
}