Home » Android » android – webView don't work in flutter [ERROR:flutter/lib/ui/ui_dart_state.cc(157)]-Exceptionshub

android – webView don't work in flutter [ERROR:flutter/lib/ui/ui_dart_state.cc(157)]-Exceptionshub

Posted by: admin February 26, 2020 Leave a comment

Questions:

I add in pubspec.yaml webview_flutter: ^0.3.19+8
i use Flutter version 1.12.13+hotfix.8

and it’s my code

import 'package:webview_flutter/webview_flutter.dart';

void main() => runApp(MaterialApp(
  home: app(),
));

class app extends StatefulWidget {
  @override
  _appState createState() => _appState();
}

class _appState extends State<app> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('App mobile'),
      ),
      body: Container(
        constraints: BoxConstraints(maxHeight: 500),
        child: WebView(
          initialUrl: "https://google.com",
        ),
      )
    );
  }
}

but after Run and click in white emulator screen, in tab Run i have this…

E/flutter ( 9570): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(error, java.lang.IllegalStateException: Sending touch to an unknown view with id: 1
E/flutter ( 9570):  at io.flutter.plugin.platform.PlatformViewsController$1.onTouch(PlatformViewsController.java:206)
E/flutter ( 9570):  at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.touch(PlatformViewsChannel.java:168)
...

I will appreciate any help…

How to&Answers: