getLocalUserInfoByIds method

Future<Map<String, ChatUserInfo>> getLocalUserInfoByIds(
  1. List<String> userIds
)

~english Gets the user attributes of the specified users from the local database.

Param userIds The list of user IDs.

Return A map that contains key-value pairs where the key is the user ID and the value is user attributes.

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

~chinese 从本地数据库获取指定用户的用户属性。

Param userIds 用户 ID 列表。

Return 返回 key-value 格式的 Map 类型数据,key 为用户 ID,value 为用户属性。

Throws 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。请参见 ChatError。 ~end

Implementation

Future<Map<String, ChatUserInfo>> getLocalUserInfoByIds(
  List<String> userIds,
) async {
  try {
    Map req = {'userIds': userIds};
    Map result = await platform_interface.Client.instance.userInfoManager
        .callNativeMethod(ChatMethodKeys.getLocalUserInfoByIds, req);
    ChatError.hasErrorFromResult(result);
    Map<String, ChatUserInfo> resultMap = {};
    result[ChatMethodKeys.getLocalUserInfoByIds]?.forEach((key, value) {
      resultMap[key] = ChatUserInfo.fromJson(value);
    });
    return resultMap;
  } catch (e) {
    rethrow;
  }
}