fetchGroupInfoFromServer method

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

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 ChatError.

Implementation

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