How can I download a file with retrofit?

What ı want to achive is very simple,

I want to download a file with using retrofit package for dart and I want to show it while downloading, with progress indicator like linked tutorial but can I achive my goal using retrofit or not ?

And also, I succeed with just using dio package like tutorial but I couln't configure out adding some custom headers like x-auth or cookies without package so if you guys help me with this I will be grateful.

https://medium.com/@michallot/how-to-write-a-simple-downloading-app-with-flutter-2f55ae516867

thank you :)


Hayy, if you want to add some header value to Dio and use it to download maybe you can configure your Dio like this :

Dio dio = new Dio();
dio.options.headers["x-auth"] = "your_auth_token";

// and use it like this
response = await dio.post(url, data: data); 

And for the cookie manager capability, Dio offer you to use another package called name dio_cookie_manager

Thanks