logout method

Future<void> logout([
  1. bool unbindDeviceToken = true
])

Logs out.

Param unbindDeviceToken Whether to unbind the token upon logout.

true (default) Yes. false No.

Throws A description of the exception. See ChatError.

Implementation

Future<void> logout([
  bool unbindDeviceToken = true,
]) async {
  try {
    ChatLog.v('logout unbindDeviceToken: $unbindDeviceToken');
    Map req = {'unbindToken': unbindDeviceToken};
    Map result =
        await platform_interface.Client.instance.callNativeMethod(ChatMethodKeys.logout, req);
    ChatError.hasErrorFromResult(result);
    _clearAllInfo();
  } catch (e) {
    rethrow;
  }
}