fetchGroupFileListFromServer method

Future<List<EMGroupSharedFile>> fetchGroupFileListFromServer(
  1. String groupId, {
  2. int pageSize = 200,
  3. int pageNum = 1,
})

~english Gets the shared files of the group from the server.

Param groupId The group ID.

Param pageSize The number of shared files per page.

Param pageNum The page number, starting from 1.

Return The shared files.

Throws A description of the exception. See EMError. ~end

~chinese 从服务器获取群组的共享文件列表。

Param groupId 群组 ID。

Param pageSize 每页返回的共享文件数量。

Param pageNum 当前页码,从 1 开始。

Return 返回共享文件列表。

Throws 如果有异常会在此抛出,包括错误码和错误信息,详见 EMError。 ~end

Implementation

Future<List<EMGroupSharedFile>> fetchGroupFileListFromServer(
  String groupId, {
  int pageSize = 200,
  int pageNum = 1,
}) async {
  Map req = {'groupId': groupId, 'pageNum': pageNum, 'pageSize': pageSize};
  Map result = await _channel.invokeMethod(
      ChatMethodKeys.getGroupFileListFromServer, req);
  try {
    EMError.hasErrorFromResult(result);
    List<EMGroupSharedFile> list = [];
    result[ChatMethodKeys.getGroupFileListFromServer]?.forEach((element) {
      list.add(EMGroupSharedFile.fromJson(element));
    });
    return list;
  } on EMError catch (e) {
    throw e;
  }
}