如何在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 (将#修改为@)