Isolate constructor
- SendPortcontrolPort, {
- Capability?pauseCapability,
- Capability?terminateCapability,
Creates a newIsolate object with a restricted set of capabilities.
The port should be a control port for an isolate, as taken fromanotherIsolate object.
The capabilities should be the subset of the capabilities that areavailable to the original isolate.Capabilities of an isolate are locked to that isolate, and have no effectanywhere else, so the capabilities should come from the same isolate asthe control port.
Can also be used to create anIsolate object from a control port, andany available capabilities, that have been sent through aSendPort.
Example:
Isolate isolate = findSomeIsolate();Isolate restrictedIsolate = Isolate(isolate.controlPort);untrustedCode(restrictedIsolate);This example creates a newIsolate object that cannot be used topause or terminate the isolate. All the untrusted code can do is toinspect the isolate and see uncaught errors or when it terminates.
Implementation
Isolate(this.controlPort, {this.pauseCapability, this.terminateCapability});