getLoggedInDevicesFromServer method

  1. @Deprecated('Use [fetchLoggedInDevices] instead')
Future<List<EMDeviceInfo>> getLoggedInDevicesFromServer({
  1. required String userId,
  2. required String password,
})

~english Gets the list of currently logged-in devices of a specified account.

Param userId The user ID.

Param password The password.

Return The list of the logged-in devices.

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

~chinese 获取指定账号下登录的在线设备列表。

Param userId 用户 ID。

Param password 密码。

Return 获取到到设备列表。

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

Implementation

@Deprecated('Use [fetchLoggedInDevices] instead')

/// ~english
/// Gets the list of currently logged-in devices of a specified account.
///
/// Param [userId] The user ID.
///
/// Param [password] The password.
///
/// **Return** The list of the logged-in devices.
///
/// **Throws** A description of the exception. See [EMError].
/// ~end
///
/// ~chinese
/// 获取指定账号下登录的在线设备列表。
///
/// Param [userId] 用户 ID。
///
/// Param [password] 密码。
///
/// **Return**  获取到到设备列表。
///
/// **Throws**  如果有异常会在这里抛出,包含错误码和错误描述,详见 [EMError]。
/// ~end
Future<List<EMDeviceInfo>> getLoggedInDevicesFromServer(
    {required String userId, required String password}) async {
  Map req = {'username': userId, 'password': password};
  Map result = await ClientChannel.invokeMethod(
      ChatMethodKeys.getLoggedInDevicesFromServer, req);
  try {
    EMError.hasErrorFromResult(result);
    List<EMDeviceInfo> list = [];
    result[ChatMethodKeys.getLoggedInDevicesFromServer]?.forEach((info) {
      list.add(EMDeviceInfo.fromJson(info));
    });
    return list;
  } on EMError catch (e) {
    throw e;
  }
}