Skip to content

Instantly share code, notes, and snippets.

@PeterHdd
Last active April 11, 2021 12:30
Show Gist options
  • Select an option

  • Save PeterHdd/9e1303dd8004628b43bcbec110bc0aa3 to your computer and use it in GitHub Desktop.

Select an option

Save PeterHdd/9e1303dd8004628b43bcbec110bc0aa3 to your computer and use it in GitHub Desktop.
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