QR code scanner plugin for flutter. This plugin responds to camera/photo-lirary usage permission requests. This plugin function is Scan/Read. "Scan" is scanning QR code by scanner, "Read" is reading qr code by picking up qr code image from photo library.
Support for iOS > 8.0
Please add as follows in info.plist
<key>NSCameraUsageDescription</key>
<string></string>
<key>NSPhotoLibraryUsageDescription</key>
<string></string>
<key>io.flutter.embedded_views_preview</key>
<true/>
minSdkVersion 23
Please add as follows in Manifest.xml
<manifest ... xmlns:tools="http://schemas.android.com/tools">
:
<uses-sdk tools:overrideLibrary="com.google.zxing.client.android" />
</manifest>
iOS: MTBBarcodeScanner
Android: zxing-android-embedded
/// Scan Widget
CodeScanner(
controller : controller,
isScanFrame : true, // optional
scanFrameSize : Size(200, 200), // optional
frameWidth : 8, // optional
frameColor : Color(0xcc222222), // optional
)
/// Widget Controller
controller = CodeScannerController();
Listen for scanDataStream.
/// scan data
controller.scanDataStream
If reading qr image from photo gallery is success, true value flows through isSuccessReadDataStream.
If reading qr image from photo gallery is failure, false value flows through isSuccessReadDataStream.
You can detect read result without isSuccessReadDataStream. You Listen for only readDataStream, it is flowed two value pattern, one is actual read data, another is null when reading is failure
/// flag of successful read
controller.isSuccessReadDataStream
/// read data
controller.readDataStream
await controller.startScan();
await controller.stopScan();
await controller.readDataFromGallery();
await controller.lightON();
await controller.lightOFF();
await controller.toggleLight();