fetchChatRoomInfoFromServer method

Future<EMChatRoom> fetchChatRoomInfoFromServer(
  1. String roomId,
  2. {bool fetchMembers = false}
)

从服务器获取聊天室详情,默认不取成员列表。

Param roomId 聊天室 ID。

Return 返回聊天室对象。

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

Implementation

Future<EMChatRoom> fetchChatRoomInfoFromServer(
  String roomId, {
  bool fetchMembers = false,
}) async {
  Map result = await _channel.invokeMethod(
      ChatMethodKeys.fetchChatRoomInfoFromServer,
      {"roomId": roomId, "fetchMembers": fetchMembers});
  try {
    EMError.hasErrorFromResult(result);
    return EMChatRoom.fromJson(
        result[ChatMethodKeys.fetchChatRoomInfoFromServer]);
  } on EMError catch (e) {
    throw e;
  }
}