how to use uncompleted url in plugin InAppWebView for browsing in flutter

Issue

if I input link: youtube.com, URLRequest(url: Uri.parse(url)) will not response this url, so I have to input https://www.youtube.com/, but normal user will not input so complicated url link, so is that a way to let InAppWebView confirm this uncompleted url?

Solution

A work around:

  1. In the Input field use a prefix text as "https://" and get the URL from the user. In this way the user would know to not type the HTTP part again. ( like the dollar symbol in the below image)
  2. Edit this line to: URLRequest("https://"+url: Uri.parse("https://"+url))

enter image description here

How to add prefix text to input field? ANSWER

Answered By – Nagulan S

Answer Checked By – Pedro (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *