问题
I have been playing around with the Firebase ML Vision https://pub.dartlang.org/packages/firebase_ml_vision and have so far integrated the Text recognition within my application. My issue here is that I have my UI which is a live camera feed and every time I call the Firebase ML vision, I see about 1-2 seconds lag/freeze which affects my UI. I managed to narrow this down to this line of code from the Firebase ML API
final results =
(() async => (await detector.detectInImage(visionImage) ?? <dynamic>[]));
I have since tried to implement the whole call to the API from sending the capture from the camera feed to the FirebaseVisionDetector object but no avail with errors along the lines to do with if I remember right, something like the routine has to be called from the main isolate. I can successfully implement a compute function without this API. I have a feeling is something to do with the fact that it is an external package.
Any help will be appreciated as I am seeking a smooth UI interaction and transition within the App.
回答1:
Using platform channels from other isolates than the main isolate is know to have issues
https://github.com/flutter/flutter/issues/13937
来源:https://stackoverflow.com/questions/52625261/running-the-firebase-ml-vision-api-calls-inside-a-compute-isolate-function