logoutUserCallbacks static method

Future<void> logoutUserCallbacks({
  1. dynamic onSuccess()?,
  2. dynamic onFailure()?,
})

Logout the currently authenticated user

@param onSuccess Optional - If you need to be notified about the logout success @param onFailure Optional - If you need to be notified about the logout failure

Implementation

static Future<void> logoutUserCallbacks({
  Function()? onSuccess,
  Function()? onFailure,
}) async {
  try {
    _setObserver(
      ZendeskMessagingMessageType.logoutSuccess,
      onSuccess != null ? (Map? args) => onSuccess() : null,
    );
    _setObserver(
      ZendeskMessagingMessageType.logoutFailure,
      onFailure != null ? (Map? args) => onFailure() : null,
    );

    await _channel.invokeMethod('logoutUser');
  } catch (e) {
    debugPrint('ZendeskMessaging - logoutUser - Error: $e}');
  }
}