logout static method

void logout({
  1. required dynamic onSuccess(
    1. String
    ),
  2. required dynamic onError(
    1. CometChatCallsException
    ),
})

Logs out of the CometChat Calls SDK. Clears all stored credentials and session data. Requirements: 2.8

Implementation

static void logout(
    {required Function(String onSuccess) onSuccess,
    required Function(CometChatCallsException excep) onError}) async {
  try {
    ApiConnection().logout((success) {
      _internalLogOut();
      _notifyLogoutSuccess();
      onSuccess(ErrorMessageConstants.messageLogOutSuccess);
    }, (error) {
      _internalLogOut();
      _notifyLogoutSuccess();
      onSuccess(ErrorMessageConstants.messageLogOutSuccess);
    });
  } catch (e) {
    final exception = CometChatCallsException.wrapUnhandled(e);
    _internalLogOut();
    _notifyLogoutFailure(exception);
    onError(exception);
  }
}