convertToJson static method
convert from ThreatWeight List to threatWeight json
Implementation
static String convertToJson(List<ThreatWeight> threatWeights) {
try {
List<Map<String, dynamic>> jsonData =
threatWeights.map((threatWeight) => threatWeight.toJson()).toList();
return jsonEncode(jsonData);
} on FormatException {
throw CustomFormatException(
message:
"Fails to Convert List<ThreatWeight> $threatWeights to json");
}
}