Skip to content

Instantly share code, notes, and snippets.

@DenisDov
Last active February 24, 2019 22:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DenisDov/71505865c6bdfac3a828ad37f708b090 to your computer and use it in GitHub Desktop.
Save DenisDov/71505865c6bdfac3a828ad37f708b090 to your computer and use it in GitHub Desktop.
Dart fetch
import 'dart:convert';
import 'dart:html';
void main() {
_getUsersList();
}
_getUsersList() {
final url = 'https://jsonplaceholder.typicode.com/users';
Future<HttpRequest> request = HttpRequest.request(url);
request.then((value) {
List res = json.decode(value.responseText);
print(res);
}).catchError((error) => print(error));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment