logout static method

Future<void> logout({
  1. required dynamic onSuccess(
    1. String message
    )?,
  2. required dynamic onError(
    1. CometChatException excep
    )?,
})

Method to log out the user from CometChat

Implementation

static Future<void> logout({
  required Function(String message)? onSuccess,
  required Function(CometChatException excep)? onError
}) async {
  try {
    final result = await channel.invokeMethod('logout');
    if(onSuccess != null) onSuccess(result);
  } on PlatformException catch (platformException) {
    if(onError != null) onError(CometChatException(platformException.code, platformException.details, platformException.message));
  } catch (e) {
    if(onError != null) onError(CometChatException("Error", e.toString(), e.toString()));
  }
}