clearActiveCall static method

Future<void> clearActiveCall()

Clears the locally stored active call session.

Migration Note: Migrated from platform channels to native Dart implementation. Uses CallRepository for clearing active call. Behavior and signature remain identical for backward compatibility.

Android Reference: CometChat.clearActiveCall()

Implementation

static Future<void> clearActiveCall() async {
  try {
    // Drop the cached initial call alongside the active-call state so a stale
    // joinedAt cannot leak into the next session.
    _initialCall = null;

    // Get SDK instance
    final sdk = SdkRegistry.getInstance();

    // Call native Dart call repository
    await sdk.calls.clearActiveCall();
  } catch (e) {
    // Silently fail (matches original behavior)
    _errorCallbackHandler(null, null, e, null);
  }
}