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 929 forks source link

Make WebViewStateChanged's navigationType nullable #907

Open micaelcid opened 3 years ago

micaelcid commented 3 years ago

Description

After updating our app to use the latest null-safety release, we realized the onStateChanged stream stopped working in our Android devices and emulators.

After a few hours of debugging with @wescosta, we realized navigationType wasn't defined in the Map<String, dynamic> - so making it nullable resolved the issue.

Now all our WebViews are back and working like they used to.

Even the example project wasn't working before these changes. The WebviewScaffold with hidden was in a infinite "Waiting..." state.

micaelcid commented 3 years ago

Please, take a look @charafau

pushpendraKh commented 3 years ago

It is happening on iPhone also. Web view state is not changing (keeps on shouldStart)

shirakiya commented 2 years ago

@mainteiner Hi! I'm having trouble getting onStateChanged to work in my app on Android. When do you plan to merge this pull request?

augustorsouza commented 2 years ago

Hello guys, could you please merge this PR 🙏 ?

micaelcid commented 2 years ago

@charafau @slightfoot @lejard-h can you guys please take a look?

augustorsouza commented 2 years ago

@ramah @jonasfranz @themisir could you please take a look?

themisir commented 2 years ago

@augustorsouza I don't have write permissions to the repository. I would suggest using dependency from git source until the changes are released.

furkeen commented 2 years ago

@micaelcid thank you so much. I spent lots of time fixing problem, and finally, find your PR.

ramah commented 2 years ago

@augustorsouza Hello. Sorry for the delay of my response. Hope you found what you needed.

micaelcid commented 2 years ago

Hey, @charafau. Could you please review, merge and get this PR in the next release? It seems that plenty of people wants this fix too 😢

petra-bios commented 2 years ago

does anyone have forks with this fix and migrated to V2 embedding?

tulioccalazans commented 1 year ago

I was able to make this work by overriding the dependency and using this fork created by @micaelcid

Just add it on your pubspec.yaml

dependency_overrides:   
  flutter_webview_plugin: #https://github.com/fluttercommunity/flutter_webview_plugin/pull/907
    git:
      url: https://github.com/micaelcid/flutter_webview_plugin.git
      ref: fix/webview-state-changed

Thanks @micaelcid! I hope this PR will be accepted soon!

micaelcid commented 1 year ago

Hey folks, just letting you know:

We're not using this fork anymore, although I'll leave this PR opened as a reference, in case anyone still needs it.

We fully migrated to https://pub.dev/packages/webview_flutter after they added file upload feature to the Android platform.