FormData extension type
The FormData
interface provides a way to construct a set of key/value
pairs representing form fields and their values, which can be sent using the
fetch
, XMLHttpRequest.send or navigator.sendBeacon
methods. It uses
the same format a form would use if the encoding type were set to
"multipart/form-data"
.
You can also pass it directly to the URLSearchParams constructor if you
want to generate query parameters in the way a form
would do if it were
using simple GET
submission.
An object implementing FormData
can directly be used in a for...of
structure, instead of FormData.entries
: for (const p of myFormData)
is
equivalent to for (const p of myFormData.entries())
.
Constructors
- FormData([HTMLFormElement form, HTMLElement? submitter])
-
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
Methods
-
append(
String name, JSAny blobValueOrValue, [String filename]) → void -
The
append()
method of the FormData interface appends a new value onto an existing key inside aFormData
object, or adds the key if it does not already exist. -
delete(
String name) → void -
The
delete()
method of the FormData interface deletes a key and its value(s) from aFormData
object. -
get(
String name) → FormDataEntryValue? -
The
get()
method of the FormData interface returns the first value associated with a given key from within aFormData
object. If you expect multiple values and want all of them, use the FormData.getAll method instead. -
getAll(
String name) → JSArray< FormDataEntryValue> -
The
getAll()
method of the FormData interface returns all the values associated with a given key from within aFormData
object. -
has(
String name) → bool -
The
has()
method of the FormData interface returns whether aFormData
object contains a certain key. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
set(
String name, JSAny blobValueOrValue, [String filename]) → void -
The
set()
method of the FormData interface sets a new value for an existing key inside aFormData
object, or adds the key/value if it does not already exist. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited