Vulnerability.fromJson constructor

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

Implementation

factory Vulnerability.fromJson(Map<String, dynamic> json) {
  return Vulnerability(
    id: json['Id'] as String,
    cvss: (json['Cvss'] as List?)
        ?.whereNotNull()
        .map((e) => Cvss.fromJson(e as Map<String, dynamic>))
        .toList(),
    referenceUrls: (json['ReferenceUrls'] as List?)
        ?.whereNotNull()
        .map((e) => e as String)
        .toList(),
    relatedVulnerabilities: (json['RelatedVulnerabilities'] as List?)
        ?.whereNotNull()
        .map((e) => e as String)
        .toList(),
    vendor: json['Vendor'] != null
        ? VulnerabilityVendor.fromJson(json['Vendor'] as Map<String, dynamic>)
        : null,
    vulnerablePackages: (json['VulnerablePackages'] as List?)
        ?.whereNotNull()
        .map((e) => SoftwarePackage.fromJson(e as Map<String, dynamic>))
        .toList(),
  );
}