kickDevice method
~english Forces the specified account to log out from the specified device.
Param userId
The account you want to force to log out.
Param pwdOrToken
The password or token.
Param resource
The device ID. For how to fetch the device ID, See ChatDeviceInfo.resource.
Throws A description of the exception. See ChatError. ~end
~chinese 将指定账号登录的指定设备踢下线。
Param userId
用户 ID。
Param pwdOrToken
密码 / token。
Param resource
设备 ID,详见 ChatDeviceInfo.resource。
Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 ChatError。 ~end
Implementation
Future<void> kickDevice({
required String userId,
required String pwdOrToken,
required String resource,
bool isPwd = true,
}) async {
EMLog.v('kickDevice: $userId, "******"');
Map req = {
'username': userId,
'password': pwdOrToken,
'resource': resource,
'isPwd': isPwd,
};
Map result =
await ClientChannel.invokeMethod(ChatMethodKeys.kickDevice, req);
try {
ChatError.hasErrorFromResult(result);
} on ChatError catch (e) {
throw e;
}
}