bigship/barcode.flutter

Invalid ean8 checksum algorithm

yfer opened this issue · 0 comments

yfer commented

In _drawBarCodeEAN8 checkCode is computed like

    checkCode = 10 - (sum2nd*3+sum3rd) % 10;

If sum in bracets = 0, then checkCode will be 10, then it will throw.

Algorithm should be like analogue to current EAN13 or UPC,

    if ((sum2nd + sum3rd * 3) % 10 == 0) {
      checkCode = 0;
    } else {
      checkCode = 10 - (sum2nd + sum3rd * 3) % 10;
    }

I could not google standard for this. only resources like this