getUnitItemBarcodeInfo method

List<BarcodeInfo> getUnitItemBarcodeInfo({
  1. required GS1Barcode gs1barcode,
  2. bool forPackaging = false,
  3. DateFormat? dateFormat,
})

The AIs of gs1barcode the way people read them. forPackaging names them the way IdePack does, see aiDescription. With a dateFormat the dates are written out, without one they stay as on the label.

Implementation

List<BarcodeInfo> getUnitItemBarcodeInfo({
  required GS1Barcode gs1barcode,
  bool forPackaging = false,
  DateFormat? dateFormat,
}) {
  return gs1barcode.elements.values.expand((value) {
    if (value.aiCode == GS1AICodes.companyInternalInformation.code) {
      return companyInternalInformationToBarcodeInfo(value.rawData);
    }

    return [
      BarcodeInfo(
        ai: value.aiCode,
        value: _valueText(value, dateFormat: dateFormat),
        description:
            aiDescription(value.aiCode, forPackaging: forPackaging) ??
            _gs1Title(value.aiCode),
      ),
    ];
  }).toList();
}