question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Leading zeroes in barcodes are truncated

See original GitHub issue

Describe the bug Whenever I scan a barcode like this: image The result that gets printed is only the digits after the leading zeroes.

To Reproduce Steps to reproduce the behavior:

  1. Go to the barcode scanner app
  2. Scan the barcode attached
  3. Check result

Expected behavior When the barcode is scanned, the value should be 00002408, not 2408.

Smartphone (please complete the following information):

  • Device: iPhone 7
  • OS: 13

Additional context I take the value and I run these functions:

...

sBarcode(someVal) async {
  String bCode = await FlutterBarcodeScanner.scanBarcode("#ff6666", "Cancel", true);
  print(bCode);
  someVal.enterBarcode(bCode);
  return;
}
...
enterBarcode(barc) {
  flutterWebViewPlugin.evalJavascript(`document.getElementById('barcodenumber').value="${barc}";`);
  }

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
chukwumaokerecommented, Dec 2, 2019

Nevermind I’ve solved the error. Instead of doing this:

sBarcode(someVal) async {
  String bCode = await FlutterBarcodeScanner.scanBarcode("#ff6666", "Cancel", true);
  print(bCode);
  someVal.enterBarcode(bCode);
  return;
}
...
enterBarcode(barc) {
  flutterWebViewPlugin.evalJavascript(`document.getElementById('barcodenumber').value="${barc}";`);
  }

Do this

sBarcode(someVal) async {
  String bCode = await FlutterBarcodeScanner.scanBarcode("#ff6666", "Cancel", true);
  print(bCode);
  someVal.enterBarcode(bCode);
  return;
}
...
enterBarcode(barc) {
    String js = "document.getElementById('barcodenumber').value='$barc'";
    flutterWebViewPlugin.evalJavascript(js);
	flutterWebViewPlugin.evalJavascript("document.getElementById('barcodenumber').dispatchEvent(event)");
  }
0reactions
chukwumaokerecommented, Nov 30, 2019

Im attaching it test

This is a barcode type: Interleaved2of5 Whenever I scan this barcode I expect the result to be 00002463 but I’m getting “1331” as a result

Any ideas why? I’ve been trying to debug this You can even test here: https://www.barcodesinc.com/generator/image.php?code=00002463&style=453&type=I25&width=300&height=125&xres=2&font=3

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to remove the leading zero when scanning an UPC-A ...
When scanning a UPC-A bar code an extra zero is being added to the beginning of the data. How can this be removed?...
Read more >
Leading Zero Problem in product barcode - SAP Community
we are migrating from a system which allows leading zeros in bar-code ... as sap does not recognize leading zeros and truncates the...
Read more >
Barcode 101 - GTIN
he UPC-E code's most basic trick is to remove trailing zeroes in the manufacturer's code, and leading zeroes in the product code.
Read more >
How do I stop leading zeros from deleting in UPC's during ...
You can fix the UPCs to include the leading zeros by opening your exported SKU file in excel, select the UPC column, right...
Read more >
How do I prevent Excel from removing leading zeros in ...
How do I prevent Excel from removing leading zeros in product id or upc? It is important to remember that when preparing data...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found