ultralytics / yolo-flutter-app

A Flutter plugin for Ultralytics YOLO computer vision models
https://ultralytics.com
GNU Affero General Public License v3.0
106 stars 41 forks source link

I can't stop the live prediction phase (the pauseLivePrediction method is not implemented on iOS), and closeCamera() doesn't work. #67

Open skynicolettid opened 1 month ago

skynicolettid commented 1 month ago

I can't stop the live prediction part in the dispose() method of the widget. Even if I navigate to a new page, the camera remains active (high CPU usage), and if I call "await controller.closeCamera()", it doesn't complete. How can I correctly release all the resources before navigating to a new page? Thanks.

P:S all the Steaming are correctly closed.

skynicolettid commented 1 month ago

Found the issue: This set of code in MethodCallHandler.swit in case of method with no parameters exit on return and the closeClamera() is not reached:

public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { guard let args = call.arguments as? [String: Any] else { return }

We can use this code:

public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {

    let args = call.arguments as? [String: Any] ?? [:]