fetchGroupInfoFromServer method

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

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

Param groupId 群组 ID。

Return 群组实例。

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

Implementation

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