Hi. I'm trying to use toggle from main_live.dart example but getting exception in console.
It seems that the main reason of this exception is that we did not stop streaming before taiking picture.
I tried to add
await _cameraController.stopImageStream().catchError((_) {}); here https://tppr.me/JaUhs and this fixes the issue.
════════ Exception caught by services library ══════════════════════════════════════════════════════
The following PlatformException was thrown while de-activating platform stream on channel plugins.flutter.io/camera/imageStream:
PlatformException(error, Attempt to invoke virtual method 'void android.media.ImageReader.setOnImageAvailableListener(android.media.ImageReader$OnImageAvailableListener, android.os.Handler)' on a null object reference, null)
When the exception was thrown, this was the stack:
#0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:569:7)
#1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:156:18)
<asynchronous suspension>
#2 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:329:12)
#3 EventChannel.receiveBroadcastStream.<anonymous closure> (package:flutter/src/services/platform_channel.dart:531:29)
...
════════════════════════════════════════════════════════════════════════════════════════════════════
Hi. I'm trying to use
toggle
frommain_live.dart
example but getting exception in console.It seems that the main reason of this exception is that we did not stop streaming before taiking picture.
I tried to add
await _cameraController.stopImageStream().catchError((_) {});
here https://tppr.me/JaUhs and this fixes the issue.