fromJson method Null safety

File? fromJson(
  1. dynamic jsonObject
)

Implementation

static File? fromJson(jsonObject) {
  if (jsonObject == null) return null;
  var result = new File();

  result.readingTime = jsonObject["readingTime"];
  result.type = jsonObject["type"];
  result.pAStatus = jsonObject["pAStatus"];
  result.readingStatus = jsonObject["readingStatus"];
  result.fileID = jsonObject["fileID"];
  result.fileData = FileData.fromJson(jsonObject["fileData"]);
  result.certificates = SecurityObjectCertificates.fromJson(jsonObject["certificates"]);
  if (jsonObject["docFieldsText"] != null)
    for (var item in jsonObject["docFieldsText"])
      result.docFieldsText.add(item);
  if (jsonObject["docFieldsGraphics"] != null)
    for (var item in jsonObject["docFieldsGraphics"])
      result.docFieldsGraphics.add(item);
  if (jsonObject["docFieldsOriginals"] != null)
    for (var item in jsonObject["docFieldsOriginals"])
      result.docFieldsOriginals.add(item);
  if (jsonObject["notifications"] != null)
    for (var item in jsonObject["notifications"])
      result.notifications.add(item);

  return result;
}