initializeWorker<A, S> method Null safety

void initializeWorker<A, S>(
  1. Type isolateWorkerType
)

Implementation

void initializeWorker<A, S>(Type isolateWorkerType) {
  assert(
    _freeWorkers.containsKey(isolateWorkerType),
    'You must register worker or worker wrapper to create it.',
  );
  print('[meowchannel] Initialized worker in ${Isolate.current.debugName}');

  // ignore: close_sinks
  final worker = _getFreeWorkerByType(isolateWorkerType);
  worker
    .where((event) => event is WorkerOutEvent)
    .listen((event) => _isolatedConnector.sendEvent(event));
  _isolatedConnector.sendEvent(IsolateWorkerCreatedEvent(worker.id, worker.runtimeType));
}