Open zunimc opened 1 year ago
I'm having the same issue on Android, were you able to find a solution for this?
I'm having the same issue on Android, were you able to find a solution for this?
Android? That's weird as that OS worked like a charm on my code. Anyway I ended up replacing this library and found a working one: https://pub.dev/packages/code_scan
With very few adjustments I got the same result on both mobile systems. Hope that helps.
Is this the same code that you used for android too? And yeah it does help, thanks for the library recommendation
Yes, same code for both iOS and Android.
FutureBuilder<double>(
future: setScreenHeight(), // this functions returns a custom height for each device.
builder: (context, snapshot) {
return SizedBox(
height: snapshot.data, // result of setScreenHeight()
child: code_scan.CodeScanner(
onScan: (code, details, controller) {
setState(() {
checkBarcodeFormat(code!);
});
},
overlay: const Center(child: Text('')), // added this to have a clear view on the scan
formats: const [code_scan.BarcodeFormat.all],
once: false,
),
);
},
),
I have this simple code to start. I removed the torchlight and front camera buttons for simplicity.
I am testing it on real devices (iPhone 6S and iPhone 12).
Problem is as soon as I hit Hot Restart (Shift+R) camera stops working.
Performing hot restart... Restarted application in 1.097ms. flutter: mobile_scanner: MobileScannerException: code genericError, message: Called start() while already started!