General constructor for any type of request (GET, POST, etc).
This call is used in conjunction with open
:
var request = new HttpRequest();
request.open('GET', 'http://dartlang.org');
request.onLoad.listen((event) => print(
'Request complete ${event.target.reponseText}'));
request.send();
is the (more verbose) equivalent of
HttpRequest.getString('http://dartlang.org').then(
(result) => print('Request complete: $result'));
Source
@DomName('XMLHttpRequest.XMLHttpRequest')
@DocsEditable()
factory HttpRequest() {
return _blink.BlinkXMLHttpRequest.instance.constructorCallback_0_();
}