fetchGroupFileListFromServer method

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

~english Gets the group shared file list from the server.

Param groupId The group ID. Param pageNum The page number. Param pageSize The number of results expected per page.

Returns The group shared file list.

Throws Exception description, see EMError. ~end

~chinese 获取群共享文件列表。

Param groupId 群组 ID。 Param pageNum 获取第几页。 Param pageSize 每页获取的数量。

Return 群共享文件列表。

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

Implementation

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