fetchGroupFileListFromServer method

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

获取群共享文件列表。

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

Return 群共享文件列表。

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

Implementation

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