qr_code_scanner do not work in app-release.apk, but work properly on app-debug.apk

39 Views Asked by At

Package : qr_code_scanner

enter image description here

when i try to scann they not scanne in release mode but in debug mode scanne ? i dont have any problem in ui or in terminal ? any one have same problem ?

class _QRViewerState extends State<QRViewer> {
  Barcode? result;
  QRViewController? controller;
  final GlobalKey qrKey = GlobalKey(debugLabel: 'QR');
  bool flash = false;
  StreamSubscription<Barcode>? _streamSubscription;
  bool _isQRViewCreated = false;
  bool _isParsingAndNavigating = false;

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

  @override
  void dispose() {
    _streamSubscription?.cancel(); // Cancel the stream subscription
    controller?.dispose(); // Dispose of the controller
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    double wid = MediaQuery.of(context).size.width;
    double hei = MediaQuery.of(context).size.height;
    return Scaffold(
      // some code
  }

  void _onQRViewCreated(QRViewController controller) {
    if (!_isQRViewCreated) {
      this.controller = controller;
      _streamSubscription = controller.scannedDataStream.listen((scanData) {
        if (mounted) {
          setState(() {
            result = scanData;
          });
        }
        if (!_isParsingAndNavigating && result != null) {
          _isParsingAndNavigating = true;
          _parseAndNavigate(result!.code);
        }
      });
      _isQRViewCreated = true;
    }
  }
}

how can i fix that (i add android.permission.CAMERA on AndroidManifest) but same problem ?

0

There are 0 best solutions below