dispose method

Future<void> dispose()

Disposes the worker: fails pending requests, sends workerDisposeOp to the isolate (if non-null), kills the isolate, and closes ports.

Safe to call without awaiting, the isolate is killed synchronously.

Implementation

Future<void> dispose() async {
  rpc.failAllAndDispose(disposeOp: workerDisposeOp);
  _initialized = false;
}