As Soon As I Click on The Camera Button The App Crashes.
It is not Asking For Any Permission Also.
I Have Included The Activity File in the Manifest Also
This is The Code I Am Using and The plugin I Am Using is barcode_scan:
Even After Searching a Lot I Am Unable To get to The Problem. Help Would Be Appreciated.
class _AuditPage extends State<AuditPage>{ String result = "Scan The Barcode!"; Future _scanQR() async{ try{ String qrCode = await BarcodeScanner.scan(); setState(() { result = qrCode; }); }on PlatformException catch (ex){ if(ex.code==BarcodeScanner.CameraAccessDenied){ setState(() { result="Camera Permission Was Denied"; }); }else{ setState(() { result="Unknown Error $ex!"; }); } } on FormatException { setState(() { result = "You Pressed The Back Button Before Scanning"; }); } catch (ex){ setState(() { result="Unknown Error $ex!"; }); } } @override Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomPadding: false, appBar: AppBar( title: Text("Bhaifi"), ), drawer: DrawerPage(), body: Center( child:Text( result, ), ), floatingActionButton:FloatingActionButton.extended( icon: Icon(Icons.camera_alt), label: Text("Scan"), onPressed: _scanQR, ), floatingActionButtonLocation:FloatingActionButtonLocation.centerFloat, ); } }