dispose method

Future<void> dispose()

Dispose all resources.

Implementation

Future<void> dispose() async {
  // Cancel all stream subscriptions
  await _cleanupSubscriptions();

  stopHeartbeat();
  await _registry.adapter.disconnect();
  await _database.close();
  await _encryption.dispose();
  _eventBus.dispose();
  await _eventController.close();
  await _identityChanged.close();
  await _syncEngine.dispose();
  await _outboundQueue.dispose();
  _connectionState.dispose();
  _syncStatus.dispose();
  _pendingCount.dispose();
  _sessionState.dispose();
  _isInitialized = false;
  ChatLogger.info('Chat SDK disposed');
}