Giter Site home page Giter Site logo

Comments (18)

kw2019ltd avatar kw2019ltd commented on June 14, 2024

here is example of ITF

https://favpng.com/png_view/interleaved-2-of-5-barcode-itf-14-universal-product-code-png/X8EnP87Z

image

from dart_barcode.

DavBfr avatar DavBfr commented on June 14, 2024

I think the "0" prefixed ITF14 is a feature of this website which can be easily implemented I'm Dart whenever you need it:

var c = '123456789';
var p = c.padLeft(13, '0');

from dart_barcode.

kw2019ltd avatar kw2019ltd commented on June 14, 2024

above is just example what about actual below error , firebase_ml able to scan them and identfied them as ITF 14.

Non-fatal Exception: java.lang.Exception: BarcodeException: Unable to encode "0312341611" to ITF 14 Barcode, it is not 14 digits
Non-fatal Exception: java.lang.Exception: BarcodeException: Unable to encode "60000351" to ITF 14 Barcode, it is not 14 digits

Non-fatal Exception: java.lang.Exception: BarcodeException: Unable to encode "341611" to ITF 14 Barcode, it is not 14 digits

from dart_barcode.

kw2019ltd avatar kw2019ltd commented on June 14, 2024

according to below , need to add check

  • if code is less than 14 do the following:
    append 0 to the code till its 13 digit
    and to calculate the checksum(14 digit)
    do the following:

How to calculate your check digit yourself
Example barcode number: 501234576421

Step 1: add together all alternate numbers starting from the right

5 0 1 2 3 4 5 7 6 4 2 1
0 + 2 + 4 + 7 + 4 + 1 = 18
Step 2: multiply the answer by 3
18 x 3 = 54

Step 3: now add together the remaining numbers

5 0 1 2 3 4 5 7 6 4 2 1
5 + 1 + 3 + 5 + 6 + 2 = 22

Step 4: add step 2 and 3 together

54 + 22 = 76

Step 5: the difference between step 4 and the next 10th number:

76 + 4 = 80
Check digit = 4

taken from
https://www.gtin.info/check-digit-calculator/

from dart_barcode.

DavBfr avatar DavBfr commented on June 14, 2024

The checksum is correct, I don't understand what's wrong.

from dart_barcode.

kw2019ltd avatar kw2019ltd commented on June 14, 2024

what is the best solution to support such barcode and display barcode widget? right now such code are failing..

from dart_barcode.

DavBfr avatar DavBfr commented on June 14, 2024
final myCode = '123456789';

BarcodeWidget(
  barcode: Barcode.itf14(),
  data: myCode.padLeft(13, '0'),
);

from dart_barcode.

kw2019ltd avatar kw2019ltd commented on June 14, 2024

this will not work see below, in case you append zeros and total digit is 14 barcode widget will fail as its not valid ITF14 as checksum is wrong 000000123456789

error with 14 digit:
image

with 13 digit checksum is calculated and correct barcode generated 0000123456789

image

http://www.rasteredge.com/online-barcode-generator/itf14/

pls try it buy you self same with ITF 60000351

from dart_barcode.

DavBfr avatar DavBfr commented on June 14, 2024

the code I gave you will padd up to 13 digits and the barcode library will calculate the checksum for you. What more do you want?

from dart_barcode.

kw2019ltd avatar kw2019ltd commented on June 14, 2024

from dart_barcode.

kw2019ltd avatar kw2019ltd commented on June 14, 2024

from dart_barcode.

DavBfr avatar DavBfr commented on June 14, 2024

If you find that it is required in the official ITF-14 specification, yes. But if you forget a digit, prepending with a zero makes a totally different product code.

from dart_barcode.

kw2019ltd avatar kw2019ltd commented on June 14, 2024

since i see alot of BarcodeException can you enhance BarcodeWidget to display redable error Text widget?
like what we have in QRWidget (different plugin)
QrImage(
errorStateBuilder: errorStateBuilder: (cxt, err) {
return Container(
child: Center(
child: Text(
S.of(context).uhOhSomethingWentWrong,
textAlign: TextAlign.center,
),
),
);
},

Non-fatal Exception: java.lang.Exception: BarcodeException: Unable to encode "908001146149" to ITF 14 Barcode, it is not 14 digits

from dart_barcode.

DavBfr avatar DavBfr commented on June 14, 2024

Yes, I can do that.

from dart_barcode.

kw2019ltd avatar kw2019ltd commented on June 14, 2024

cool thanks

from dart_barcode.

DavBfr avatar DavBfr commented on June 14, 2024

@kw2019ltd It's implemented in barcode_widget 1.3.0.

from dart_barcode.

kw2019ltd avatar kw2019ltd commented on June 14, 2024

cool tnx closing ticket.

from dart_barcode.

DavBfr avatar DavBfr commented on June 14, 2024

Don't hesitate to Buy Me A Coffee.

from dart_barcode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.