Showing
1 changed file
with
12 additions
and
1 deletions
| @@ -171,7 +171,18 @@ class MethodChannelMobileScanner extends MobileScannerPlatform { | @@ -171,7 +171,18 @@ class MethodChannelMobileScanner extends MobileScannerPlatform { | ||
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | @override | 173 | @override |
| 174 | - Widget buildCameraView() => Texture(textureId: _textureId!); | 174 | + Widget buildCameraView() { |
| 175 | + if (_textureId == null) { | ||
| 176 | + throw const MobileScannerException( | ||
| 177 | + errorCode: MobileScannerErrorCode.controllerUninitialized, | ||
| 178 | + errorDetails: MobileScannerErrorDetails( | ||
| 179 | + message: 'The controller was not yet initialized. Call start() before calling buildCameraView().', | ||
| 180 | + ), | ||
| 181 | + ); | ||
| 182 | + } | ||
| 183 | + | ||
| 184 | + return Texture(textureId: _textureId!); | ||
| 185 | + } | ||
| 175 | 186 | ||
| 176 | @override | 187 | @override |
| 177 | Future<void> resetZoomScale() async { | 188 | Future<void> resetZoomScale() async { |
-
Please register or login to post a comment