Tuesday, February 20, 2024
HomeiOS Developmentandroid - Flutter - launchUrl: After I execute flutter launchUrl(url), the URL...

android – Flutter – launchUrl: After I execute flutter launchUrl(url), the URL I intend to navigate to and the URL that really opens within the net are totally different


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.



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments