toBarcodeInfo method

List<BarcodeInfo> toBarcodeInfo({
  1. required String regionString,
  2. required DateFormat defaultDateFormat,
})

Implementation

List<BarcodeInfo> toBarcodeInfo({
  required String regionString,
  required DateFormat defaultDateFormat,
}) {
  return <BarcodeInfo>[
    if (uncategorizedString?.isNotEmpty ?? false)
      BarcodeInfo(
          ai: 'Unc. string',
          value: uncategorizedString!,
          description: 'Scanned string'),
    if (uncategorizedInt != null)
      BarcodeInfo(
          ai: 'Unc. int',
          value: uncategorizedInt.toString(),
          description: 'Scanned int'),
    if (uncategorizedDouble != null)
      BarcodeInfo(
          ai: 'Unc. double',
          value: uncategorizedDouble.toString(),
          description: 'Scanned double'),
    if (materialNumber?.isNotEmpty ?? false)
      BarcodeInfo(
          ai: 'Material number',
          value: materialNumber!,
          description: 'Material number'),
    if (plant?.isNotEmpty ?? false)
      BarcodeInfo(ai: 'Plant', value: plant!, description: 'Plant'),
    if (storageLocation?.isNotEmpty ?? false)
      BarcodeInfo(
          ai: 'Storage location',
          value: storageLocation!,
          description: 'Storage location'),
    if (equipmentNumber?.isNotEmpty ?? false)
      BarcodeInfo(
          ai: 'Equipment number',
          value: equipmentNumber!,
          description: 'Equipment number'),
    if (gtin?.isNotEmpty ?? false)
      BarcodeInfo(ai: 'Gtin', value: gtin!, description: 'Gtin'),
    if (batch?.isNotEmpty ?? false)
      BarcodeInfo(ai: 'Batch', value: batch!, description: 'Batch'),
    if (productionDate != null)
      BarcodeInfo(
          ai: 'Prod. date',
          value: productionDate.getFormattedDate(
            defaultDateFormat: defaultDateFormat,
          )!,
          description: 'Prod. date'),
    if (dueDate != null)
      BarcodeInfo(
          ai: 'Due date',
          value: dueDate.getFormattedDate(
            defaultDateFormat: defaultDateFormat,
          )!,
          description: 'Due date'),
    if (packagingDate != null)
      BarcodeInfo(
          ai: 'Pack. date',
          value: packagingDate.getFormattedDate(
            defaultDateFormat: defaultDateFormat,
          )!,
          description: 'Pack date'),
    if (bestBeforeDate != null)
      BarcodeInfo(
          ai: 'BestBef. date',
          value: bestBeforeDate.getFormattedDate(
            defaultDateFormat: defaultDateFormat,
          )!,
          description: 'BestBef date'),
    if (expirationDate != null)
      BarcodeInfo(
          ai: 'Exp. date',
          value: expirationDate.getFormattedDate(
            defaultDateFormat: defaultDateFormat,
          )!,
          description: 'Exp date'),
    if (variantNumber?.isNotEmpty ?? false)
      BarcodeInfo(
          ai: 'Var. number',
          value: variantNumber!,
          description: 'Var. number'),
    if (serialNumber?.isNotEmpty ?? false)
      BarcodeInfo(
          ai: 'Ser. number',
          value: serialNumber!,
          description: 'Ser. number'),
    if (additionalProductId?.isNotEmpty ?? false)
      BarcodeInfo(
          ai: 'Add. prod. Id',
          value: additionalProductId!,
          description: 'Add. prod. Id'),
    if (quantity != null)
      BarcodeInfo(
          ai: 'Quantity',
          value: quantity.toString().convertToQuantity(
                regionString: regionString,
              ),
          description: 'Add. prod. Id'),
    if (netWeightKg != null)
      BarcodeInfo(
          ai: 'Net weight kg',
          value: '${netWeightKg.toString().convertToQuantity(
                regionString: regionString,
              )} KG',
          description: 'Net weight kg'),
    if (netWeightPounds != null)
      BarcodeInfo(
          ai: 'Net weight pounds',
          value: '${netWeightPounds.toString().convertToQuantity(
                regionString: regionString,
              )} LB',
          description: 'Net weight pounds'),
    if (lengthMeters != null)
      BarcodeInfo(
          ai: 'Length meters',
          value: '$lengthMeters M',
          description: 'Length meters'),
    if (widthMeters != null)
      BarcodeInfo(
          ai: 'Width meters',
          value: '$widthMeters M',
          description: 'Width meters'),
    if (depthMeters != null)
      BarcodeInfo(
          ai: 'Depth meters',
          value: '$depthMeters M',
          description: 'Depth meters'),
    if (areaSqMeters != null)
      BarcodeInfo(
          ai: 'AreaSq meters',
          value: '$areaSqMeters M2',
          description: 'AreaSq meters'),
    if (volumeLitres != null)
      BarcodeInfo(
          ai: 'Volume litres',
          value: '$volumeLitres L',
          description: 'Volume litres'),
    if (volumeCubicMeters != null)
      BarcodeInfo(
          ai: 'Volume cub meters',
          value: '$volumeCubicMeters M3',
          description: 'Volume cub meters'),
    if (customersPurchaseOrderNumber?.isNotEmpty ?? false)
      BarcodeInfo(
          ai: 'Volume cub meters',
          value: customersPurchaseOrderNumber!,
          description: 'Volume cub meters'),
    if (orderNumber?.isNotEmpty ?? false)
      BarcodeInfo(
          ai: 'Order number',
          value: orderNumber!,
          description: 'Order number'),
    if (orderItemNumber?.isNotEmpty ?? false)
      BarcodeInfo(
          ai: 'Order item number',
          value: orderItemNumber!,
          description: 'Order item number'),
    if (inboundDeliveryNumber?.isNotEmpty ?? false)
      BarcodeInfo(
          ai: 'Inb.delivery number',
          value: inboundDeliveryNumber!,
          description: 'Inb.delivery number'),
    if (outboundDeliveryNumber?.isNotEmpty ?? false)
      BarcodeInfo(
          ai: 'Out.delivery number',
          value: outboundDeliveryNumber!,
          description: 'Out.delivery number'),
  ];
}