registerWorker<T extends LoggerWorker> static method

void registerWorker<T extends LoggerWorker>(
  1. String id,
  2. WorkerCreator workerCreator
)

Registers a worker creator with a unique identifier. id is the unique identifier for the worker type. workerCreator is the function that creates the worker.

Implementation

static void registerWorker<T extends LoggerWorker>(
  String id,
  WorkerCreator workerCreator,
) {
  if (workers.containsKey(id)) {
    throw Exception('Worker with id $id is already registered.');
  }
  workers[id] = workerCreator;
}