Skip to content

Instantly share code, notes, and snippets.

@aaronksaunders
Created June 4, 2019 17:52
Show Gist options
  • Save aaronksaunders/a301e630239b4aa64a5b2ada0579d1fd to your computer and use it in GitHub Desktop.
Save aaronksaunders/a301e630239b4aa64a5b2ada0579d1fd to your computer and use it in GitHub Desktop.
Markdium-Simple Firebase Login Flow in Flutter, Now Firebase
onPressed: () async {
// save the fields..
final form = _formKey.currentState;
form.save();
// Validate will return true if is valid, or false if invalid.
if (form.validate()) {
try {
FirebaseUser result =
await Provider.of(context).loginUser(
email: _email, password: _password);
print(result);
} on AuthException catch (error) {
// handle the firebase specific error
return _buildErrorDialog(context, error.message);
} on Exception catch (error) {
// gracefully handle anything else that might happen..
return _buildErrorDialog(context, error.toString());
}
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment