RejectRequestVPResponseMessage.fromJson constructor

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

Implementation

factory RejectRequestVPResponseMessage.fromJson(Map<String, dynamic> json) {
  try {
    if (json.containsKey("type") && json["type"] != "VPReqRejectRes") {
      throw Exception("Invalid type");
    }
    return RejectRequestVPResponseMessage(
      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,
    );
  } catch (e) {
    rethrow;
  }
}