toJson method Null safety

Map toJson()

Implementation

Map toJson(){
  Map result = {};

  if (type != null) result.addAll({"type": type});
  if (status != null) result.addAll({"status": status});
  if (typeName != null) result.addAll({"typeName": typeName});
  if (pageIndex != null) result.addAll({"pageIndex": pageIndex});
  if (elements != null) result.addAll({"elements": elements});

  return result;
}