In Dart, I can do:
await HttpRequest.getString(path)
and this will return a string.
I want to create a method that will do the same, but like this:
HttpRequest request = new HttpRequest();
request
..open('Get',getPath)
..setRequestHeader('Content-Type','application/json')
..send('');
...
return responseString;
I can do this with events and futures, but I would like to understand how to do it with async and wait extra.
Edit: This is for dart: html HttpRequest for browser.
source
share