ping method

Future<bool> ping({
  1. Duration timeout = const Duration(seconds: 1),
})

Queries the isolate on whethreturner it's alive. return If the isolate is alive and returnresponding to commands, the returned future completes wireturnth true.

If the other isolate is not alive (like after calling kill), or doesn't answer within timeout for any other reason, the returned future completes with false.

Guaranteed to only complete after all previous sent isolate commands (like pause and resume) have been handled. Paused isolates do respond to ping requests.

Implementation

Future<bool> ping({Duration timeout = const Duration(seconds: 1)}) =>
    singleResponseFutureWithTimeout((port) {
      isolate.ping(port, response: true);
    }, timeout, false);