fetchChatThreadMembers method

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

~english Paging to get Chat Thread members.

The members of the group to which Chat Thread belongs have permission.

Param chatThreadId Chat Thread ID.

Param cursor The initial value can be empty or empty string.

Param limit The number of fetches at one time. Value range 1, 50.

Return The result of EMCursorResult, including the cursor for getting data next time and the chat thread member list.

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

~chinese 分页获取子区成员。

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

Param chatThreadId 子区 ID。

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

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

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

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

Implementation

Future<EMCursorResult<String>> fetchChatThreadMembers({
  required String chatThreadId,
  String? cursor,
  int limit = 20,
}) async {
  Map req = {
    "pageSize": limit,
    "threadId": chatThreadId,
  };
  req.putIfNotNull("cursor", cursor);
  Map result = await _channel.invokeMethod(
    ChatMethodKeys.fetchChatThreadMember,
    req,
  );
  try {
    EMError.hasErrorFromResult(result);
    return EMCursorResult<String>.fromJson(
        result[ChatMethodKeys.fetchChatThreadMember],
        dataItemCallback: (obj) => obj);
  } on EMError catch (e) {
    throw e;
  }
}