mirror of
https://github.com/inventree/inventree-app.git
synced 2025-07-03 12:20:45 +00:00
Use raw value of UTF-8 encoded barcodes (#670)
This commit is contained in:
@ -1,5 +1,4 @@
|
|||||||
import "dart:math";
|
import "dart:math";
|
||||||
import "dart:typed_data";
|
|
||||||
|
|
||||||
import "package:camera/camera.dart";
|
import "package:camera/camera.dart";
|
||||||
import "package:flutter/material.dart";
|
import "package:flutter/material.dart";
|
||||||
@ -126,24 +125,7 @@ class _CameraBarcodeControllerState extends InvenTreeBarcodeControllerState {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Uint8List rawData = result.barcodes.first.rawBytes ?? Uint8List(0);
|
String barcode = result.barcodes.first.rawValue ?? "";
|
||||||
|
|
||||||
String barcode;
|
|
||||||
|
|
||||||
if (rawData.isNotEmpty) {
|
|
||||||
final buffer = StringBuffer();
|
|
||||||
|
|
||||||
for (int ii = 0; ii < rawData.length; ii++) {
|
|
||||||
buffer.writeCharCode(rawData[ii]);
|
|
||||||
}
|
|
||||||
|
|
||||||
barcode = buffer.toString();
|
|
||||||
|
|
||||||
print(barcode);
|
|
||||||
} else {
|
|
||||||
// Fall back to text value
|
|
||||||
barcode = result.barcodes.first.rawValue ?? "";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (barcode.isEmpty) {
|
if (barcode.isEmpty) {
|
||||||
// TODO: Error message "empty barcode"
|
// TODO: Error message "empty barcode"
|
||||||
|
Reference in New Issue
Block a user