Created
September 18, 2021 09:00
-
-
Save nkenna/9d7ed19260cf5a374a6a91ac7aba1e99 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
Future<void> downloadFile() async { | |
downloading = true; | |
Dio dio = Dio(); | |
try { | |
var dir = await getApplicationDocumentsDirectory(); | |
await dio.download( | |
"https://piccity/223433.png", | |
"${dir.path}/downloaded.png", | |
onReceiveProgress: (rec, total) { | |
print("Rec: $rec , Total: $total"); | |
}); | |
} catch (e) { | |
print(e); | |
} | |
print("Download completed"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment