I have a flutter app that runs on Android and iOS without issues, but when I run it on web, I just get a blank browser screen. The first and only error message I see is:
Rejecting promise with error: TypeError: Cannot set properties of
undefined (setting ‘nativeCommunication’) in the file dom.dart, line
195.
This is followed by:
A message on the flutter/lifecycle channel was discarded before it
could be handled. This happens when a plugin sends messages to the
framework side before the framework has had an opportunity to register
a listener. See the ChannelBuffers API documentation for details on
how to configure the channel to expect more messages, or to expect
messages to get discarded:
https://api.flutter.dev/flutter/dart-ui/ChannelBuffers-class.html
This is repeated multiple times.
I even replaced the entire main.dart with the the sample flutter app main.dart and I still got the same issue. I think it has something to do with the overall set up. I am at my wits end as I have been struggling with this for over 3 days now.
Kindly help!
2
Answers
Hye, You can try creating a new Flutter project and after running the application on the web & then see what exactly the error occurs.
I was getting this error in an app that used the flutter_inappwebview package. For Flutter web builds, you need to add the following script to the body section of your
index.html
file (source):