initialize method

Future<void> initialize()

Initializes the isolate pool by spawning poolSize persistent workers.

Implementation

Future<void> initialize() async {
  if (_isInitialized) return;

  for (int i = 0; i < poolSize; i++) {
    final worker = _IsolateWorker(id: i);
    await worker.spawn();
    _workers.add(worker);
  }

  _isInitialized = true;
}