fetchGroupFileListFromServer method

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

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 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;
  }
}