start method

void start(
  1. String isolateName
)

Implementation

void start(String isolateName) {
  _fromIsolatePort.listen((event) {
    if (event is SendPort) {
      _toIsolatePort = event;
      if (_isClosed) {
        _toIsolatePort?.send(StopIsolate());
      }
    } else {
      _fromIsolateConsumer.handleMessage(event);
    }
  });

  Isolate.spawn<(SendPort, BidirectionalIsolateLogic)>(
    _entryPoint,
    (_fromIsolatePort.sendPort, _logic),
    debugName: isolateName,
  );
}