start method
Start the isolate isolateId. It sends its stop port to control,
its errors to error and tells exit when it ends. ports are
closed when the isolate ends.
Implementation
@override
Future<Isolate> start(
int isolateId,
SendPort control,
SendPort error,
SendPort exit,
List<ReceivePort> ports,
) {
ReceivePort hello = ReceivePort();
ports.add(hello);
hello.listen((dynamic worker) {
hello.close();
(worker as SendPort).send(<Object?>[
control,
RateLimitCounter.instance.port,
SessionMemoryStore.instance.port,
IsolateBus.instance.port,
]);
});
GroupIdentity identity = GroupIdentity(
isolateId,
Dox().isolateCount,
hello.sendPort.nativePort,
);
return Isolate.spawnUri(
snapshot,
<String>[],
null,
debugName: identity.debugName,
onError: error,
onExit: exit,
);
}