Got this error, suddenly. i don't know what i did wrong. [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: PlatformException(channel-error, Unable to establish connection on channel., null, null)
Got this error, suddenly. i don't know what i did wrong. [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: PlatformException(channel-error, Unable to establish connection on channel., null, null)
You've upgraded Flutter but not the packages. In the terminal enter
flutter pub outdated
Then upgrade the outdated packages one by one like this:
flutter pub upgrade outdated_package
After you're finished:
flutter clean
and
flutter pub get
Your problem should now be solved.
You can update dependencies that don't have major/breaking changes by running
flutter pub upgrade
Then clean your build folder with
flutter clean
And then get dependencies
flutter pub get
That should do the trick.
I had the same issue and stumped on this post.
In my case I was able to detect which plugin was in fact giving the error and it turned out to be firebase_core. So, I decided to upgrade the package to the latest version which happened to be 1.21.1 in my case.
So, to solve the issue I will suggest you try changing the version of the firebase_core package you're using to the latest in the pubspec.yaml file of your project like so:
firebase_core: ^1.21.1 (replace with latest verison)
Or you can just run:
flutter pub upgrade firebase_core
This will upgrade firebase_core to the latest version.
Or you can as well put any as the version code in the pubspec.yaml file of your project like so:
firebase_core: any (upgrades firebase_core to the latest verison)
Please also check the compileSdkVersion in android/app/build.gradle and update it to 33