fetchGroupInfoFromServer method

Future<EMGroup> fetchGroupInfoFromServer(
  1. String groupId, {
  2. @Deprecated('') bool? fetchMembers,
})

~english Fetches group details including group ID, name, description, basic settings, owner and admins.

Param groupId The group ID.

Returns The group instance.

Throws Exception description, see EMError. ~end

~chinese 获取群组详情,包含群组 ID、名称、描述、基本属性、群主和管理员。

Param groupId 群组 ID。

Return 群组实例。

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

Implementation

Future<EMGroup> fetchGroupInfoFromServer(
  String groupId, {
  @Deprecated('') bool? fetchMembers,
}) async {
  Map req = {"groupId": groupId};
  req.putIfNotNull("fetchMembers", fetchMembers);
  Map result = await Client.instance.groupManager
      .callNativeMethod(ChatMethodKeys.getGroupSpecificationFromServer, req);
  try {
    EMError.hasErrorFromResult(result);
    return EMGroup.fromJson(
        result[ChatMethodKeys.getGroupSpecificationFromServer]);
  } catch (e) {
    rethrow;
  }
}