decodeMultiple method

  1. @override
List<Result> decodeMultiple(
  1. BinaryBitmap image, [
  2. DecodeHint? hints
])
override

Implementation

@override
List<Result> decodeMultiple(
  BinaryBitmap image, [
  DecodeHint? hints,
]) {
  List<Result> results = [];
  final detectorResults = MultiDetector(image.blackMatrix).detectMulti(hints);
  for (DetectorResult detectorResult in detectorResults) {
    try {
      final decoderResult = decoder.decodeMatrix(detectorResult.bits, hints);
      final points = detectorResult.points;
      // If the code was mirrored: swap the bottom-left and the top-right points.
      if (decoderResult.other is QRCodeDecoderMetaData) {
        (decoderResult.other as QRCodeDecoderMetaData)
            .applyMirroredCorrection(points);
      }
      final result = Result(
        decoderResult.text,
        decoderResult.rawBytes,
        points,
        BarcodeFormat.qrCode,
      );
      final byteSegments = decoderResult.byteSegments;
      if (byteSegments != null) {
        result.putMetadata(ResultMetadataType.byteSegments, byteSegments);
      }
      final ecLevel = decoderResult.ecLevel;
      if (ecLevel != null) {
        result.putMetadata(
          ResultMetadataType.errorCorrectionLevel,
          ecLevel,
        );
      }
      if (decoderResult.hasStructuredAppend) {
        result.putMetadata(
          ResultMetadataType.structuredAppendSequence,
          decoderResult.structuredAppendSequenceNumber,
        );
        result.putMetadata(
          ResultMetadataType.structuredAppendParity,
          decoderResult.structuredAppendParity,
        );
      }
      results.add(result);
    } on ReaderException catch (_) {
      // ignore and continue
    }
  }
  if (results.isEmpty) {
    return _emptyResultArray;
  } else {
    results = processStructuredAppend(results);
    return results.toList();
  }
}