start method

  1. @override
Future<Channel> start()
inherited

Creates a Channel and starts the worker using the _entryPoint.

Implementation

@override
Future<Channel> start() async {
  if (isStopped) {
    throw WorkerException('Invalid state: worker is stopped');
  }

  final args = getStartArgs() ?? const [];
  _openChannel ??= Channel.open(
      exceptionManager, channelLogger, _entryPoint, args, _threadHook);
  final channel = _channel ?? await _openChannel;
  if (_channel == null) {
    _channel = channel;
    _stats.start();
  }
  return _channel!;
}