reinitializeAfterSession method

Future<void> reinitializeAfterSession()

Re-initializes the Calls SDK after a session ends. Per the V5 SDK sample app: "The SDK's internal state can get cleared after a session, so this ensures subsequent calls work properly."

Implementation

Future<void> reinitializeAfterSession() async {
  final settings = CometChatUIKit.authenticationSettings;
  if (settings?.appId != null && settings?.region != null) {
    _callsSdkReady = false;
    _callsSdkCompleter = null;
    await _initCallsSdk(settings!.appId!, settings.region!);
    developer.log('CallEventService: SDK re-initialized after session');
  }
}