Last active
February 24, 2019 22:04
-
-
Save DenisDov/71505865c6bdfac3a828ad37f708b090 to your computer and use it in GitHub Desktop.
Dart fetch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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