I wanted to read through the HTML of a website from a dio get request in my flutter code. The website takes in an input, for my case in the URL and loads for some time before showing all the received data from the backend. Because it takes time to parse my request and fetch and display, my dio request only shows me half of the website, and the other half is not displayed because it is not yet fetched. I need help for making it wait or on how I can get the other half.
Here is my code:
BaseOptions options = new BaseOptions(
connectTimeout: 10000,
receiveTimeout: 10000,
);
Dio dio = new Dio(options);
String url = 'https://x.com/?url=https://x.x.x/x/';
try {
final response = await dio.get(url);
print(response.data);
final document = parse(response.data);
final downloadPage = document.getElementsByClassName('results-list');
for (Element resultsAll in downloadPage) {
final downloadLinks =
resultsAll.getElementsByClassName('download-link');
print(resultsAll.classes.toString());
}
} catch (e) {
print(e);
}