fetchChatThreadMembers method

Future<ChatCursorResult<String>> fetchChatThreadMembers({
  1. required String chatThreadId,
  2. String? cursor,
  3. int limit = 20,
})

分页获取子区成员。

@note 子区所属群组的所有成员均可调用该方法。

Param chatThreadId 子区 ID。

Param cursor 开始获取数据的游标位置,首次调用方法时传 null 或空字符串,按成员加入子区时间的正序获取数据。

Param limit 每页期望返回的成员数。取值范围为 1,50

Return 若调用成功,返回子区成员 ChatCursorResult;失败则抛出异常。

Throws 如果有异常会在此抛出,包括错误码和错误信息,详见 ChatError

Implementation

Future<ChatCursorResult<String>> fetchChatThreadMembers({
  required String chatThreadId,
  String? cursor,
  int limit = 20,
}) async {
  try {
    Map req = {
      "pageSize": limit,
      "threadId": chatThreadId,
    };
    req.putIfNotNull("cursor", cursor);
    Map result = await platform_interface.Client.instance.chatThreadManager.callNativeMethod(
      ChatMethodKeys.fetchChatThreadMember,
      req,
    );
    ChatError.hasErrorFromResult(result);
    return ChatCursorResult<String>.fromJson(
        result[ChatMethodKeys.fetchChatThreadMember],
        dataItemCallback: (obj) => obj);
  } catch (e) {
    rethrow;
  }
}