Dart / Flutter – Validating a string for URL
To check Valid URL string you just have to use Uri.parse() like below. bool _validURL = Uri.parse(_adVertData.webLink).isAbsolute; Just check value of _validURL
To check Valid URL string you just have to use Uri.parse() like below. bool _validURL = Uri.parse(_adVertData.webLink).isAbsolute; Just check value of _validURL
Here is another implementation of this solution: using System.Net; /// /// Checks the file exists or not. /// /// The URL of the remote file. /// True : If the file exits, False if file not exists private bool RemoteFileExists(string url) { try { //Creating the HttpWebRequest HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest; //Setting the … Read more
Use URLUtil to validate the URL as below. URLUtil.isValidUrl(url) It will return True if URL is valid and false if URL is invalid.