-
-
Save praveenb/3dba81ebc583ef63aef133ae5dcf3dbb to your computer and use it in GitHub Desktop.
Revisions
-
slightfoot created this gist
Apr 13, 2018 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ static var httpClient = new HttpClient(); Future<File> _downloadFile(String url, String filename) async { var request = await httpClient.getUrl(Uri.parse(url)); var response = await request.close(); var bytes = await consolidateHttpClientResponseBytes(response); String dir = (await getApplicationDocumentsDirectory()).path; File file = new File('$dir/$filename'); await file.writeAsBytes(bytes); return file; }