juliuscanute / qr_code_scanner

QR Code Scanner for Flutter
BSD 2-Clause "Simplified" License
999 stars 759 forks source link

The camera gives this error after one use and won't open again #578

Open habibfakari opened 2 years ago

habibfakari commented 2 years ago

[ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: CameraException(, length=17; index=17) E/flutter ( 4678): #0 QRViewController._startScan (package:qr_code_scanner/src/qr_code_scanner.dart:237:7) E/flutter ( 4678):

habibfakari commented 2 years ago

The solution I came up with :

@override void reassemble() { super.reassemble(); if (Platform.isAndroid) { controller!.pauseCamera(); } if (!Platform.isWindows) { controller!.resumeCamera(); } }

@override void initState() { Future.delayed(Duration(seconds: 1),(){ reassemble(); }); super.initState(); }

In this way, the camera will be activated again

maksganzol commented 1 year ago

Any updates on this?

maksganzol commented 1 year ago

Duplicate of https://github.com/juliuscanute/qr_code_scanner/issues/550