getLocalUserInfoByIds method

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

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

Param userIds 用户 ID 列表。

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

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

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;
  }
}