I have written a function to submit a form to a REST API. Here is the code:
HttpRequest request;
void submitForm(Event e) {
e.preventDefault(); // Don't do the default submit.
request = new HttpRequest();
request.onReadyStateChange.listen(onData);
// POST the data to the server.
var url = 'http://127.0.0.1:8000/api/v1/users';
request.open('GET', url, true, theData['userName'], theData['password']);
request.send();
}
From the documentation you can have five arguments as follows when you open the request:
void open(String method, String url, {bool async, String user, String password})
See here for details.
As you can see I have utilized all 5 arguments allowed but for some reason I get this error:
2 positional arguments expected, but 5 found
Any suggestions as to why?