Skip to content

Instantly share code, notes, and snippets.

@momshaddinury
Created February 12, 2020 08:32
Show Gist options
  • Save momshaddinury/a1aafd430b35e53b85525aabb337c367 to your computer and use it in GitHub Desktop.
Save momshaddinury/a1aafd430b35e53b85525aabb337c367 to your computer and use it in GitHub Desktop.
getAsset() async {
print('Test: ${getAssets.noticeList}'); //DEBUG
String notice;
for (notice in getAssets.noticeList) {
assetResponse = await http.get(noticeDownloadURL + notice);
documentDirectory = await getApplicationDocumentsDirectory();
firstPath = documentDirectory.path + "/notices";
filePathAndName = documentDirectory.path + '/notices/$notice';
}
//await Directory(firstPath).create(recursive: true);
File file2 = new File(filePathAndName);
file2.writeAsBytesSync(assetResponse.bodyBytes);
setState(() {
print('check2');
imageData = filePathAndName;
dataLoaded = true;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment