mintware-de / flutter_barcode_reader

A flutter plugin for reading 2D barcodes and QR codes.
MIT License
628 stars 464 forks source link

ScanOption "useCamera" not working #262

Closed MarHend closed 4 years ago

MarHend commented 4 years ago

BUG REPORTS WITHOUT PROVIDING THESE INFORMATIONS WILL BE CLOSED DIRECTLY. DON'T REMOVE THE SECTIONS!

Describe the bug Whatever I set as useCamera - option is ignored. I found four cameras on my device with numberOfCameras, used options 0 to 3 and 1 to 4 - no changes. Only the back camera is used. Even if I set the option to 20 or something entirely outside the range - doesn't matter.

To Reproduce This is my code: Future barcodeScanning() async { try { var _numberOfCameras = await BarcodeScanner.numberOfCameras; var options = ScanOptions( useCamera: 1 ); var barcodeRes = await BarcodeScanner.scan(options: options); barcode = barcodeRes.rawContent;

Expected behavior I want to switch between cameras with option useCamera as described.
Found out, that index 1 should be front camera (https://stackoverflow.com/questions/55770802/flutter-how-to-scan-qr-code-with-front-camera). But first useCamera must work in general.

Screenshots If applicable, add screenshots to help explain your problem.

Logs If applicable, add the verbose output of flutter run.

Environment (please complete the following information):

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2) [√] Android Studio (version 4.0) [√] VS Code, 32-bit edition (version 1.45.1) [√] Connected device (1 available)

• No issues found!



**Additional context**
Add any other context about the problem here.

Thanks for your help!
Markus
MarHend commented 4 years ago

Found the issue with the wrong kotlin-version. Updated it - works now!