URL class

Uniform Resource Locator (URL) is a text string that specifies where a resource (such as a web page, image, or video) can be found on the Internet.

MDN reference

Constructors

URL(Object url, [Object? base])
Creates and returns a URL object referencing the URL specified using an absolute URL string, or a relative URL string and a base URL string.
factory

Properties

hash String
A string containing a '#' followed by the fragment identifier of the URL.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
host String
A string containing the domain (that is the hostname) followed by (if a port was specified) a ':' and the port of the URL.
getter/setter pair
hostname String
A string containing the domain of the URL.
getter/setter pair
href String
A stringifier that returns a string containing the whole URL.
getter/setter pair
origin String
Returns a string containing the origin of the URL, that is its scheme, its domain and its port.
no setter
password String
A string containing the password specified before the domain name.
getter/setter pair
pathname String
A string containing an initial '/' followed by the path of the URL, not including the query string or fragment.
getter/setter pair
port String
A string containing the port number of the URL.
getter/setter pair
protocol String
A string containing the protocol scheme of the URL, including the final ':'.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
A string indicating the URL's parameter string; if any parameters are provided, this string includes all of them, beginning with the leading ? character.
no setter
searchParams URLSearchParams
A URLSearchParams object which can be used to access the individual query parameters found in search.
no setter
username String
A string containing the username specified before the domain name.
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJSON() String
Returns a string containing the whole URL. It returns the same string as the href property.
toString() String
Returns a string containing the whole URL. It is a synonym for URL.href, though it can't be used to modify the value.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited