Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mention IsolateNameServer on isolates.md #6338

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/content/language/isolates.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,15 @@ main isolate. Isolates can only communicate via message passing.
They can’t “see” inside each others’ memory,
which is where the name “isolate” comes from.

:::note
In some cases when you don't have easy access to the point isolates are created
and cannot pass the communication channel during `Isolate.spawn` call,
you can instead use the [IsolateNameServer](https://api.flutter.dev/flutter/dart-ui/IsolateNameServer-class.html).
It is a global mapping of names to ports where
isolates can dynamically register themselves
for future discovery among other isolates.
:::

To set up this 2-way communication, first create a [`ReceivePort`][]
in the main isolate, then pass its [`SendPort`][] as an argument to the
new isolate when spawning it with `Isolate.spawn`.
Expand Down
Loading