setBarcodeFormats method
Sets the barcode formats to be recognized.
The formats parameter specifies the barcode types to detect.
Returns 0 on success, or an error code on failure.
Implementation
Future<int> setBarcodeFormats(int formats) async {
try {
JSObject rawSettings =
await _barcodeReader!.getSimplifiedSettings("").toDart;
Map dartSettings = dartifyObject(rawSettings);
Map obj = convertBigIntsToInts(dartSettings);
obj['barcodeSettings']['barcodeFormatIds'] = formats;
await _barcodeReader!.updateSettings("", jsifyObject(obj)).toDart;
} catch (e) {
print(e);
return -1;
}
return 0;
}