-
-
Save sbis04/6ca36ad3523228bed92930e3494b22fe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Future<String> registerWithEmailPassword(String email, String password) async { | |
// Initialize Firebase | |
await Firebase.initializeApp(); | |
final UserCredential userCredential = await _auth.createUserWithEmailAndPassword( | |
email: email, | |
password: password, | |
); | |
final User user = userCredential.user; | |
if (user != null) { | |
// checking if uid or email is null | |
assert(user.uid != null); | |
assert(user.email != null); | |
uid = user.uid; | |
userEmail = user.email; | |
assert(!user.isAnonymous); | |
assert(await user.getIdToken() != null); | |
return 'Successfully registered, User UID: ${user.uid}'; | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment