DavBfr / dart_barcode

Barcode generation library
https://pub.dev/packages/barcode
Apache License 2.0
134 stars 39 forks source link

Barcode UPC #34

Closed ardipermana59 closed 3 years ago

ardipermana59 commented 3 years ago

in here https://davbfr.github.io/dart_barcode/#/ when i choose UPC A and i input data 1 will not error. data will be filled 100000000007 automatic. but, in flutter i wrote

BarcodeWidget(
    data: '1',
   barcode: Barcode.upcA(),
),

will display an error. is there a feature to generate data like on the web so there is no error?

DavBfr commented 3 years ago

Yes, Try like this:

final barcode = Barcode.upcA() as BarcodeEan;
final data = barcode.normalize('1');

...

BarcodeWidget(
    data: data,
   barcode: barcode,
)
ardipermana59 commented 3 years ago

thank you very much

DavBfr commented 3 years ago

Don't hesitate to Buy Me A Coffee.