toJson method Null safety

Map toJson()

Implementation

Map toJson(){
  Map result = {};

  if (barcodeType != null) result.addAll({"barcodeType": barcodeType});
  if (status != null) result.addAll({"status": status});
  if (pageIndex != null) result.addAll({"pageIndex": pageIndex});
  if (pdf417Info != null) result.addAll({"pdf417Info": pdf417Info});
  if (data != null) result.addAll({"data": data});

  return result;
}