URL extension type
The URL
interface is used to parse, construct, normalize, and encode .
It works by providing properties which allow you to easily read and modify
the components of a URL.
You normally create a new URL
object by specifying the URL as a string
when calling its constructor, or by providing a relative URL and a base URL.
You can then easily read the parsed components of the URL or make changes to
the URL.
If a browser doesn't yet support the URL.URL constructor, you can access a URL object using the Window interface's URL property. Be sure to check to see if any of your target browsers require this to be prefixed.
API documentation sourced from MDN Web Docs.
- on
- Implemented types
- Available extensions
Properties
- hash ↔ String
-
The
hash
property of the URL interface is 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
-
The
host
property of the URL interface is a string containing the host, that is the URL.hostname, and then, if the of the URL is nonempty, a':'
, followed by the URL.port of the URL.getter/setter pair - hostname ↔ String
-
The
hostname
property of the URL interface is a string containing the of the URL.getter/setter pair - href ↔ String
-
The
href
property of the URL interface is a string containing the whole URL.getter/setter pair - isDefinedAndNotNull → bool
-
Available on JSAny?, provided by the NullableUndefineableJSAnyExtension extension
no setter - isNull → bool
-
Available on JSAny?, provided by the NullableUndefineableJSAnyExtension extension
Whether this value corresponds to JavaScriptnull
.no setter - isTruthy → JSBoolean
-
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of!!
in JavaScript.this
no setter - isUndefined → bool
-
Available on JSAny?, provided by the NullableUndefineableJSAnyExtension extension
Whether this value corresponds to JavaScriptundefined
.no setter - isUndefinedOrNull → bool
-
Available on JSAny?, provided by the NullableUndefineableJSAnyExtension extension
no setter - not → JSBoolean
-
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of!
in JavaScript.this
no setter - origin → String
-
The
origin
read-only property of the URL interface returns a string containing the Unicode serialization of the origin of the represented URL.no setter - password ↔ String
-
The
password
property of the URL interface is a string containing the password specified before the domain name.getter/setter pair - pathname ↔ String
-
The
pathname
property of the URL interface represents a location in a hierarchical structure. It is a string constructed from a list of path segments, each of which is prefixed by a/
character. If the URL has no path segments, the value of itspathname
property will be the empty string.getter/setter pair - port ↔ String
-
The
port
property of the URL interface is a string containing the port number of the URL.getter/setter pair - protocol ↔ String
-
The
protocol
property of the URL interface is a string representing 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
- search ↔ String
-
The
search
property of the URL interface is a search string, also called a query string, that is a string containing a'?'
followed by the parameters of the URL.getter/setter pair - searchParams → URLSearchParams
-
The
searchParams
read-only property of the URL interface returns a URLSearchParams object allowing access to theGET
decoded query arguments contained in the URL.no setter - username ↔ String
-
The
username
property of the URL interface is a string containing the username specified before the domain name.getter/setter pair
Methods
-
add(
JSAny? any) → JSAny -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
+any
-
and(
JSAny? any) → JSAny? -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
&&any
-
callMethod<
R extends JSAny?> (JSAny method, [JSAny? arg1, JSAny? arg2, JSAny? arg3, JSAny? arg4]) → R -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Callsmethod
on this JSObject with up to four arguments. -
callMethodVarArgs<
R extends JSAny?> (JSAny method, [List< JSAny?> ? arguments]) → R -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Callsmethod
on this JSObject with a variable number ofarguments
. -
dartify(
) → Object? -
Available on JSAny?, provided by the JSAnyUtilityExtension extension
Converts a JavaScript value to the Dart equivalent if possible. -
delete(
JSAny property) → JSBoolean -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Deletes the property with keyproperty
from this JSObject. -
divide(
JSAny? any) → JSAny -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
/any
-
equals(
JSAny? any) → JSBoolean -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
==any
-
exponentiate(
JSAny? any) → JSAny -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
**any
-
getProperty<
R extends JSAny?> (JSAny property) → R -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
The value of the property keyproperty
of this JSObject. -
greaterThan(
JSAny? any) → JSBoolean -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
>any
-
greaterThanOrEqualTo(
JSAny? any) → JSBoolean -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
>=any
-
has(
String property) → bool -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Shorthand helper for hasProperty to check whether this JSObject contains the property keyproperty
, but takes and returns a Dart value. -
hasProperty(
JSAny property) → JSBoolean -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Whether or not this JSObject contains the property keyproperty
. -
instanceof(
JSFunction constructor) → bool -
Available on JSAny?, provided by the JSAnyUtilityExtension extension
Whether thisJSAny?
is aninstanceof
constructor
. -
instanceOfString(
String constructorName) → bool -
Available on JSAny?, provided by the JSAnyUtilityExtension extension
Whether thisJSAny?
is aninstanceof
the constructor that is defined byconstructorName
, which is looked up in the globalContext. -
isA<
T extends JSAny?> () → bool -
Available on JSAny?, provided by the JSAnyUtilityExtension extension
Whether thisJSAny?
is an instance of the JavaScript type that is declared byT
. -
lessThan(
JSAny? any) → JSBoolean -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
<any
-
lessThanOrEqualTo(
JSAny? any) → JSBoolean -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
<=any
-
modulo(
JSAny? any) → JSAny -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
%any
-
multiply(
JSAny? any) → JSAny -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
*any
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notEquals(
JSAny? any) → JSBoolean -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
!=any
-
or(
JSAny? any) → JSAny? -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
||any
-
setProperty(
JSAny property, JSAny? value) → void -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Write thevalue
of property keyproperty
of this JSObject. -
strictEquals(
JSAny? any) → JSBoolean -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
===any
-
strictNotEquals(
JSAny? any) → JSBoolean -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
!==any
-
subtract(
JSAny? any) → JSAny -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
-any
-
toJSON(
) → String -
The
toJSON()
method of the URL interface returns a string containing a serialized version of the URL, although in practice it seems to have the same effect as URL.toString. -
toString(
) → String -
A string representation of this object.
inherited
-
typeofEquals(
String typeString) → bool -
Available on JSAny?, provided by the JSAnyUtilityExtension extension
Whether the result oftypeof
on thisJSAny?
istypeString
. -
unsignedRightShift(
JSAny? any) → JSNumber -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
>>>any
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
String property) → JSAny? -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Shorthand helper for getProperty to get the value of the property keyproperty
of this JSObject, but takes and returns a Dart value. -
operator []=(
String property, JSAny? value) → void -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Shorthand helper for setProperty to write thevalue
of the property keyproperty
of this JSObject, but takes a Dart value.
Static Methods
-
canParse(
String url, [String base]) → bool -
The
URL.canParse()
static method of the URL interface returns a boolean indicating whether or not an absolute URL, or a relative URL combined with a base URL, are parsable and valid. -
createObjectURL(
JSObject obj) → String - @AvailableInWorkers("window_and_worker_except_service")
-
parse(
String url, [String base]) → URL? -
The
URL.parse()
static method of the URL interface returns a newly created URL object representing the URL defined by the parameters. -
revokeObjectURL(
String url) → void - @AvailableInWorkers("window_and_worker_except_service")