I want to use the camera in my Flutter app to scan Barcodes. But everytime I try to open the camera on an Android device I get a grey screen which only disappear when I stop the app and restart it.
I use the package flutter_barcode_scanner
to open camera and scan barcode.
This is the error I get in the console:
Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed)
Here is my code but I dont think that the problem is the code itself:
Future scanBarcode() async {
String scanResult = '';
try {
scanResult = await FlutterBarcodeScanner.scanBarcode(
'ff6666', 'Cancel', true, ScanMode.BARCODE);
} on PlatformException {
print('ERROR');
}
if (!mounted) return;
print(scanResult);
}
I had the same problem. It usually happens when we did not pass the right parameters in FlutterBarcodeScanner.scanBarcode() method. In ur case, you forgot to put '#' in your hex color string. So replace "ff6666" with "#ff6666" and It should work.