Showing
1 changed file
with
10 additions
and
3 deletions
| @@ -113,12 +113,14 @@ class MobileScannerWebPlugin { | @@ -113,12 +113,14 @@ class MobileScannerWebPlugin { | ||
| 113 | .map((e) => toFormat(e)) | 113 | .map((e) => toFormat(e)) |
| 114 | .toList(); | 114 | .toList(); |
| 115 | } | 115 | } |
| 116 | + | ||
| 116 | final Duration? detectionTimeout; | 117 | final Duration? detectionTimeout; |
| 117 | if (arguments.containsKey('timeout')) { | 118 | if (arguments.containsKey('timeout')) { |
| 118 | detectionTimeout = Duration(milliseconds: arguments['timeout'] as int); | 119 | detectionTimeout = Duration(milliseconds: arguments['timeout'] as int); |
| 119 | } else { | 120 | } else { |
| 120 | detectionTimeout = null; | 121 | detectionTimeout = null; |
| 121 | } | 122 | } |
| 123 | + | ||
| 122 | await barCodeReader.start( | 124 | await barCodeReader.start( |
| 123 | cameraFacing: cameraFacing, | 125 | cameraFacing: cameraFacing, |
| 124 | formats: formats, | 126 | formats: formats, |
| @@ -138,10 +140,11 @@ class MobileScannerWebPlugin { | @@ -138,10 +140,11 @@ class MobileScannerWebPlugin { | ||
| 138 | }); | 140 | }); |
| 139 | } | 141 | } |
| 140 | }); | 142 | }); |
| 143 | + | ||
| 141 | final hasTorch = await barCodeReader.hasTorch(); | 144 | final hasTorch = await barCodeReader.hasTorch(); |
| 142 | 145 | ||
| 143 | if (hasTorch && arguments.containsKey('torch')) { | 146 | if (hasTorch && arguments.containsKey('torch')) { |
| 144 | - barCodeReader.toggleTorch(enabled: arguments['torch'] as bool); | 147 | + await barCodeReader.toggleTorch(enabled: arguments['torch'] as bool); |
| 145 | } | 148 | } |
| 146 | 149 | ||
| 147 | return { | 150 | return { |
| @@ -150,8 +153,12 @@ class MobileScannerWebPlugin { | @@ -150,8 +153,12 @@ class MobileScannerWebPlugin { | ||
| 150 | 'videoHeight': barCodeReader.videoHeight, | 153 | 'videoHeight': barCodeReader.videoHeight, |
| 151 | 'torchable': hasTorch, | 154 | 'torchable': hasTorch, |
| 152 | }; | 155 | }; |
| 153 | - } catch (e) { | ||
| 154 | - throw PlatformException(code: 'MobileScannerWeb', message: '$e'); | 156 | + } catch (e, stackTrace) { |
| 157 | + throw PlatformException( | ||
| 158 | + code: 'MobileScannerWeb', | ||
| 159 | + message: '$e', | ||
| 160 | + details: stackTrace.toString(), | ||
| 161 | + ); | ||
| 155 | } | 162 | } |
| 156 | } | 163 | } |
| 157 | 164 |
-
Please register or login to post a comment