convertFromJson static method

List<Threat> convertFromJson(
  1. String threatJson
)

converts jsonThreatListJson to List

Implementation

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