Navaron Bracke

fix check for permission state

@@ -45,7 +45,7 @@ class MobileScannerPermissions { @@ -45,7 +45,7 @@ class MobileScannerPermissions {
45 return if (hasPermission) { 45 return if (hasPermission) {
46 1 46 1
47 } else { 47 } else {
48 - 0 48 + 2
49 } 49 }
50 } 50 }
51 51
@@ -189,8 +189,9 @@ class MobileScannerController { @@ -189,8 +189,9 @@ class MobileScannerController {
189 final MobileScannerState state; 189 final MobileScannerState state;
190 190
191 try { 191 try {
192 - state = MobileScannerState  
193 - .values[await _methodChannel.invokeMethod('state') as int? ?? 0]; 192 + state = MobileScannerState.fromRawValue(
  193 + await _methodChannel.invokeMethod('state') as int? ?? 0,
  194 + );
194 } on PlatformException catch (error) { 195 } on PlatformException catch (error) {
195 isStarting = false; 196 isStarting = false;
196 197