FormData class

Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the XMLHttpRequest.send() method. It uses the same format a form would use if the encoding type were set to "multipart/form-data".

MDN reference

Constructors

FormData()
Creates a new FormData object.

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, Object value, [String? filename]) → void
Appends a new value onto an existing key inside a FormData object, or adds the key if it does not already exist.
delete(String name) → void
Deletes a key/value pair from a FormData object.
entries() Iterable<(String, Object)>
Returns an iterator that iterates through all key/value pairs contained in the FormData.
get(String name) Object?
Returns the first value associated with a given key from within a FormData object.
getAll(String name) Iterable<Object>
Returns an array of all the values associated with a given key from within a FormData.
has(String name) bool
Returns whether a FormData object contains a certain key.
keys() Iterable<String>
Returns an iterator iterates through all keys of the key/value pairs contained in the FormData.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
set(String name, Object value, [String? filename]) → void
Sets a new value for an existing key inside a FormData object, or adds the key/value if it does not already exist.
toString() String
A string representation of this object.
inherited
values() Iterable<Object>
Returns an iterator that iterates through all values contained in the FormData.

Operators

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

Static Methods

decode(Stream<Uint8List> stream, String boundary) Future<FormData>
Global helper, decode a Stream of Uint8List chunks to a FormData object.
encode(FormData fromData, String boundary) Stream<Uint8List>
Global helper, encode a FormData object to a Stream of Uint8List chunks.