fetchSubscribedUsers method

Future<List<ChatUserInfo>> fetchSubscribedUsers()

获取当前用户已订阅用户属性的用户列表。

Return 已订阅的用户列表。请参见 ChatUserInfo

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

Implementation

Future<List<ChatUserInfo>> fetchSubscribedUsers() async {
  try {
    Map result = await platform_interface.Client.instance.userInfoManager
        .callNativeMethod(ChatMethodKeys.fetchSubscribedUsers);
    ChatError.hasErrorFromResult(result);
    List<ChatUserInfo> list = [];
    result[ChatMethodKeys.fetchSubscribedUsers]?["users"]?.forEach((element) {
      list.add(ChatUserInfo.fromJson(element));
    });
    return list;
  } catch (e) {
    rethrow;
  }
}