weixin_39562197
weixin_39562197
2021-01-01 06:58

Barcode Scanner not reading Barcode

We are currently experience an issue where the Barcode isn't actually scanned. The scanner seems not to detect the barcode. I've debugged the code up to


  static Future<scanresult> _doScan(ScanOptions options) async {
    var config = proto.Configuration()
          ..useCamera = options.useCamera
          ..restrictFormat.addAll(options.restrictFormat)
          ..autoEnableFlash = options.autoEnableFlash
          ..strings.addAll(options.strings)
          ..android = (proto.AndroidConfiguration()
                ..useAutoFocus = options.android.useAutoFocus
                ..aspectTolerance = options.android.aspectTolerance
              /**/)
        /**/;
    var buffer = await _channel.invokeMethod('scan', config?.writeToBuffer());
    var tmpResult = proto.ScanResult.fromBuffer(buffer);
    return ScanResult(
      format: tmpResult.format,
      formatNote: tmpResult.formatNote,
      rawContent: tmpResult.rawContent,
      type: tmpResult.type,
    );
  }
</scanresult>

useCamera=-1 unless I force it in the options:


int numberOfCameras = await BarcodeScanner.numberOfCameras;
            var options = ScanOptions(
                useCamera: numberOfCameras-2
            );

I don't know if it is part of the issue.

My config is as follows:

  • barcode_scan version 3.0.0
  • Flutter 1.12.13+hotfix.9 • channel stable • https://github.com/flutter/flutter.git Framework • revision f139b11009 (3 weeks ago) • 2020-03-30 13:57:30 -0700 Engine • revision af51afceb8 Tools • Dart 2.7.2

  • We are building for iOS 13.2.

  • Test phones is iPhone 8 and iPhone X with latest iOS version.

  • It currently works flawlessly on our Android builds though *I've added the Privacy Permission for iOS


<dict>
    <!-- ... -->
    <key>NSCameraUsageDescription</key>
    <string>Camera permission is required for barcode scanning.</string>
    <!-- ... -->
</dict>
  • I've also added an example of a barcode we are trying to scan.

Screenshot 2020-04-20 at 14 45 59

Please inform me if I'm doing something stupid.

该提问来源于开源项目:mintware-de/flutter_barcode_reader

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

18条回答

为你推荐

换一换