Closed AlexGreg closed 4 years ago
I needed barcode format too so I forked the project and added return of barcode format: https://github.com/masewo/flutter_barcode_reader
I needed barcode format too so I forked the project and added return of barcode format: https://github.com/masewo/flutter_barcode_reader
@masewo Hello, I have cloned your code, I found you just add android barcode type, will you add this in iOS?
Yes, I will do it for iOS soon.
Hey, any updates on the iOS version?
@ghost7476 @mdlmlr Sorry that it took so long, but I had no iOS device to test this feature. Here I added the support for iOS: https://github.com/masewo/flutter_barcode_reader/commit/008b25d235c0b84be32679ca4dbc2576d88c120e I added code in our app to convert iOS types to Android types:
// convert barcode type coming from iOS
if (Platform.isIOS) {
switch (barcode["barcodeFormat"]) {
case 'org.iso.Aztec':
barcode["barcodeFormat"] = 'AZTEC';
break;
case 'org.iso.Code39':
barcode["barcodeFormat"] = 'CODE_39';
break;
case 'org.iso.Code39Mod43': // will be always detected as Code39 by Apple ?!
barcode["barcodeFormat"] = 'CODE_39';
break;
case 'com.intermec.Code93':
barcode["barcodeFormat"] = 'CODE_93';
break;
case 'org.iso.Code128':
barcode["barcodeFormat"] = 'CODE_128';
break;
case 'org.iso.DataMatrix':
barcode["barcodeFormat"] = 'DATA_MATRIX';
break;
case 'org.gs1.EAN-8':
barcode["barcodeFormat"] = 'EAN_8';
break;
case 'org.gs1.EAN-13':
if (barcode["barcode"].startsWith('0')) {
barcode["barcode"] = barcode["barcode"].substring(1);
barcode["barcodeFormat"] = 'UPC_A';
} else {
barcode["barcodeFormat"] = 'EAN_13';
}
break;
case 'org.ansi.Interleaved2of5':
barcode["barcodeFormat"] = 'ITF';
break;
case 'org.gs1.ITF14':
barcode["barcodeFormat"] = 'ITF';
break;
case 'org.iso.PDF417':
barcode["barcodeFormat"] = 'PDF_417';
break;
case 'org.iso.QRCode':
barcode["barcodeFormat"] = 'QR_CODE';
break;
case 'org.gs1.UPC-E':
barcode["barcodeFormat"] = 'UPC_E';
break;
default:
break;
// support missing for:
// CODABAR, MAXICODE, RSS_14, RSS_EXPANDED, UPC_EAN_EXTENSION
}
}
I'll rewrite the platform communication and extend it with more properties.
in order to have also information about the type of barcode