URLSearchParams extension type
The URLSearchParams
interface defines utility methods to work with the
query string of a URL.
An object implementing URLSearchParams
can directly be used in a
for...of
structure to iterate over key/value pairs in the same order as
they appear in the query string, for example the following two lines are
equivalent:
for (const [key, value] of mySearchParams) {
}
for (const [key, value] of mySearchParams.entries()) {
}
API documentation sourced from MDN Web Docs.
- on
- Implemented types
- Available extensions
Constructors
- URLSearchParams([JSAny init])
-
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- size → int
-
The
size
read-only property of the URLSearchParams interface indicates the total number of search parameter entries.no setter
Methods
-
append(
String name, String value) → void -
The
append()
method of the URLSearchParams interface appends a specified key/value pair as a new search parameter. -
delete(
String name, [String value]) → void -
The
delete()
method of the URLSearchParams interface deletes specified parameters and their associated value(s) from the list of all search parameters. -
get(
String name) → String? -
The
get()
method of the URLSearchParams interface returns the first value associated to the given search parameter. -
getAll(
String name) → JSArray< JSString> -
The
getAll()
method of the URLSearchParams interface returns all the values associated with a given search parameter as an array. -
has(
String name, [String value]) → bool -
The
has()
method of the URLSearchParams interface returns a boolean value that indicates whether the specified parameter is in the search parameters. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
set(
String name, String value) → void -
The
set()
method of the URLSearchParams interface sets the value associated with a given search parameter to the given value. If there were several matching values, this method deletes the others. If the search parameter doesn't exist, this method creates it. -
sort(
) → void -
The
URLSearchParams.sort()
method sorts all key/value pairs contained in this object in place and returnsundefined
. The sort order is according to unicode code points of the keys. This method uses a stable sorting algorithm (i.e. the relative order between key/value pairs with equal keys will be preserved). -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited