MultiFormatUPCEANReader constructor
MultiFormatUPCEANReader(
- Map<
DecodeHintType, Object> ? hints
Implementation
MultiFormatUPCEANReader(Map<DecodeHintType, Object>? hints) {
// @SuppressWarnings("unchecked")
final possibleFormats =
hints?[DecodeHintType.POSSIBLE_FORMATS] as List<BarcodeFormat>?;
final readers = <UPCEANReader>[];
if (possibleFormats != null) {
if (possibleFormats.contains(BarcodeFormat.EAN_13)) {
readers.add(EAN13Reader());
} else if (possibleFormats.contains(BarcodeFormat.UPC_A)) {
readers.add(UPCAReader());
}
if (possibleFormats.contains(BarcodeFormat.EAN_8)) {
readers.add(EAN8Reader());
}
if (possibleFormats.contains(BarcodeFormat.UPC_E)) {
readers.add(UPCEReader());
}
}
if (readers.isEmpty) {
readers.add(EAN13Reader());
// UPC-A is covered by EAN-13
readers.add(EAN8Reader());
readers.add(UPCEReader());
}
_readers = readers.toList();
}