InvitationPreview.fromJson constructor
Reads a preview, throwing a FormatException for one this version cannot read.
Implementation
factory InvitationPreview.fromJson(Map<String, dynamic> json) {
if (json['v'] != version) {
throw FormatException(
'unsupported invitation preview version ${json['v']}');
}
try {
return InvitationPreview(
publicDetails: _map(json['publicDetails'])!,
expiresAt: DateTime.parse(json['expiresAt']),
content: json['content'] == null
? null
: SealedInvitationContent.fromJson(json['content']),
);
} on FormatException {
rethrow;
} catch (e) {
throw FormatException('malformed invitation preview: $e');
}
}