RejectRequestVPMessage.fromJson constructor
RejectRequestVPMessage.fromJson(
- Map<String, dynamic> json
)
Implementation
factory RejectRequestVPMessage.fromJson(Map<String, dynamic> json) {
try {
if (json.containsKey("type") && json["type"] != "VPReqReject") {
throw Exception("Invalid type");
}
return RejectRequestVPMessage(
id: json["id"],
from: json["from"],
to: (json["to"] as List<dynamic>)
.map<String>((e) => e.toString())
.toList(),
ack: json.containsKey("ack") ? List<String>.from(json["ack"]) : [],
createdTime: json.containsKey("createdTime") ? json["createdTime"] : 0,
expiresTime: json.containsKey("expiresTime") ? json["expiresTime"] : 0,
reason: json["body"]["reason"],
);
} catch (e) {
rethrow;
}
}