Isolate constructor

Isolate(
  1. SendPort controlPort,
  2. {Capability? pauseCapability,
  3. Capability? terminateCapability}
)

Creates a new Isolate object with a restricted set of capabilities.

The port should be a control port for an isolate, as taken from another Isolate object.

The capabilities should be the subset of the capabilities that are available to the original isolate. Capabilities of an isolate are locked to that isolate, and have no effect anywhere else, so the capabilities should come from the same isolate as the control port.

Can also be used to create an Isolate object from a control port, and any available capabilities, that have been sent through a SendPort.

Example:

Isolate isolate = findSomeIsolate();
Isolate restrictedIsolate = Isolate(isolate.controlPort);
untrustedCode(restrictedIsolate);

This example creates a new Isolate object that cannot be used to pause or terminate the isolate. All the untrusted code can do is to inspect the isolate and see uncaught errors or when it terminates.

Implementation

Isolate