getString method
Future<String> getString(Creates a GET request for the specified url
.
The server response must be a text/
mime type for this request to succeed.
This is similar to request but specialized for HTTP GET requests which return text content.
To add query parameters, append them to the url
following a ?
, joining each key to its value with =
and separating key-value pairs with &
.
var name = Uri.encodeQueryComponent('John'); var id = Uri.encodeQueryComponent('42'); HttpRequest.getString('users.json?name=$name&id=$id') .then((HttpRequest resp) { // Do something with the response. });
See also:
Source
static Future<String> getString(String url, {bool withCredentials, void onProgress(ProgressEvent e)}) { return request(url, withCredentials: withCredentials, onProgress: onProgress) .then((HttpRequest xhr) => xhr.responseText); }
© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/1.24.3/dart-html/HttpRequest/getString.html