Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a requirement ,in app I need to navigate the user to webview (website) and there will be a form with 5 fields and once the form is submitted a flag to be passed to app and app should work based on the flag .. So how it can be achieved

I have checked that there is a url_launcher or webview_flutter but i don know how to redirect the app once the form is submitted in website

question from:https://stackoverflow.com/questions/65939285/open-url-and-submitted-data-to-app-in-flutter

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
347 views
Welcome To Ask or Share your Answers For Others

1 Answer

I am not entirely sure if I understood the problem. But here is what can be done.

  1. Open url in webview.
  2. Now you should listen to webview state change. There must be a listener for this. say the listener is webViewStateChanged which will give you the state of webview.

Then you can check like

  void webViewStateChanged(WebViewStateChanged newState) async {
    if (newState.type != WebViewState.finishLoad ||
        newState.url != desiredURL) {
      return;
    }

    // At this point, you want to return to your app. If you need data from 
    // website, you can do so by accessing cookies of webview. 

    // Now you are back to the app, you can pop/replace the webview whatever
    // is your requirement. 


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...