logout method

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

~english Logs out.

Param unbindDeviceToken Whether to unbind the token upon logout.

true (default) Yes. false No.

Throws A description of the exception. See EMError. ~end

~chinese 退出登录。

Param unbindDeviceToken 退出时是否解绑设备 token。

  • (默认)true:是。
  • false:否。

Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 EMError。 ~end

Implementation

Future<void> logout([
  bool unbindDeviceToken = true,
]) async {
  EMLog.v('logout unbindDeviceToken: $unbindDeviceToken');
  Map req = {'unbindToken': unbindDeviceToken};
  Map result = await ClientChannel.invokeMethod(ChatMethodKeys.logout, req);
  try {
    EMError.hasErrorFromResult(result);
    _clearAllInfo();
  } on EMError catch (e) {
    throw e;
  }
}