Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

main_live.dart example currentState.toggle() exception #106

Open
vasilich6107 opened this issue Mar 19, 2020 · 1 comment
Open

main_live.dart example currentState.toggle() exception #106

vasilich6107 opened this issue Mar 19, 2020 · 1 comment

Comments

@vasilich6107
Copy link

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)
...
════════════════════════════════════════════════════════════════════════════════════════════════════

@vasilich6107
Copy link
Author

Hi @Kleak @jaumard.
Any thoughts, comments?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant