When calling a URL with launchUrl, the primary one or two occasions it navigates to the right URL, however after that, it will get caught on a selected URL. Beneath is the code I used.
String getReportUrl() {
remaining String formattedDate =
DateFormat('yyyy-MM-dd').format(strToDateTime(errorDate));
print(
"CALL https://www.aaa.web/bbb/ccc-ddd?retailer=${knowledge.retailer}&startDate=$formattedDate&endDate=$formattedDate");
return "https://www.aaa.web/bbb/ccc-ddd?retailer=${knowledge.retailer}&startDate=$formattedDate&endDate=$formattedDate";
}
void _clickURL() async {
Uri url = Uri.parse(getReportUrl());
if (await canLaunchUrl(url)) {
await launchUrl(url);
} else {
throw "Couldn't launch $url";
}
}
Why does this occur, and please present an answer.
I checked if there was a difficulty with parsing the URL in getReportUrl(), however every part was superb. Additionally, I logged the URL in the course of the name, and the log confirmed the right URL I meant to navigate to.