Instantly share code, notes, and snippets.

Embed
What would you like to do?
import 'dart:async';
import 'package:http/http.dart' as http;
Future makeRequest(String url) => http.get(url)
.then((res) => res.body);
void main() {
makeRequest('http://www.google.com')
.then((value) => print(value))
.catchError((e) => print(e.toString()));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment