Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose webview onWebResourceError callback #136

Merged
merged 1 commit into from Aug 9, 2021

Conversation

lisuizhe
Copy link
Contributor

@lisuizhe lisuizhe commented Jun 14, 2021

try resolve #129 properly

Is there a way to catch the Exception and call reload() for the webview render properly?

The blank issue may related to flutter/flutter#61795

I think this issue is because of a more general issue with the design of the framework itself. When the state of a widget changes, flutter doesn't change the widget, but discards it and makes a new one. This is fine for lightweight text widgets and such, but for webviews it means creating and destroying a webview every time the page is scrolled potentially.

I am using flutter_echarts plugin in my project, and facing blank issue too. It happen only on ios in practice(but may due to ios webview is resource heavy; more webview/echarts in a screen may increase the error rate)
For plugin side, currently best work-around maybe expose a callback when error for users to reload.

@lisuizhe
Copy link
Contributor Author

lisuizhe commented Aug 8, 2021

@entronad Could you please check this PR, thanks!

@entronad entronad merged commit d9aff3c into entronad:master Aug 9, 2021
@entronad
Copy link
Owner

entronad commented Aug 9, 2021

Thanks!

@entronad
Copy link
Owner

entronad commented Aug 9, 2021

Published 2.2.0

@lisuizhe
Copy link
Contributor Author

lisuizhe commented Aug 9, 2021

Thanks! @entronad
However, I am debugging the issue and found that:
sometimes the WebResourceError:webViewInvalidated is not triggering onWebResourceError but delayed until evaluateJavascript is called in webview_flutter.
So probably I need to raise another PR to expose an onEvaluateJavascriptError callback for flutter_echarts's users to handle

@entronad
Copy link
Owner

entronad commented Aug 9, 2021

OK, you can integrate the two callbacks in one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[iOS] setting reloadAfterInit to true still has error and white area
2 participants