fetchAnnouncementFromServer method

Future<String?> fetchAnnouncementFromServer(
  1. String groupId
)

~english Gets the group announcement from the server.

Param groupId The group ID.

Returns The group announcement, returns null if failed.

Throws Exception description, see EMError. ~end

~chinese 从服务器获取群公告。

Param groupId 群组 ID。

Return 群公告,失败返回空值。

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

Implementation

Future<String?> fetchAnnouncementFromServer(String groupId) async {
  try {
    Map req = {'groupId': groupId};
    Map result = await Client.instance.groupManager
        .callNativeMethod(ChatMethodKeys.getGroupAnnouncementFromServer, req);
    EMError.hasErrorFromResult(result);
    return result[ChatMethodKeys.getGroupAnnouncementFromServer];
  } catch (e) {
    rethrow;
  }
}