Last active
August 8, 2022 19:10
-
-
Save hawkkiller/758e890e901c48ee8848b9883060edc9 to your computer and use it in GitHub Desktop.
Create HTTP get request without using any libraries
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: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