init method

Future<void> init()

Initializes the pool by spawning the isolates.

This method is automatically called when the first task is submitted.

Implementation

Future<void> init() async {
  if (_initialized) return;
  for (var i = 0; i < poolSize; i++) {
    final worker = _PoolWorker();
    await worker.init();
    _workers.add(worker);
  }
  _initialized = true;
}