fetchChatRoomMembers method

Future<ChatCursorResult<String>> fetchChatRoomMembers(
  1. String roomId, {
  2. String? cursor,
  3. int pageSize = 200,
})

~english Gets the chat room member list.

Param roomId The chat room ID.

Param cursor The cursor position from which to start getting data.

Param pageSize The number of members per page.

Return The list of chat room members. See ChatCursorResult. If ChatCursorResult.cursor is an empty string (""), all data is fetched.

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

~chinese 获取聊天室成员列表。

返回的结果中,当 ChatCursorResult.cursor 为空字符串 ("") 时,表示没有更多数据。

Param roomId 聊天室 ID。

Param cursor 从这个游标位置开始取数据。

Param pageSize 每页返回的成员数。

Return 分页获取结果 ChatCursorResult

Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 ChatError。 ~end

Implementation

Future<ChatCursorResult<String>> fetchChatRoomMembers(
  String roomId, {
  String? cursor,
  int pageSize = 200,
}) async {
  Map req = {"roomId": roomId, "pageSize": pageSize};
  req.putIfNotNull("cursor", cursor);
  Map result =
      await _channel.invokeMethod(ChatMethodKeys.fetchChatRoomMembers, req);
  try {
    ChatError.hasErrorFromResult(result);
    return ChatCursorResult<String>.fromJson(
        result[ChatMethodKeys.fetchChatRoomMembers],
        dataItemCallback: (obj) => obj);
  } on ChatError catch (e) {
    throw e;
  }
}