destroy method

Future<void> destroy()

Destroys the isolate and closes the receive port if not running on the web.

Implementation

Future<void> destroy() async {
  recorderStream.close();
  if (!recordReadyHelper.isCompleted) {
    recordReadyHelper.complete(true);
  }

  if (!kIsWeb) {
    _isolateManager.destroy();
  } else {
    _webWorkerManager.destroy();
  }
}