When I want to end an isolate launched on the server created using
how can I terminate the isolate.
throw x inside an isolate terminates the isolate when the exception is uncaught.
But I hope there is a more elegant solution.
Uncaught Error: Unsupported operation: kill
I guess when no more async operations are active the isolate ends (similar to
main) but how can I know if the isolate has actually terminated?
Is there a way for the parent isolate to get notified when the child isolate terminates?
Uncaught Error: Unsupported operation: addOnExitListener
Are there alternative ways or do I have to wait until these methods are supported?
The way to detect that an Isolate terminates after it has been
successfully created is to use Isolate.addOnExitListener (possibly
also Isolate.addErrorListener if needing to know why it
terminated). Start the isolate paused, then when the Future
of Isolate.spawnUri completes you can set up listeners and then
resume the isolate.
So we have a way, it is still not implemented by the VM/Dartium, but
that’s another issue.
Answered By – Günter Zöchbauer
Answer Checked By – Senaida (FlutterFixes Volunteer)