-
-
Save marcossevilla/8c5bc340998f6e453ecb2122bd245da3 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
final client = Dio(); | |
final url = 'https://images.unsplash.com/photo-1567026392301-672e510f3369'; | |
final directory = await getTemporaryDirectory(); | |
final fileName = '${directory.path}/downloads'; | |
await client.download( | |
url, | |
fileName, | |
options: Options(headers: {HttpHeaders.acceptEncodingHeader: '*'}), | |
onReceiveProgress: (received, total) { | |
if (total != -1) { | |
final pos = received / total * 100; | |
print(pos); | |
} | |
}, | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment