deinitialize static method

Future<void> deinitialize()

Deinitialize the CloudX SDK

Cleans up SDK resources and resets initialization state. Call this when you need to completely tear down the SDK, such as during app logout. You can reinitialize the SDK afterward by calling initialize() again.

Implementation

static Future<void> deinitialize() async {
  // Cancel EventChannel subscription to prevent memory leak
  await _eventSubscription?.cancel();
  _eventSubscription = null;
  _eventStreamInitialized = false;

  // Clear listener storage
  _listeners.clear();

  // Call native deinitialize
  await _invokeMethod('deinitialize');
}