Last active
April 11, 2021 12:30
-
-
Save PeterHdd/9e1303dd8004628b43bcbec110bc0aa3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| void registerToFb() { | |
| firebaseAuth | |
| .createUserWithEmailAndPassword( | |
| email: emailController.text, password: passwordController.text) | |
| .then((result) { | |
| dbRef.child(result.user.uid).set({ | |
| "email": emailController.text, | |
| "age": ageController.text, | |
| "name": nameController.text | |
| }).then((res) { | |
| Navigator.pushReplacement( | |
| context, | |
| MaterialPageRoute(builder: (context) => Home(uid: result.user.uid)), | |
| ); | |
| }); | |
| }).catchError((err) { | |
| showDialog( | |
| context: context, | |
| builder: (BuildContext context) { | |
| return AlertDialog( | |
| title: Text("Error"), | |
| content: Text(err.message), | |
| actions: [ | |
| TextButton( | |
| child: Text("Ok"), | |
| onPressed: () { | |
| Navigator.of(context).pop(); | |
| }, | |
| ) | |
| ], | |
| ); | |
| }); | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment