I wrote a form submission function in the 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 a query:
void open(String method, String url, {bool async, String user, String password})
See here for more details.
As you can see, I used all 5 arguments, but for some reason I get this error:
2 positional arguments expected, but 5 found
Any suggestions as to why?
source share