downloadFile method
void
downloadFile()
Implementation
void downloadFile(String url, Map<String, String>? headers, Map<String, dynamic>? queryParams, String? savePath) async {
var finalURL = url.replaceAll("//v2//", "/v2/"); //@todo
final stringQueryParams = queryParams?.map((key, value) => MapEntry(key, value.toString()));
final uri = Uri.parse(finalURL);
final uriWithParams = uri.replace(queryParameters: stringQueryParams);
printCurlCommand(finalURL,headers,queryParams);
final response = await http.get(uriWithParams, headers: headers);
final blob = html.Blob([response.bodyBytes]);
final blobUrl = html.Url.createObjectUrlFromBlob(blob);
final anchor = html.AnchorElement(href: blobUrl)
..setAttribute('download', savePath ?? "arquivo")
..click();
}