fluttercommunity / flutter_webview_plugin

Community WebView Plugin - Allows Flutter to communicate with a native WebView.
https://pub.dev/packages/flutter_webview_plugin
Other
1.48k stars 932 forks source link

Listener for unmanaged file extensions. #777

Open EdoardoVignati opened 4 years ago

EdoardoVignati commented 4 years ago

Hi, I think it could be very useful to manage other types of file.

I tried to open txt files, mp3 files and it seems fine. What about pdf, doc etc???

I would like to download (or open in a different app) for example pdf files but at the moment the listener cannot listen to this extensions...

flutterWebviewPlugin.onUrlChanged.listen((String url) async {
      if (url.contains('.pdf')) {
        print(url); //This print is never done
      }
      if (url.contains('.doc')) {
        print(url); //This print is never done
      }
      if (url.contains('mailto:')) {
        print(url); //This print is ok
      }
      if (url.contains('.txt')) {
        print(url); //This print is ok
      }
      if (url.contains('.mp3')) {
        print(url); //This print is ok
      }
    }