getBarcodeData method

BarcodeData getBarcodeData({
  1. required String barcode,
})

Implementation

BarcodeData getBarcodeData({required String barcode}) {
  try {
    BarcodeData? barcodeData = _scanInterpreter.parseGS1(barcode);

    if (barcodeData != null) {
      return barcodeData;
    }

    if (_barcodeUtils.isProcessOrder(barcode)) {
      return BarcodeData(
        barcodeId: BarcodeId.processOrder,
        code: barcode,
      );
    }

    return BarcodeData(code: barcode);
  } catch (e) {
    if (BarcodeUtils.allBarcodeCharactersAreNumbers(barcode)) {
      return BarcodeData(
        barcodeId: BarcodeId.processOrder,
        code: barcode,
      );
    }
    return BarcodeData(code: barcode);
  }
}