'validate input url is valid, sometimes without http at start

refer to Validate a URL, without requiring it, using a Regular Expression in Flutter I understand how to validate url, but sometimes user will just input the short web link like: youtube.com. in this case how to validate in still safe validation rules?

I tried: bool validURL = Uri.parse("https://google.com/").host == '' ? false : true; but still does not work



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source