FYI-
We'll be removing the HttpRequest.get and getWithCredentials factory constructors and replacing them with static methods returning futures. These are primarily ease-of-use methods and we're looking to make them a bit easier to use.
Old syntax:
new HttpRequest.get(url, (xhr) { if (xhr.status == 200) {
var result = xhr.response;
} else {
// error?
}
});
New syntax:
HttpRequest.request(url).then(
(xhr) {
var result = xhr.response;
},
onError: (e) {
// error!
HttpRequest.getWithCredentials will be HttpRequest.request(url, withCredentials: true);
For simple get scenarios you can use HttpRequest.getString(url) which returns a Future<String>.