start method

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

Creates a Channel and starts the worker using the _entryPoint.

Implementation

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

  if (_channel != null) {
    return Future.value(_channel!);
  }

  return _openChannel ??= Channel.open(
    exceptionManager,
    channelLogger,
    _entryPoint,
    getStartArgs() ?? const [],
    _threadHook,
  ).then((channel) {
    _channel = channel;
    _stats.start();
    return channel;
  });
}