dispose method

void dispose()

Releases the worker and any remaining resources. After calling dispose, re-using the worker property will recreate the native object and will require a second call to dispose.

Implementation

void dispose() {
  if (_worker != null) {
    _log.fine('Closing $taskName worker');
    final errorMessageMemory = calloc<Pointer<Char>>();
    final status = closeWorker(_worker!, errorMessageMemory);
    _worker = null;
    handleErrorMessage(errorMessageMemory, status);
    errorMessageMemory.free(1);
  }
}