closeWhenParentIsolateExits method

Future closeWhenParentIsolateExits()

Implementation

Future closeWhenParentIsolateExits() async {
  /// Ensures that the spawned isolates will die when "this" isolate dies.
  final self = this;
  final current = Isolate.current;

  /// Ensures that the spawned isolates will die when "this" isolate dies.
  await singleResponseFuture(current.addOnExitListener);
  return await self.close();
}