toJson method Null safety

Map toJson()

Implementation

Map toJson(){
  Map result = {};

  if (readingTime != null) result.addAll({"readingTime": readingTime});
  if (type != null) result.addAll({"type": type});
  if (pAStatus != null) result.addAll({"pAStatus": pAStatus});
  if (readingStatus != null) result.addAll({"readingStatus": readingStatus});
  if (fileID != null) result.addAll({"fileID": fileID});
  if (fileData != null) result.addAll({"fileData": fileData});
  if (certificates != null) result.addAll({"certificates": certificates});
  if (docFieldsText != null) result.addAll({"docFieldsText": docFieldsText});
  if (docFieldsGraphics != null) result.addAll({"docFieldsGraphics": docFieldsGraphics});
  if (docFieldsOriginals != null) result.addAll({"docFieldsOriginals": docFieldsOriginals});
  if (notifications != null) result.addAll({"notifications": notifications});

  return result;
}