Showing
1 changed file
with
17 additions
and
1 deletions
| @@ -185,8 +185,24 @@ class MobileScannerController { | @@ -185,8 +185,24 @@ class MobileScannerController { | ||
| 185 | 185 | ||
| 186 | // Check authorization status | 186 | // Check authorization status |
| 187 | if (!kIsWeb) { | 187 | if (!kIsWeb) { |
| 188 | - final MobileScannerState state = MobileScannerState | 188 | + final MobileScannerState state; |
| 189 | + | ||
| 190 | + try { | ||
| 191 | + state = MobileScannerState | ||
| 189 | .values[await _methodChannel.invokeMethod('state') as int? ?? 0]; | 192 | .values[await _methodChannel.invokeMethod('state') as int? ?? 0]; |
| 193 | + } on PlatformException catch (error) { | ||
| 194 | + isStarting = false; | ||
| 195 | + | ||
| 196 | + throw MobileScannerException( | ||
| 197 | + errorCode: MobileScannerErrorCode.genericError, | ||
| 198 | + errorDetails: MobileScannerErrorDetails( | ||
| 199 | + code: error.code, | ||
| 200 | + details: error.details as Object?, | ||
| 201 | + message: error.message, | ||
| 202 | + ), | ||
| 203 | + ); | ||
| 204 | + } | ||
| 205 | + | ||
| 190 | switch (state) { | 206 | switch (state) { |
| 191 | case MobileScannerState.undetermined: | 207 | case MobileScannerState.undetermined: |
| 192 | bool result = false; | 208 | bool result = false; |
-
Please register or login to post a comment