onExit property

Future onExit

A future that fires when the isolate exits.

If the isolate has already exited, this will complete immediately.


Future get onExit => _onExitMemo.runOnce(() async {
      try {
        await _scope.getInState(_scope.streams.isolate, () async {
          try {
            await load();
            return null;
          } on VMSentinelException catch (_) {
            // Return a non-null value to indicate that the breakpoint is in the
            // expected state—that is, it no longer exists.
            return true;
        }, (json) {
          if (json["isolate"]["id"] != _scope.isolateId) return null;
          if (json["kind"] != "IsolateExit") return null;
          return true;
      } on StateError catch (_) {
        // Ignore state errors. They indicate that the underlying stream closed
        // before an exit event was fired, which means that the process and thus
        // this isolate is dead.