Description
Hello,
I am experiencing an issue with controller.onDispose in the ultralytics_yolo package. Despite calling controller.dispose() in the dispose method of my widget, it seems that the onDispose callback does not execute as expected.
Here's the relevant part of my code:
@OverRide
void dispose() {
if (objectDetectorInstance != null) {
objectDetectorInstance.ultralyticsYoloPlatform.closeCamera();
objectDetectorInstance.ultralyticsYoloPlatform.pauseLivePrediction();
}
if (controller != null) {
controller.dispose();
}
_isControllerDisposed = true;
super.dispose();
}
void _disposeResources() {
if (!_isControllerDisposed) {
_isControllerDisposed = true;
controller.pauseLivePrediction();
controller.closeCamera();
objectDetectorInstance.ultralyticsYoloPlatform.closeCamera();
objectDetectorInstance.ultralyticsYoloPlatform.pauseLivePrediction();
}
}
The dispose method is supposed to clean up resources, but it appears that the controller.onDispose callback does not function as anticipated.
Has anyone encountered a similar issue or have suggestions on how to resolve this?
Thank you!