diff --git a/packages/flutter/lib/src/foundation/_isolates_io.dart b/packages/flutter/lib/src/foundation/_isolates_io.dart index 061acef613..d7e9212521 100644 --- a/packages/flutter/lib/src/foundation/_isolates_io.dart +++ b/packages/flutter/lib/src/foundation/_isolates_io.dart @@ -19,7 +19,7 @@ Future compute(isolates.ComputeCallback callback, Q message, { St final ReceivePort exitPort = ReceivePort(); final ReceivePort errorPort = ReceivePort(); Timeline.finishSync(); - final Isolate isolate = await Isolate.spawn<_IsolateConfiguration>>( + await Isolate.spawn<_IsolateConfiguration>>( _spawn, _IsolateConfiguration>( callback, @@ -61,7 +61,6 @@ Future compute(isolates.ComputeCallback callback, Q message, { St resultPort.close(); exitPort.close(); errorPort.close(); - isolate.kill(); Timeline.finishSync(); return result.future; } @@ -94,8 +93,8 @@ Future _spawn(_IsolateConfiguration> configuration) a flow: Flow.step(configuration.flowId), ); Timeline.timeSync( - '${configuration.debugLabel}: returning result', - () { configuration.resultPort.send(result); }, + '${configuration.debugLabel}: exiting and returning a result', () {}, flow: Flow.step(configuration.flowId), ); + Isolate.exit(configuration.resultPort, result); }