Skip to content

Instantly share code, notes, and snippets.

@ologunB
Created February 2, 2021 20:26
Show Gist options
  • Save ologunB/c37de6d12ebb771f6b48303b57685cfa to your computer and use it in GitHub Desktop.
Save ologunB/c37de6d12ebb771f6b48303b57685cfa to your computer and use it in GitHub Desktop.
Future signUp() async {
_formKey.currentState.save();
_formKey.currentState.validate();
if (!_formKey.currentState.validate()) {
return;
}
offKeyboard(context);
setState(() {
isLoading = true;
});
await _auth
.createUserWithEmailAndPassword(
email: emailController.text, password: passwordController.text)
.then((value) {
User user = value.user;
if (value.user != null) {
user.sendEmailVerification().then((v) {}).catchError((e) {
showExceptionAlertDialog(context: context, exception: e, title: "Error".tr());
setState(() {
isLoading = false;
});
});
} else {
setState(() {
isLoading = false;
});
}
return;
}).catchError((e) {
showExceptionAlertDialog(context: context, exception: e, title: "Error".tr());
setState(() {
isLoading = false;
});
return;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment