append method
Appends a new value onto an existing key inside a FormData object, or adds the key if it does not already exist.
To append File with additional settings like: filename
, you can use
appendFile method or pass FileField to append method.
Implementation
void append(String key, dynamic value) {
ArgumentError.checkNotNull(key, 'key');
if (value is File) {
appendFile(key, value);
} else if (value is num || value is bool) {
_addEntry(key, value.toString());
} else if (value is String || value is FileField || value == null) {
_addEntry(key, value);
} else {
throw ArgumentError.value(
value,
'value',
'Type ${value.runtimeType} is not valid form data value type.\n'
'FormData supports: File, FileField, String, double, int, bool.',
);
}
}