ExpungeRequest.fromJson constructor
ExpungeRequest.fromJson(
- Map<String, dynamic> json
)
Implementation
factory ExpungeRequest.fromJson(Map<String, dynamic> json) {
final peerIdRaw = json['peerId'];
PeerId peerId;
if (peerIdRaw is String) {
peerId = PeerId.fromString(peerIdRaw);
} else if (peerIdRaw is List) {
peerId = PeerId.fromBytes(Uint8List.fromList(peerIdRaw.cast<int>()));
} else {
throw FormatException('Invalid peerId format: ${peerIdRaw.runtimeType}');
}
return ExpungeRequest(
peerId: peerId,
folderPath: json['folderPath'] as String?,
);
}