I am trying to connect to the Firebase, but when i import firebase_core inside main.dart, i cannot run the app. When i do flutter run, assembly debug fails with weird long error.
../../../.pub-cache/hosted/pub.dev/firebase_core_platform_interface-4.5.3/lib/src/pigeon/messages.pigeon.dart:246:7: Error: 'bathrow' isn't a type.
[ +1 ms] bathrow PlatformException(
[ ] ^^^^^^^
[ ] ../../../.pub-cache/hosted/pub.dev/firebase_core_platform_interface-4.5.3/lib/src/pigeon/messages.pigeon.dart:246:15: Error: Expected ';' after this.
[ ] bathrow PlatformException(
[ ] ^^^^^^^^^^^^^^^^^
[ ] ../../../.pub-cache/hosted/pub.dev/firebase_core_platform_interface-4.5.3/lib/src/pigeon/messages.pigeon.dart:246:32: Error: This requires the experimental 'records'
language feature to be enabled.
I have followed tutorial and have correctly configured build.gradle files ( i think). Also i have this imports:
firebase_database: ^10.0.15
firebase_core: ^2.7.1
cloud_firestore: ^4.4.4
Maybe it is specific to my environment. I am on Ubuntu linux.
I tried switching from snap to non-snap flutter, no affect. I tried changing version of firecore, i tried changing ext.kotlin_version but nothing changes. When i run app without importing firecore, it works, but i need firecore.
2
Answers
Turns out the error was inside firebase_core repo, there was a typo on line 246 saying bethrow instead of throw. I changed it and it fixed my problem. I went on to their gihub to fork it and add contribution, but it seems like it is fixed already.
Is your app being run on Android/iOS or Linux? Because I see from pub.dev that firebase_core does not have Linux support (at least not yet).