kickAllDevices method

Future<void> kickAllDevices({
  1. required String userId,
  2. required String pwdOrToken,
  3. bool isPwd = true,
})

~english Forces the specified account to log out from all devices.

Param userId The account you want to force to log out from all the devices.

Param pwdOrToken The password or token.

Param isPwd Whether a password or token is used: (Default)true: A password is used; false: A token is used.

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

~chinese 将指定账号登录的所有设备都踢下线。

Param userId 用户 ID。

Param pwdOrToken 密码 或 token。

Param isPwd 是否使用密码或 token:(默认)true:使用密码;false:使用 token。

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

~end

Implementation

Future<void> kickAllDevices({
  required String userId,
  required String pwdOrToken,
  bool isPwd = true,
}) async {
  Map req = {'username': userId, 'password': pwdOrToken, 'isPwd': isPwd};
  Map result =
      await ClientChannel.invokeMethod(ChatMethodKeys.kickAllDevices, req);
  try {
    EMError.hasErrorFromResult(result);
  } on EMError catch (e) {
    throw e;
  }
}