compute function manually close Isolate running this task?
It is not possible to kill a
The reason for this is that looking at the source code of the
compute function, the created
isolate is only killed after the
result completer has finished:
final Completer<R> result = Completer<R>(); ... await result.future; ... isolate.kill(); // Always awaits the result.
The result is only completed if there is either an error or the function you pass to
Furthermore, you do not have access to the
isolate yourself because it is created inside of the
If you want to be able kill the isolate you launch, do not use
compute. Instead, you will have to create the
Answered By – creativecreatorormaybenot
Answer Checked By – Clifford M. (FlutterFixes Volunteer)