downloadFile method

  1. @override
Future<void> downloadFile(
  1. String url,
  2. Map<String, dynamic> body
)
override

Implementation

@override
Future<void> downloadFile(String url, Map<String, dynamic> body) async {
  http.Response response = await http.post(
    Uri.parse(url),
    body: body,
  );
  var blob = html.Blob([response.bodyBytes], response.headers["content-type"], "native");
  html.AnchorElement(href: html.Url.createObjectUrl(blob).toString())
    ..setAttribute("download", "report.xlsx")
    ..click();
}