Future<String> getString(String url, { bool withCredentials, void onProgress(ProgressEvent e) })

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);
}