kill method

void kill({
  1. int priority = Isolate.beforeNextEvent,
})

Requestes to terminate the flutter isolate. As the isolate that is created is backed by a FlutterBackgroundView/FlutterEngine for the platform implementations, the event loop will continue to execute even after user code has completed. Thus they must be explicitly terminate using kill if you wish to dispose of them after you have finished. This should cleanup the native components backing the isolates.

Implementation

void kill({int priority = Isolate.beforeNextEvent}) => _isolateId != null
    ? _control.invokeMethod("kill_isolate", {"isolate_id": _isolateId})
    : Isolate.current.kill(priority: priority);