join method

Future<void> join()

Waits for the Isolate to complete execution.

Equivalent to Java's thread.join(). Returns a Future that completes when the Isolate sends a 'done' signal or terminates.

Throws InvalidArgumentException if called before start().

Example:

await thread.join();

Implementation

Future<void> join() {
  if (_joinCompleter == null) {
    throw InvalidArgumentException('DartThread has not been started.');
  }
  return _joinCompleter!.future;
}