I am using flutter_webview_plugin: ^0.3.8
but I have the same problem with webview_flutter: ^0.3.13
.
In webview, I want to make use of a website which triggers a file download on successful completion of a captcha. However, I complete the captcha and nothing happens, no download.
Is there something in Flutter like a webview download listener ("webview.setDownloadListener")? I only need this for Android.
If not, is there a way of downloading files from a webview in Flutter?
You can use my plugin flutter_inappwebview, which is a Flutter plugin that allows you to add inline WebViews or open an in-app browser window and has a lot of events, methods, and options to control WebViews. It can recognize downloadable files in both Android (using setDownloadListener ) and iOS platforms!
It can recognize downloadable files in both Android (using setDownloadListener ) and iOS platforms! To be able to recognize downloadable files, you need to set the useOnDownloadStart: true option, and then you can listen the onDownloadStart event! Then, you need to ask permission using the permission_handler plugin.
To download the file and store it in the download folder using flutter we need to use files_utils and path_provider Plugin in our App. This will provide us to store files into our sdcard/downloads folder and then we can use flutter_downloader OR dio plugin to download file and then we can save it in our specific path.
just add this code to your AndroidManifest.xml
<provider
android:name="vn.hunghd.flutterdownloader.DownloadedFileProvider"
android:authorities="${applicationId}.flutter_downloader.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/>
</provider>
and add this code to your AndroidManifest.xml
it works to me
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With