isolate_worker library

Allows for easy multithreading when you have computational tasks that can be defined by a single method in a single extended class.

Example:

var pool = new IsolateWorkerPool();
await pool.init();
var tasks = [];
for (int i = 0; i < 1000; i++) {
  tasks.add(new FibonacciTask(30));
}
var results = await pool.sendMany(tasks);
results.forEach(print);
pool.destroy();

In this case, the FibonacciTask can be defined thusly:

class FibonacciTask extends IsolateTask /*<int, int>*/ {
  FibonacciTask(int payload) : super(payload);

  @override
  int execute(int payload) {
    return fibonacci(payload);
  }
}

Classes

IsolateTask<T, R>
Extend this class like so:
IsolateWorker<T, R>
A single worker representing one Isolate.
IsolateWorkerPool<T, R>
A pool of workers.