download method
DOWNLOAD:
Downloads a file from the specified url and saves it to the user's downloads directory.
Returns the response on success, or handles errors using _handleError.
url: The URL of the file to download.
Implementation
Future<dynamic> download(String url) async {
try {
final downloadDirectory = await getDownloadsDirectory();
final path = "${downloadDirectory?.path}/${url.split('/').last}";
final response = await _dio.download(url, path);
return response;
} catch (e) {
return _handleError(e);
}
}