[英]Flutter barcode_scan unable to get a response
I'm using the barcode_scan package to get barcode information.我正在使用barcode_scan package 来获取条形码信息。
barcode_scan: ^3.0.1
I have a super simple test scenario set up like this:我有一个超级简单的测试场景,如下所示:
ScanResult result = await BarcodeScanner.scan();
print(result.rawContent);
I see the barcode scanner screen show up, and it appears to detect the barcode because as soon as I focus on the barcode it pauses and the closes the barcode scanner screen.我看到条码扫描仪屏幕出现,它似乎检测到了条码,因为只要我专注于条码,它就会暂停并关闭条码扫描仪屏幕。 however, it never reaches the line below print(result.rawContent);
但是,它永远不会到达print(result.rawContent);
下面的行I'm not seeing any errors either.我也没有看到任何错误。 I've tried wrapping the whole thing in a try catch just to see, but it never entered the catch.我已经尝试将整个东西包装在一个 try catch 中只是为了看看,但它从未进入 catch 中。 It's like it just doesn't return anything from the await BarcodeScanner.scan()
call and just aborts completely.就好像它没有从await BarcodeScanner.scan()
调用中返回任何内容,只是完全中止。
I'm not sure what I'm doing wrong here.我不确定我在这里做错了什么。
I meet the same issue on my existing project was created on old version of flutter, when I create new project with last version of flutter(1.12.x-pre) it is work find.我在现有项目上遇到同样的问题是在旧版本的 flutter 上创建的,当我使用最新版本的颤振(1.12.x-pre)创建新项目时,它是工作找到的。
It is not bug, I just found new issue on barcode_scan.这不是错误,我刚刚在barcode_scan 上发现了新问题。
Issue: https://github.com/mintware-de/flutter_barcode_reader/issues/261#issue-643704981问题: https://github.com/mintware-de/flutter_barcode_reader/issues/261#issue-643704981
I'm a newer of flutter.我是 flutter 的更新者。
I solved downgrading barcode_scan
from 3.0.1
to 2.0.0
.我解决了将barcode_scan
从3.0.1
降级到2.0.0
的问题。
I hope it helps我希望它有帮助
In the barcode_scan Flutter package Getting Started section, there are a few setup steps that you have to follow (if you haven't done so already)在barcode_scan Flutter package 入门部分中,您必须遵循一些设置步骤(如果您还没有这样做的话)
If you are testing this on an android device, try these following steps:如果您在android设备上进行测试,请尝试以下步骤:
<uses-permission android:name="android.permission.INTERNET"/>
在我的测试应用程序中,我将它放在<uses-permission android:name="android.permission.INTERNET"/>
If you are testing this on an iOS device, try these following steps:如果您在iOS设备上对此进行测试,请尝试以下步骤:
<dict>
<!-- ... -->
<key>NSCameraUsageDescription</key>
<string>Camera permission is required for barcode scanning.</string>
<!-- ... -->
</dict>
Source: https://pub.dev/packages/barcode_scan#-readme-tab-来源: https://pub.dev/packages/barcode_scan#-readme-tab-
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.