Open prasanmoonraft opened 5 months ago
It's useful to look at the dart:html
source code here to compare. The code should be similar. The only difference is that the AnchorElement
constructor in dart:html
took in an href
that it explicitly set (well that and the rename of the type).
import 'package:web/web.dart' as web;
...
var anchorElement = web.HTMLAnchorElement()
..href = url
..setAttribute('download', '')
..click();
For Android build it's failing how we can use this as web and don't fail the android build The unavailable library 'dart:js_interop' is imported through these packages:
I'll need a bit more information, but if you're compiling to native, dart:js_interop
is unavailable as it's not a web platform.
with import 'dart:html' as html; was using this html.AnchorElement(href: url) // Set the download attribute to file name. ..setAttribute("download", "") // Trigger a click event on the anchor element to initiate the download. ..click(); and it's was working absolutely fine url: https://pdfobject.com/pdf/sample.pdf
how it'll work with web package