fetchChatRoomMembers method

Future<EMCursorResult<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 EMCursorResult. If EMCursorResult.cursor is an empty string (""), all data is fetched.

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

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

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

Param roomId 聊天室 ID。

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

Param pageSize 每页返回的成员数。

Return 分页获取结果 EMCursorResult

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

Implementation

Future<EMCursorResult<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 {
    EMError.hasErrorFromResult(result);
    return EMCursorResult<String>.fromJson(
        result[ChatMethodKeys.fetchChatRoomMembers],
        dataItemCallback: (obj) => obj);
  } on EMError catch (e) {
    throw e;
  }
}