NostrFilter.fromJson constructor

NostrFilter.fromJson(
  1. Map<String, dynamic> json
)

Deserialize aNpstrFilter from a JSON

Implementation

factory NostrFilter.fromJson(Map<String, dynamic> json) {
  final ids = json['ids'] == null ? null : List<String>.from(json['ids']);
  final authors =
      json['authors'] == null ? null : List<String>.from(json['authors']);
  final kinds = json['kinds'] == null ? null : List<int>.from(json['kinds']);
  final e = json['#e'] == null ? null : List<String>.from(json['#e']);
  final p = json['#p'] == null ? null : List<String>.from(json['#p']);
  final t = json['#t'] == null ? null : List<String>.from(json['#t']);
  final since = DateTime.fromMillisecondsSinceEpoch(json['since'] * 1000);
  final until = DateTime.fromMillisecondsSinceEpoch(json['until'] * 1000);
  final limit = json['limit'];

  return NostrFilter(
    ids: ids,
    authors: authors,
    kinds: kinds,
    e: e,
    p: p,
    t: t,
    since: since,
    until: until,
    limit: limit,
  );
}