fetchGroupInfoFromServer method

Future<EMGroup> fetchGroupInfoFromServer(
  1. String groupId, {
  2. bool fetchMembers = false,
})

~english Gets the group information from the server.

This method does not get member information. If member information is required, call fetchMemberListFromServer.

Param groupId The group ID.

Param fetchMembers Whether to get group members. By default, a list of 200 members is fetched.

Return The group instance.

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

~chinese 从服务器获取群组的详细信息。

该方法不获取成员。如需获取成员,使用 fetchMemberListFromServer

Param groupId 群组 ID。

Return 群组描述。

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

Implementation

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