logoutOfChatSDK method

  1. @override
Future<void> logoutOfChatSDK(
  1. dynamic callback(
    1. FlyResponse response
    )?
)
override

This method is used to logout the user from the SDK.

Implementation

@override
Future<void> logoutOfChatSDK(Function(FlyResponse response)? callback) async {
  //logout
  bool? logoutResponse;
  try {
    logoutResponse =
        await mirrorFlyMethodChannel.invokeMethod<bool>('logoutOfChatSDK');
    LogMessage.d("logoutResponse ", " $logoutResponse");
    callback?.call(FlyResponse(true, FlyConstants.empty, FlyConstants.empty));
    // return logoutResponse ?? false;
  } on PlatformException catch (e) {
    LogMessage.d("Platform Exception =", " $e");
    callback?.call(FlyResponse(false, FlyConstants.empty, FlyConstants.empty,
        FlyException(e.code, e.message, e.details)));
  } on Exception catch (e) {
    LogMessage.d("Exception ", " $e");
    callback?.call(FlyResponse(false, FlyConstants.empty, FlyConstants.empty,
        FlyException(FlyErrorCode.unHandle, FlyErrorMessage.unHandle, e)));
  }
}