dispose method

Future<void> dispose()

Disposes the call and Jason client if it was previously initialized.

Implementation

Future<void> dispose() {
  Log.debug('dispose()', '$runtimeType');

  _heartbeat?.cancel();
  _participated = _participated || connected || isActive;
  _stateWorker?.dispose();
  connected = false;

  return _mediaSettingsGuard.protect(() async {
    _disposeLocalMedia();
    _devicesSubscription?.cancel();
    _displaysSubscription?.cancel();
    _heartbeat?.cancel();
    _outputWorker?.dispose();
    connected = false;
    if (!_background) {
      await _closeRoom();
    }
  });
}