Makes a server POST request with the specified data encoded as form data.
Makes a server POST request with the specified data encoded as form data.
This is roughly the POST equivalent of getString. This method is similar to sending a FormData object with broader browser support but limited to String values.
If data is supplied, the key/value pairs are URI encoded with Uri.encodeQueryComponent and converted into an HTTP query string.
Unless otherwise specified, this method appends the following header:
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Here's an example of using this method:
var data = { 'firstName' : 'John', 'lastName' : 'Doe' };
HttpRequest.postFormData('/send', data).then((HttpRequest resp) {
// Do something with the response.
});
See also: