Skip to content

Instantly share code, notes, and snippets.

@hawkkiller
Last active August 8, 2022 19:10
Show Gist options
  • Save hawkkiller/758e890e901c48ee8848b9883060edc9 to your computer and use it in GitHub Desktop.
Save hawkkiller/758e890e901c48ee8848b9883060edc9 to your computer and use it in GitHub Desktop.
Create HTTP get request without using any libraries
import 'dart:io';
Future<void> main() {
final sock = await Socket.connect('www.google.com', 80);
sock.write('GET / HTTP/1.0\r\nHost: www.google.com\r\n\r\n');
sock.listen((event) {
print(String.fromCharCodes(event));
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment