toString method

  1. @override
String toString()
override

A string representation of this object.

Some classes have a default textual representation, often paired with a static parse function (like int.parse). These classes will provide the textual representation as their string representation.

Other classes have no meaningful textual representation that a program will care about. Such classes will typically override toString to provide useful information when inspecting the object, mainly for debugging or logging.

Implementation

@override
String toString() {
  return [
    'ScanData: ',
    'originalString: $originalString',
    'errorMessage: $errorMessage',
    'isGS1: $isGS1',
    if (sscc != null) 'sscc: $sscc',
    if (gtin != null) 'gtin: $gtin',
    if (batch != null) 'batch: $batch',
    if (productionDate != null) 'productionDate: $productionDate',
    if (dueDate != null) 'dueDate: $dueDate',
    if (packagingDate != null) 'packagingDate: $packagingDate',
    if (bestBeforeDate != null) 'bestBeforeDate: $bestBeforeDate',
    if (expirationDate != null) 'expirationDate: $expirationDate',
    if (variantNumber != null) 'variantNumber: $variantNumber',
    if (serialNumber != null) 'serialNumber: $serialNumber',
    if (additionalProductId != null)
      'additionalProductId: $additionalProductId',
    if (customerPartNumber != null) 'customerPartNumber: $customerPartNumber',
    if (numberOfPieces != null) 'numberOfPieces: $numberOfPieces',
    if (netWeightKg != null) 'netWeightKg: $netWeightKg',
    if (lengthMeters != null) 'lengthMeters: $lengthMeters',
    if (widthMeters != null) 'widthMeters: $widthMeters',
    if (depthMeters != null) 'depthMeters: $depthMeters',
    if (areaSqMeters != null) 'areaSqMeters: $areaSqMeters',
    if (volumeLitres != null) 'volumeLitres: $volumeLitres',
    if (volumeCubicMeters != null) 'volumeCubicMeters: $volumeCubicMeters',
    if (netWeightPounds != null) 'netWeightPounds: $netWeightPounds',
    if (customersPurchaseOrderNumber != null)
      'customersPurchaseOrderNumber: $customersPurchaseOrderNumber',
    if (productionDateAndTime != null)
      'productionDateAndTime: $productionDateAndTime',
    if (packingMaterialSupplierID != null)
      'packingMaterialSupplierID: $packingMaterialSupplierID',
    if (packingMaterialSupplierPlant != null)
      'packingMaterialSupplierPlant: $packingMaterialSupplierPlant',
    if (plant != null) 'plant: $plant',
    if (storageLocation != null) 'storageLocation: $storageLocation',
    if (functionalLocation != null) 'functionalLocation: $functionalLocation',
    if (storageBin != null) 'storageBin: $storageBin',
    if (materialNumber != null) 'materialNumber: $materialNumber',
    if (equipmentNumber != null) 'equipmentNumber: $equipmentNumber',
    if (orderNumber != null) 'orderNumber: $orderNumber',
    if (orderItemNumber != null) 'orderItemNumber: $orderItemNumber',
    if (inboundDeliveryNumber != null)
      'inboundDeliveryNumber: $inboundDeliveryNumber',
    if (outboundDeliveryNumber != null)
      'outboundDeliveryNumber: $outboundDeliveryNumber',
    if (uncategorizedString != null)
      'uncategorizedString: $uncategorizedString',
    if (uncategorizedInt != null) 'uncategorizedInt: $uncategorizedInt',
  ].join(', ');
}