Created
May 6, 2019 22:04
-
-
Save KickedDroid/aee6b156648c520d013d2724be1d0593 to your computer and use it in GitHub Desktop.
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
HttpClient client = new HttpClient(); | |
var _downloadData = List<int>(); | |
var fileSave = new File('./logo.png'); | |
client.getUrl(Uri.parse("https://fluttermaster.com/wp-content/uploads/2018/08/fluttermaster.com-logo-web-header.png")) | |
.then((HttpClientRequest request) { | |
return request.close(); | |
}) | |
.then((HttpClientResponse response) { | |
response.listen((d) => _downloadData.addAll(d), | |
onDone: () { | |
fileSave.writeAsBytes(_downloadData); | |
} | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment