convertFromJson static method
converts json ThreatList to List
Implementation
static List<ThreatScore> convertFromJson(String threatScoreJson) {
try {
List<dynamic> jsonData = jsonDecode(threatScoreJson);
return jsonData
.map((threatMap) => ThreatScore.fromJson(threatMap))
.toList();
} on FormatException {
throw CustomFormatException(
message:
'\n that is the wrong format for ThreatScore:\n $threatScoreJson \n right String format:\n [{"threat":{"threatId":"value","name":"value"}, "score":"value"}] \n Note: threatId is optional');
}
}