Closed tomcurran closed 3 years ago
Awesome @tomcurran I was trying to solve this issue for a while, but I wasn't sure on how to approach the problem.
This issue affect Android devices as well, I just tried your change in an Android device and I get the following error.
Any idea why this happens?
Not sure @mlopez0 I've only got one Android device (Pixel 5) and I'm not getting the error. I don't know much about the Isolate
stuff. I just rearranged the calls so IsolateUtils.start()
would fully complete before any of the camera initialisation code would execute. Before both were happening in parrallel.
@mlopez0 would you be able to explain the purpose of the isolate stuff? That might help me understand it and be able to work on a fix. Happy to continue over another messaging platform if that's easier
@mlopez0 I was experimenting with channels to do something similar. Let me know what you think of this https://github.com/tomcurran/object_detection_flutter/tree/feature/isolate2
Not sure @mlopez0 I've only got one Android device (Pixel 5) and I'm not getting the error. I don't know much about the
Isolate
stuff. I just rearranged the calls soIsolateUtils.start()
would fully complete before any of the camera initialisation code would execute. Before both were happening in parrallel.
My bad @tomcurran , I tested your commit with a heavily modified version of this project. I had an extra isolateUtils.start();
which caused the mentioned error.
I re-tested in a clean version of this project and everything run great!.
@mlopez0 I was experimenting with channels to do something similar. Let me know what you think of this https://github.com/tomcurran/object_detection_flutter/tree/feature/isolate2
Wow, I checked your code, I will test it. I've never worked with channels before, thanks for sharing this approach.
@mlopez0 good to know the original changes weren't causing any issues :)
Thanks a lot, @tomcurran for the PR.
Moved all the
initState
code into an async method to be able to call await onIsolateUtils.start()
and ensure it's fully set up before proceeding to initialise the camera. The cameras callbacks used the isolate which was causing a crash.