MultiFormatOneDReader constructor

MultiFormatOneDReader(
  1. DecodeHint? hints
)

Implementation

MultiFormatOneDReader(DecodeHint? hints) {
  // @SuppressWarnings("unchecked")
  final possibleFormats = hints?.possibleFormats;
  final useCode39CheckDigit = hints?.assumeCode39CheckDigit ?? false;
  final readers = <OneDReader>[];
  if (possibleFormats != null) {
    if (possibleFormats.contains(BarcodeFormat.ean13) ||
        possibleFormats.contains(BarcodeFormat.upcA) ||
        possibleFormats.contains(BarcodeFormat.ean8) ||
        possibleFormats.contains(BarcodeFormat.upcE)) {
      readers.add(MultiFormatUPCEANReader(hints));
    }
    if (possibleFormats.contains(BarcodeFormat.code39)) {
      readers.add(Code39Reader(useCode39CheckDigit));
    }
    if (possibleFormats.contains(BarcodeFormat.code93)) {
      readers.add(Code93Reader());
    }
    if (possibleFormats.contains(BarcodeFormat.code128)) {
      readers.add(Code128Reader());
    }
    if (possibleFormats.contains(BarcodeFormat.itf)) {
      readers.add(ITFReader());
    }
    if (possibleFormats.contains(BarcodeFormat.codabar)) {
      readers.add(CodaBarReader());
    }
    if (possibleFormats.contains(BarcodeFormat.rss14)) {
      readers.add(RSS14Reader());
    }
    if (possibleFormats.contains(BarcodeFormat.rssExpanded)) {
      readers.add(RSSExpandedReader());
    }
  }
  if (readers.isEmpty) {
    readers.add(MultiFormatUPCEANReader(hints));
    readers.add(Code39Reader());
    readers.add(CodaBarReader());
    readers.add(Code93Reader());
    readers.add(Code128Reader());
    readers.add(ITFReader());
    readers.add(RSS14Reader());
    readers.add(RSSExpandedReader());
  }
  _readers = readers; //.toList();
}