I’m new to Flutter and Firebase and try to get a connection from a plain "flutter create test" project. Read a lot of tutorials but all seem to use Flutter2 but my project is using 3.7.7 and it seems not to work in the old way.
I created a public Firestore and got a Flutter2 tutorial app connecting, reading and writing. So it seems that Firestore is configured correctly.
I got google-services.json and put it in android/app directory.
In my test project I added these dependencies in pubspec.yaml`
cloud_firestore: ^4.4.5
firebase_core:
In main.dart I added
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(const MyApp());
}
When I try to run it I get this Exception:
PlatformException (PlatformException(channel-error, Unable to establish connection on channel., null, null))
So any further configuration needed? Or do I miss something else?
2
Answers
Found the solution: it seems that for any reason it is not working as Windows app. Using my smartphone or an emulated Android device it works like expected.
Try to update all firebase dependencies to the latest version using
flutter pub outdated
andflutter pub upgrade firebase_....
Or try an older version of firebase.