如何解决如何在flutter中下载带有cookie的文件?
我尝试从我的 Flutter 应用程序下载带有链接的文件。我尝试使用 UrlLauncher.launch 打开 iy,它可以工作,但我无法添加 cookie。我也尝试过这个 InAppWebView 示例,但它不起作用或显示一些错误。
Flutter - How to download files in WebView?
我的 InAppWebView 代码:
Expanded(
child: InAppWebView(
initialUrlRequest: URLRequest(url: Uri.parse(widget.url)),initialOptions: InAppWebViewGroupOptions(
crossplatform:
InAppWebViewOptions(uSEOnDownloadStart: true),),onWebViewCreated: (InAppWebViewController controller) {
webView = controller;
},onDownloadStart: (controller,url) async {
print("onDownloadStart $url");
final taskId = await FlutterDownloader.enqueue(
url: url.toString(),savedDir: (await getExternalStorageDirectory()).path,showNotification:
true,// show download progress in status bar (for Android)
openFileFromNotification:
true,// click on notification to open downloaded file (for Android)
);
return taskId;
})),
日志:
I/Flutter (10379): onDownloadStart %myUrl%
W/WM-WorkSpec(10379): Backoff delay duration less than minimum value
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。