[toc]
!!!Documents in Chinese only!!!
A new Flutter plugin for reading QR Code.
This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android and/or iOS.
For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.
可以配合camera
插件使用。
调用scanByCameraStream可以识别camera
插件的ImageStream信号,其中Android为YUV信号,iOS为RGBA信号。
如果扫描成功,返回String类型的扫描结果;没有扫描到时,返回null。
为了防止因为OOM导致crash,扫描间隔为100ms。
可以配合image_picker
插件使用。
调用scanByImageFile可以扫描照片中的二维码,输入参数filePath
为照片文件路径,可以通过image_picker
插件获取。
plugin本身不需要额外申请权限,但是例子代码中使用camera需要配合添加配置:
Andorid使用照相机camera
插件,需要修改AndroidManifest.xml
配置文件(位置android/app/src/main/AndroidManifest.xml),追加以下配置:
<uses-permission android:name="android.permission.CAMERA"/>
iOS使用照相机camera
和照片选取image_picker
插件,需要修改Info.plist
配置文件(位置ios/Runner/Info.plist),追加以下配置:
<key>NSCameraUsageDescription</key>
<string>扫描二维码</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>识别相册中的二维码</string>