BlobNip94.fromJson constructor
converts json response to BlobNip94,
does not work with nostr events! (tags)
Implementation
factory BlobNip94.fromJson(Map<String, dynamic> json) {
return BlobNip94(
//? servers can't be trusted
content: json['content'] ?? '',
url: json['url'] ?? '',
mimeType: json['m'] ?? '',
sha256: json['x'] ?? '',
// parse int from string
size: _parseSize(json['size']),
dimenssions: json['dim'].toString(),
magnet: json['magnet'],
torrentInfoHash: json['i'],
blurhash: json['blurhash'],
thumbnail: json['thumb'] != null ? [json['thumb'] as String] : null,
image: json['image'] != null ? [json['image'] as String] : null,
summary: json['summary'],
alt: json['alt'],
fallback: json['fallback'] != null ? [json['fallback'] as String] : null,
service: json['service'],
);
}