Suddenly this error appears in the debug console. I do not know what I did wrong.

- 4,198
- 5
- 17
- 50

- 473
- 1
- 3
- 6
-
1are you using agora??? – Vinamra Jaiswal Jul 06 '22 at 08:32
-
No I'm not using agora – MsPoojitha Jul 07 '22 at 14:10
-
This helped me : https://stackoverflow.com/a/70467105/15823478 – shaderone Feb 27 '23 at 16:38
9 Answers
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.

- 698
- 7
- 11
-
-
3
-
You can just upgrade the firebase_core package to the latest. That fixed the issue for me. – John Oyekanmi Aug 31 '22 at 23:41
-
The upgrade command is wrong. The correct command is: flutter pub upgrade outdated_package or more specifically: flutter pub upgrade firebase_core. Can you fix this? I'm willing to bet it's causing folks some lost time. – Crob Sep 12 '22 at 22:42
-
-
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)

- 342
- 1
- 7
-
It's not firebase_core, it's path_provider for the root reason caused this issue. – Nicholas Jela Nov 19 '22 at 13:18
-
I spent a long time looking into this and eventually traced it to the plugin registrar being nil
when setting up the plugin.
This was caused by setting my iOS app root view controller to anything other than FlutterViewController
(i.e. in my case, I had a UINavigationController
as the root). This will result in a failure to register all your plugins.
The app delegate assumes that the root view controller is a FlutterViewController
, so if it isn't then you will need to re-direct all plugin-related function calls to your FlutterViewController
from your app delegate by overriding these functions as follows:
override func registrar(forPlugin pluginKey: String) -> FlutterPluginRegistrar? {
flutterViewController.registrar(forPlugin: pluginKey)
}
override func hasPlugin(_ pluginKey: String) -> Bool {
flutterViewController.hasPlugin(pluginKey)
}
override func valuePublished(byPlugin pluginKey: String) -> NSObject? {
flutterViewController.valuePublished(byPlugin: pluginKey)
}

- 5,221
- 2
- 36
- 53
-
2This answer really needs more upvotes. The error happens exactly because of this. Sometimes the plugin registrar files are just out of date (or missing) and the commands in other answers fix them, but in some cases you might setup `FlutterViewController` wrong - especially in case of not having FlutterAppDelegate. So this answer gives you the correct direction. Helped me out a lot @jonathan, thanks! – Legoless Mar 17 '23 at 12:25
-
1Thank you for looking into the root cause. I then solve the problem by adding `GeneratedPluginRegistrant.register(with: ...` as the documentation said. (I was using the codes in *Create a FlutterViewController with an implicit FlutterEngine* section of the document so I somehow missed that PluginRegistrant thing.) – autodavid May 02 '23 at 03:33
-
Oh and by the way, if your `FlutterViewController` is inside a `UINavigationController`, you'll also find that `SystemChrome.setPreferredOrientations()` won't work either. I've just posted a workaround to that problem [here](https://stackoverflow.com/a/76191411/555485) (posting here as I reckon people will be looking at this answer who are likely to run into this issue!) – Jonathan Ellis May 06 '23 at 22:22
If you are using these dependecies then replace it with a latest version:
- firebase_messaging
- firebase_core
- flutter_local_notifications
Then in android/app/build.gradle
update compileSdkVersion flutter.compileSdkVersion
to 33

- 1,344
- 4
- 19
- 37

- 21
- 1
Please also check the compileSdkVersion
in android/app/build.gradle
and update it to 33

- 39
- 4
I was have this problem. after downgrade awesome_notifications package to 0.6.21, resolved this.

- 3,068
- 27
- 28
I also effected from that issue for few hours, finally I found issue that was I ran my emulator as windows (:, yeah please run with Android emulator you selected vm.
-
As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 27 '23 at 03:17
In my case i was trying to use "google_mobile_ads" and "admob_flutter" at the same time. You must choose one only.

- 47
- 5
This exception could also be thrown if you are running your app on windows, Try to run it on emulator.

- 9
- 3
-
1As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Feb 01 '23 at 05:59