fetchMuteListFromServer method

Future<Map<String, int>> fetchMuteListFromServer(
  1. String groupId,
  2. {int pageSize = 200,
  3. int pageNum = 1}
)

Gets the mute list of the group from the server.

Only the group owner or admin can call this method.

Param groupId The group ID.

Param pageSize The number of muted members per page.

Param pageNum The page number, starting from 1.

Return The group mute map, key is memberId and value is mute time.

Throws A description of the exception. See ChatError.

Implementation

Future<Map<String, int>> fetchMuteListFromServer(
  String groupId, {
  int pageSize = 200,
  int pageNum = 1,
}) async {
  Map req = {'groupId': groupId, 'pageNum': pageNum, 'pageSize': pageSize};
  Map result = await _channel.invokeMethod(
      ChatMethodKeys.getGroupMuteListFromServer, req);
  try {
    ChatError.hasErrorFromResult(result);
    Map? tmpMap = result[ChatMethodKeys.getGroupMuteListFromServer];
    Map<String, int> ret = {};
    if (tmpMap != null) {
      for (var item in tmpMap.entries) {
        if (item.key is String && item.value is int) {
          ret[item.key] = item.value;
        }
      }
    }
    return ret;
  } on ChatError catch (e) {
    throw e;
  }
}