Skip to content
This repository has been archived by the owner on Mar 19, 2021. It is now read-only.

Exception after logging in due to no Firebase App #15

Closed
ricsantos opened this issue Aug 19, 2020 · 1 comment
Closed

Exception after logging in due to no Firebase App #15

ricsantos opened this issue Aug 19, 2020 · 1 comment

Comments

@ricsantos
Copy link

I have followed the instructions on https://blog.codemagic.io/firebase-authentication-google-sign-in-using-flutter/, but had to update some of the authentication methods as it appears the latest version of the Firebase Auth SDK doesn't have AuthResult.

After signing in via Google, I get the following exception:

Exception has occurred.
FirebaseException ([core/no-app] No Firebase App '[DEFAULT]' has been created - call Firebase.initializeApp())

I have since added the firebase_core dependency and call Firebase.app() but the same error occurs.

final FirebaseApp app = Firebase.app();
final FirebaseAuth _auth = FirebaseAuth.instance;

Any help on this would be appreciated.

@ricsantos
Copy link
Author

I ended up changing the main() function to this:

Future<void> main() async {
  await Firebase.initializeApp();
  runApp(MyApp());
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant