parse static method

URL? parse(
  1. String url, [
  2. String base
])

The URL.parse() static method of the URL interface returns a newly created URL object representing the URL defined by the parameters.

If the given base URL or the resulting URL are not parsable and valid URLs, null is returned. This is an alternative to using the URL.URL constructor to construct a URL within a try...catch block, or using URL.canParse_static to check the parameters and returning null if the method returns false.

Implementation

external static URL? parse(
  String url, [
  String base,
]);