Navaron Bracke

fix bug with try catch

... ... @@ -159,21 +159,23 @@ class MobileScannerController {
.values[await _methodChannel.invokeMethod('state') as int? ?? 0];
switch (state) {
case MobileScannerState.undetermined:
bool result = false;
try {
final bool result =
result =
await _methodChannel.invokeMethod('request') as bool? ?? false;
if (!result) {
throw const MobileScannerException(
errorCode: MobileScannerErrorCode.permissionDenied,
);
}
} catch (error) {
isStarting = false;
throw const MobileScannerException(
errorCode: MobileScannerErrorCode.genericError,
);
} finally {
}
if (!result) {
isStarting = false;
throw const MobileScannerException(
errorCode: MobileScannerErrorCode.permissionDenied,
);
}
break;
... ...