toJson method

Map<String, dynamic> toJson()

Converts the VPRequestMessage instance to a JSON map.

Implementation

Map<String, dynamic> toJson() {
  try {
    final Map<String, dynamic> data = {};
    data["id"] = id;
    data["type"] = type;
    data["from"] = from;
    data["to"] = to;
    data["createdTime"] = createdTime;
    data["expiresTime"] = expiresTime;
    data["body"] = {
      "vcRequirements": vcRequirements.map((vc) => vc.toJson()).toList(),
      "challenge": challenge,
    };
    return data;
  } catch (e) {
    print("Error in VPRequestMessage.toJson: $e");
    rethrow;
  }
}