Flutter: Firebase Authentication Create User Without Automatically Logging In. I experimented with the firebase authentication api and my current working solution is:
1 2 3 4 5 6 | static Future<FirebaseUser> register(String email, String password) async { FirebaseApp app = await FirebaseApp.configure( name: 'Secondary', options: await FirebaseApp.instance.options); return FirebaseAuth.fromApp(app) .createUserWithEmailAndPassword(email: email, password: password); } |
Essentially it comes down to creating a new instance of FirebaseAuth so the automatic login from createUserWithEmailAndPassword() do not affect the default instance.
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.