fluttercommunity / fluttercommunity/flutter_webview_plugin
The webview got blocked when the there is some heavy computation in onMessageReceived.
- Langage dominant
- Java
- Étoiles
- 1.5k
- Forks
- 938
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
Hello,
I am using webview in my application, and I am using postmessages from communication and maintaining state between flutter app and webview.
The issue that I am struggling with is if there is some heavy computation is going on in onMessageReceived callback of JavascriptChannel then the webview stuck.
For Example:
```
javascriptChannels: [
JavascriptChannel(
name: 'Tts',
onMessageReceived: (JavascriptMessage msg) {
sleep(const Duration(seconds: 60)); <<-- something to mimic the computational delay.
ttsMessagesReceived.add(msg.message);
}),
].toSet(),
```
I was under impressions that webview has its own process and UI thread and flutter is executing in its own process. so, in that case this should not block each other.
Is there any way to make it async so that webview will continues its functioning smoothly and onMessageReceived will do its computation in parallel? I tried to wrap it with async / await but it didn't help..
Ref:
https://github.com/flutter/plugins/blob/master/packages/webview_flutter/test/webview_flutter_test.dart#L581
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
Commencez par le test référencé dans packages/webview_flutter/test/webview_flutter_test.dart autour de la ligne 581, puis reproduisez le problème en utilisant l’exemple onMessageReceived avec un callback de longue durée. Le travail est terminé lorsque la webview reste réactive pendant l’exécution du callback, avec une couverture de ce comportement.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- dart, flutter, javascript
- Domaine
- mobile-dev
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 20/100