download method

Stream download(
  1. String url, {
  2. Map<String, String>? headers,
})

Implementation

Stream<dynamic> download(String url, {Map<String, String>? headers}) {
  final StreamController controller = StreamController();

  _downloadStreams[url] = controller;

  jsInvokeDownloadMethod(
    "download",
    url,
    headers != null ? json.encode(headers) : null,
  );

  return controller.stream;
}