fluttercommunity / fluttercommunity/flutter_webview_plugin

The webview got blocked when the there is some heavy computation in onMessageReceived.

Abierto
#857 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Java
Estrellas
1.5k
Forks
938
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Comienza con la prueba referenciada en packages/webview_flutter/test/webview_flutter_test.dart alrededor de la línea 581 y, después, reproduce el problema usando el ejemplo de onMessageReceived con un callback de larga duración. El trabajo estará completo cuando la webview siga respondiendo mientras se ejecuta el callback, con cobertura para ese comportamiento.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
dart, flutter, javascript
Área
mobile-dev
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
20/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.