Last updated:
0 purchases
flutter web qrcode scanner
📷 flutter_web_qrcode_scanner #
Flutter Web plugin for scanning QR codes
🛠️ Getting Started #
Firstly you need to add this plugin flutter_web_qrcode_scanner:1.1.1 to your pubspec.yaml file.
dependencies:
flutter_web_qrcode_scanner:1.1.1
copied to clipboard
Then you need to add <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jsQR.min.js"></script> to your index.html file after body tag.
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jsQR.min.js"></script>
copied to clipboard
🏃 Usage #
Auto play example, The video preview (scanning area) will start automatically
FlutterWebQrcodeScanner(
cameraDirection: CameraDirection.back,
stopOnFirstResult: true, //set false if you don't want to stop video preview on getting first result
onGetResult: (result) {
// _result = jsonDecode(result);
},
//width:200,
//height:200,
)
copied to clipboard
You are able to choose the scanning camera via the cameraDirection attribute CameraDirection.back or CameraDirection.front,
If you want to control the start and stop of camera scanning, you must use the CameraController attribute
CameraController _controller = CameraController(autoPlay: false);
copied to clipboard
then you can start and stop video preview by calling methods startVideoStream() and stopVideoStream()
InkWell(
//some code
onTap:(){
_controller.startVideoStream();
},
)
.
.
.
FlutterWebQrcodeScanner(
controller: _controller,
onGetResult: (result) {
// some code
_controller.stopVideoStream();
},
)
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.